string LoginId = txtLoginId.Text.Trim().ToLower();
string Password = txtPassword.Text.Trim();
if (countloginid != LoginId)
{
count = 1;
}
Session["User_LoginId"] = LoginId;
DataTable dtUser = objManageUsers.VerifyUserLogin(LoginId, Password);
if (dtUser != null && dtUser.Rows.Count > 0)
{
if (LoginId == dtUser.Rows[0]["LoginId"].ToString() && Password == dtUser.Rows[0]["Password"].ToString())
{
if (Convert.ToString(dtUser.Rows[0]["AccessLevel"]) != "1" && Convert.ToString(dtUser.Rows[0]["AccessLevel"]) != "9")
{
if (Convert.ToString(Session["Blok_UserEmailId"]) == LoginId)
{
this.errorMessageHtmlCell.Attributes.Add("style", "color:Red");
this.errorMessageHtmlCell.InnerText = "Your email id has been blocked";
}
else
{
Session["UserName"] = dtUser.Rows[0]["UserName"];
Session["UserId"] = dtUser.Rows[0]["UserId"];
Session["AccessLevel"] = dtUser.Rows[0]["AccessLevel"];
Session["DeletedFlag"] = dtUser.Rows[0]["DeletedFlag"];
Session["UpdateHRData"] = dtUser.Rows[0]["UpdateHRData"];
Session["UpdateOprnData"] = dtUser.Rows[0]["UpdateOprnData"];
Session["UpdateMktData"] = dtUser.Rows[0]["UpdateMktData"];
FormsAuthentication.RedirectFromLoginPage("Welcome! " + Convert.ToString(Session["UserName"]) + " | ", true);
Response.Redirect("~/Home.aspx");
}
}
else
{
Session["UserName"] = dtUser.Rows[0]["UserName"];
Session["UserId"] = dtUser.Rows[0]["UserId"];
Session["AccessLevel"] = dtUser.Rows[0]["AccessLevel"];
Session["DeletedFlag"] = dtUser.Rows[0]["DeletedFlag"];
Session["UpdateHRData"] = dtUser.Rows[0]["UpdateHRData"];
Session["UpdateOprnData"] = dtUser.Rows[0]["UpdateOprnData"];
Session["UpdateMktData"] = dtUser.Rows[0]["UpdateMktData"];
FormsAuthentication.RedirectFromLoginPage("Welcome! " + Convert.ToString(Session["Fname"]) + " " + Convert.ToString(Session["Lname"]) + " | ", true);
Response.Redirect("~/Default.aspx");
}
}
else
{
this.errorMessageHtmlCell.Attributes.Add("style", "color:Red");
this.errorMessageHtmlCell.InnerText = "The login id or password you entered is incorrect.";
txtPassword.Focus();
}
}
else
{
countloginid = Session["User_LoginId"].ToString();
int sessioncount = count++;
if (sessioncount == 3)
{
Session["Blok_UserEmailId"] = Session["User_LoginId"];
this.errorMessageHtmlCell.Attributes.Add("style", "color:Red");
this.errorMessageHtmlCell.InnerText = "Your Email Id has been blocked";
}
else
{
this.errorMessageHtmlCell.Attributes.Add("style", "color:Red");
this.errorMessageHtmlCell.InnerText = "The login id or password you entered is incorrect.";
txtPassword.Focus();
}