protected void BtnLogin_Click(object sender, EventArgs e) { try { DataSet dsCHNO = obj_Login.GetCHNO(LBLSERIALNO.Text.Trim(), out StrError); Entity_Login.UserName = TxtUserName.Text.Trim(); Entity_Login.Password = TxtPass.Text.Trim(); // Entity_Login.CafeID = Convert.ToInt32(DDLLoc.SelectedValue); dsLogin = obj_Login.GetLoginInfo(ref Entity_Login, out StrError); if (dsLogin.Tables.Count > 0 && dsLogin.Tables[0].Rows.Count > 0) { Session.Add("UserName", dsLogin.Tables[0].Rows[0]["UserName"].ToString()); Session.Add("UserID", dsLogin.Tables[0].Rows[0]["UserID"].ToString()); Session.Add("Password", dsLogin.Tables[0].Rows[0]["Password"].ToString()); Session.Add("CafeteriaId", dsLogin.Tables[2].Rows[0]["SiteID"].ToString()); Session.Add("CafeteriaNo", dsLogin.Tables[2].Rows[0]["Site"].ToString()); Session.Add("Location", DDLLoc.SelectedItem.ToString()); Session.Add("SiteID", dsLogin.Tables[2].Rows[0]["SiteID"].ToString()); Session.Add("SiteName", dsLogin.Tables[2].Rows[0]["SiteID"].ToString()); Session.Add("IsCentral", dsLogin.Tables[0].Rows[0]["IsCentral"].ToString()); Session["mob"] = dsLogin.Tables[0].Rows[0]["mob"].ToString(); //Session.Add("FinStartDate", dsLogin.Tables[3].Rows[0]["StartDate"].ToString()); //Session.Add("FinEndDate", dsLogin.Tables[3].Rows[0]["StartDate"].ToString()); if (Convert.ToBoolean(dsLogin.Tables[0].Rows[0]["IsAdmin"].ToString()) == true) { Session.Add("UserRole", "Administrator"); } else { Session.Add("UserRole", "User"); } if (dsLogin.Tables[1].Rows.Count > 0) { Session.Add("DataSet", dsLogin); } if (dsLogin.Tables[4].Rows.Count > 0) { Session.Add("DataSetSpecialPermission", dsLogin); } //Session.Add("FinStartDate1", Convert.ToDateTime(dsLogin.Tables[3].Rows[0]["StartDate"].ToString()).ToString("dd-MM-yyyy")); //Session.Add("FinEndDate1", Convert.ToDateTime(dsLogin.Tables[3].Rows[0]["EndDate"].ToString()).ToString("dd-MM-yyyy")); Response.Redirect("~/Masters/Default.aspx"); } else { obj_Msg.ShowPopUpMsg("Invalid Login....!!", this.Page); MakeEmptyForm(); } } catch (ThreadAbortException) { } catch (Exception ex) { throw new Exception(ex.Message); } }
protected void BtnLogin_Click(object sender, EventArgs e) { try { Entity_Login.UserName = TxtUserName.Text.Trim(); Entity_Login.Password = TxtPass.Text.Trim(); dsLogin = obj_Login.GetLoginInfo(ref Entity_Login, out StrError); if (dsLogin.Tables.Count > 0 && dsLogin.Tables[0].Rows.Count > 0) { Session.Add("UserName", dsLogin.Tables[0].Rows[0]["UserName"].ToString()); Session.Add("UserID", dsLogin.Tables[0].Rows[0]["UserID"].ToString()); Session.Add("Password", dsLogin.Tables[0].Rows[0]["Password"].ToString()); Session.Add("EmpID", dsLogin.Tables[0].Rows[0]["EmpID"].ToString()); Session.Add("Admin", dsLogin.Tables[0].Rows[0]["Admin"].ToString()); if (Convert.ToBoolean(dsLogin.Tables[0].Rows[0]["IsAdmin"].ToString()) == true) { Session.Add("UserRole", "Administrator"); } else { Session.Add("UserRole", "User"); } if (dsLogin.Tables[1].Rows.Count > 0) { Session.Add("DataSet", dsLogin); } //Response.Redirect("~/Masters/HomeNew.aspx"); Response.Redirect("~/Masters/Home.aspx"); } else { obj_Msg.ShowPopUpMsg("Invalid Login....!!", this.Page); // UserLogin.Authenticate=false ; } } catch (ThreadAbortException) { } catch (Exception ex) { throw new Exception(ex.Message); } }