Asp.Net

Tuesday, 20 August 2013

BAL

BAL Page:
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Healthtips"].ToString());
    DAL dal = new DAL();
    DataSet ds = new DataSet();
    DataSet ds1 = new DataSet();
public bool logincheck(string username, string password)
    {
        try
        {
            string str = "Sp_Logincheck";
            SqlParameter[] par = new SqlParameter[2];
            par[0] = new SqlParameter("@Username", username);
            par[1] = new SqlParameter("@Password", password);
            if (dal.logincheck(str, par))
            {
                return true;

            }
            else
            {
                return false;
            }

        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    public bool createusers(string userid, string name, string phonenumber, string email, string username, string password, string city, string state, string country, string gender)
    {
        try
        {
            string str = "Sp_Insertusers";
            SqlParameter[] par = new SqlParameter[10];
            par[0] = new SqlParameter("@User_Id", userid);
            par[1] = new SqlParameter("@Name",name);
            par[2] = new SqlParameter("@Phonenumber",phonenumber);
            par[3] = new SqlParameter("@Email_Id",email);
            par[4] = new SqlParameter("@Username",username);
            par[5] = new SqlParameter("@Password",password);
            par[6] = new SqlParameter("@City",city);
            par[7] = new SqlParameter("@State",state);
            par[8] = new SqlParameter("@Country",country);
            par[9] = new SqlParameter("@Gender",gender);
            if (dal.createusers(str, par))
            {
                return true;
            }
            else
            {
                return false;
            }


        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

No comments:

Post a Comment