protected void btnRegister_Click(object sender, EventArgs e)
 {
     try
     {
         UserAuthenticationNew_BAL userAuthenticationNew_BAL = new UserAuthenticationNew_BAL();
         string ut = "";
         if (PassingValues.uType == 1)
         {
             ut = "A";
         }
         else
         {
             ut = "U";
         }
         int x = userAuthenticationNew_BAL.registerCustomer(txtName.Text, txtPassword.Text, txtDOB.Text, txtEmail.Text, txtPhoneNo.Text, ddlCountry.SelectedValue.ToString(), ddlCity.SelectedValue.ToString(), txtPinCode.Text, ut);
         if (x == 1)
         {
             string reg_cust_id = PassingValues.Reg_Cust_Id;
             Response.Write("Registration Successful...Your UserId : " + reg_cust_id);
         }
         else
         {
             Response.Write("Please Enter Correct Credentials");
         }
         PassingValues.uType = 0;
     }
     catch (Exception ex)
     {
         using (StreamWriter streamwriter = new StreamWriter(ConfigurationManager.AppSettings["Logpath"].ToString(), true))
         {
             streamwriter.WriteLine(DateTime.Now + " " + ex.Message);
         }
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "StateSelectionError", "alert('" + ex.Message + "');", true);
     }
 }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        UserAuthenticationNew_BAL userAuthenticationNew_BAL = new UserAuthenticationNew_BAL();


        int x = userAuthenticationNew_BAL.authenticateCustomer(txtUserId.Text, txtContact.Text, txtPassword.Text);

        if (x == 1)
        {
            loginStatus = 1;

            CustomerNew_BAL customerNew_BAL = new CustomerNew_BAL();



            FormsAuthentication.SetAuthCookie(txtUserId.Text, chkRememberMe.Checked);
            HttpCookie httpCookie = new HttpCookie("UserId", txtUserId.Text);
            string[]   s          = new string[3];
            string     ct;
            s = customerNew_BAL.getCustomerNameAndUserTypeByCustomerId(txtUserId.Text);
            Session["UserId"]          = txtUserId.Text;
            PassingValues.CustomerName = s[0];

            PassingValues.CustomerAge = Convert.ToInt16(s[2]);


            Session["CustomerAge"] = PassingValues.CustomerAge;
            ct = s[1];
            if (ct == "A")
            {
                Response.Redirect("~/UserForms/Add_Hotel.aspx");
            }
            else if (ct == "U")
            {
                Response.Redirect("~/Search_Hotel.aspx");
            }
            PassingValues.CustomerId = txtUserId.Text;
        }
        else
        {
            Response.Write("<script>alert('Enter valid credential');</script>");
        }
    }