Beispiel #1
0
 protected void LoginButton_Click(object sender, EventArgs e)
 {
     try
     {
         HRSCustomersBLL CustomerBLLObject = new HRSCustomersBLL();
         string          userId            = UserIDTextbox.Text;
         string          password          = LoginPasswordTextbox.Text;
         bool            isAuthenticated   = CustomerBLLObject.VerifyUser(userId, password);
         if (isAuthenticated)
         {
             FormsAuthentication.RedirectFromLoginPage(UserIDTextbox.Text, true);
             Session["userId"] = userId;
             Response.Redirect("SearchHotel.aspx");
         }
         else
         {
             ErrorMessageLabel.Text = "Invalid Username or Password";
             System.Text.StringBuilder sb = new System.Text.StringBuilder();
             sb.Append(@"<script type='text/javascript'>");
             sb.Append("$(function () {");
             sb.Append(" $('#Result').modal('show');});");
             sb.Append("</script>");
             ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ModelScript", sb.ToString(), false);
         }
     }
     catch (Exception ex)
     {
         Utility.ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
Beispiel #2
0
 protected void LoginButton_Click(object sender, EventArgs e)
 {
     try
     {
         HRSCustomersBLL customerBLLObject = new HRSCustomersBLL();
         string          userId            = UserIDTextbox.Text;
         string          password          = PasswordTextbox.Text;
         bool            isAuthenticated   = customerBLLObject.VerifyUser(userId, password);
         if (isAuthenticated)
         {
             if (Request.QueryString.Count >= 1)
             {
                 if (Request.QueryString["ReturnUrl"].ToString().Contains(Utility.HRSConstants.ADMIN))
                 {
                     if (userId.EndsWith(Utility.HRSConstants.ADMINENDSTRING))
                     {
                         FormsAuthentication.RedirectFromLoginPage(UserIDTextbox.Text, true);
                         Session["userId"] = userId;
                     }
                     else
                     {
                         System.Text.StringBuilder sb = new System.Text.StringBuilder();
                         sb.Append(@"<script type='text/javascript'>");
                         sb.Append("$(function () {");
                         sb.Append(" $('#Result').modal('show');});");
                         sb.Append("</script>");
                         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ModelScript", sb.ToString(), false);
                         ErrorMessageLabel.Text = "Unathourised User";
                     }
                 }
                 else
                 {
                     FormsAuthentication.RedirectFromLoginPage(UserIDTextbox.Text, true);
                     Session["userId"] = userId;
                 }
             }
             else
             {
                 FormsAuthentication.RedirectFromLoginPage(UserIDTextbox.Text, true);
                 Session["userId"] = userId;
             }
         }
         else
         {
             System.Text.StringBuilder sb = new System.Text.StringBuilder();
             sb.Append(@"<script type='text/javascript'>");
             sb.Append("$(function () {");
             sb.Append(" $('#Result').modal('show');});");
             sb.Append("</script>");
             ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ModelScript", sb.ToString(), false);
             ErrorMessageLabel.Text = "Invalid UserID or Password";
         }
     }
     catch (Exception ex)
     {
         Utility.ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }