protected bool AllowMultiLangual() { bool Flag = false; try { SBlogic = new Student_DashBoard_BLogic(); DataSet dsMultiLangual = new DataSet(); dsMultiLangual = SBlogic.BAL_Select_PaymentPagesInfo("MultiLangual"); if (dsMultiLangual != null & dsMultiLangual.Tables.Count > 0) { if (dsMultiLangual.Tables[0].Rows.Count > 0) { if (dsMultiLangual.Tables[0].Rows[0]["value"].ToString() == "0") { Flag = false; } else { Flag = true; } } } } catch (Exception ex) { WebMsg.Show(ex.Message); } return(Flag); }
public bool CheckPasswordComplexcity() { bool flag = false; OBLogic_Student = new Student_DashBoard_BLogic(); DataSet dsResult = new DataSet(); dsResult = OBLogic_Student.BAL_Select_PaymentPagesInfo("Password"); string Complexcity = dsResult.Tables[0].Rows[0]["value"].ToString(); if (txtPassword.Text.Length > 0) { if (System.Text.RegularExpressions.Regex.IsMatch(txtPassword.Text, Complexcity)) { //WebMsg.Show("Valid Password"); flag = true; } else { //WebMsg.Show("Invalid Password"); flag = false; } } return(flag); }
/// <summary> /// Method wil be used to get product id. /// </summary> /// <returns>Returns string value</returns> public static string GetProductID() { string ProductID = string.Empty; try { Student_DashBoard_BLogic SBlogic = new Student_DashBoard_BLogic(); DataSet dsProduct = new DataSet(); dsProduct = SBlogic.BAL_Select_PaymentPagesInfo("Product"); if (dsProduct != null & dsProduct.Tables.Count > 0) { if (dsProduct.Tables[0].Rows.Count > 0) { ProductID = dsProduct.Tables[0].Rows[0]["value"].ToString(); } } } catch (Exception ex) { WebMsg.Show(ex.Message); } return(ProductID); }
//public void ShowMessage(string message) //{ // this.lblMessage.Text = message; // ModalMessageExtender.Show(); //} protected void RedirectToDashboard() { try { // 0 Indicates Student StudentDash = new StudentDash(); BLogic_Student = new Student_DashBoard_BLogic(); DataSet dtLogin = new DataSet(); DataTable LoginInfo = new DataTable(); DataTable UserInfo = new DataTable(); obj_SYS_Role = new SYS_Role(); obj_BAL_SYS_Role = new SYS_Role_BLogic(); obj_SYS_Role.Username = txtEmail.Text; obj_SYS_Role.Password = ViewState["strpassword"].ToString(); //obj_SYS_Role.roleid = Convert.ToInt16(DdlRole.SelectedValue); //if (uctxtEmail.Text != "" && uctxtpass.Text != "") //{ dtLogin = obj_BAL_SYS_Role.BAL_SYS_Student_Login(obj_SYS_Role); LoginInfo = dtLogin.Tables[0]; //} if (LoginInfo.Rows.Count > 0 && LoginInfo != null) { AppSessions.AppUserType = "Student"; AppSessions.StudentID = Convert.ToInt32(LoginInfo.Rows[0]["StudentID"].ToString()); AppSessions.UserName = LoginInfo.Rows[0]["FirstName"].ToString(); AppSessions.BMSID = Convert.ToInt32(LoginInfo.Rows[0]["BMSID"].ToString()); AppSessions.BMS = LoginInfo.Rows[0]["BMS"].ToString(); AppSessions.BoardID = Convert.ToInt32(LoginInfo.Rows[0]["BoardID"].ToString()); AppSessions.Board = LoginInfo.Rows[0]["Board"].ToString(); AppSessions.MediumID = Convert.ToInt32(LoginInfo.Rows[0]["MediumID"].ToString()); AppSessions.Medium = LoginInfo.Rows[0]["Medium"].ToString(); AppSessions.StandardID = Convert.ToInt32(LoginInfo.Rows[0]["StandardID"].ToString()); AppSessions.Standard = LoginInfo.Rows[0]["Standard"].ToString(); AppSessions.DivisionID = Convert.ToInt32(LoginInfo.Rows[0]["DivisionID"].ToString()); //AppSessions.Division = LoginInfo.Rows[0]["Division"].ToString(); AppSessions.SchoolID = Convert.ToInt32(LoginInfo.Rows[0]["SchoolID"].ToString()); //AppSessions.SchoolName = LoginInfo.Rows[0]["SchoolName"].ToString(); AppSessions.Role = LoginInfo.Rows[0]["Role"].ToString(); AppSessions.RoleID = Convert.ToInt32(LoginInfo.Rows[0]["RoleID"].ToString()); AppSessions.IsFreePackage = IsFreePackage(); //AppSessions.EmailID = Convert.ToString(LoginInfo.Rows[0]["EmailID"]); //yourLoginMethodStudent(LoginInfo); bool AllowMultipleSession = false; AllowMultipleSession = Convert.ToBoolean(LoginInfo.Rows[0]["AllowMultipleSession"].ToString()); //Hashtable sessions1 = (Hashtable)Application["WEB_SESSIONS_OBJECT"]; //HttpSessionState existingUserSession1 = (HttpSessionState)sessions1[Session["StudentID"].ToString()]; //if (existingUserSession1 != null) //{ // Response.Redirect("../Dashboard/StudentDashboard.aspx"); //} if (AllowMultipleSession == false) { Hashtable sessions = (Hashtable)Application["WEB_SESSIONS_OBJECT"]; if (sessions == null) { sessions = new Hashtable(); } HttpSessionState existingUserSession = (HttpSessionState)sessions[Session["StudentID"].ToString()]; if (existingUserSession != null) { ////existingUserSession[Session["EmpolyeeID"].ToString()] = null; //logout current logged in user WebMsg.Show("you are already logged in."); return; } } ////////getting the pointer to the Session of the current logged in user yourLoginMethodStudent(LoginInfo); //ProceedToRedirectPage(LoginInfo); bool AllowPayment = false; DataSet dsPaymentInfo = new DataSet(); dsPaymentInfo = BLogic_Student.BAL_Select_PaymentPagesInfo("Payment"); if (dsPaymentInfo != null & dsPaymentInfo.Tables.Count > 0) { if (dsPaymentInfo.Tables[0].Rows.Count > 0) { string a = dsPaymentInfo.Tables[0].Rows[0]["value"].ToString(); if (a == "0") { AllowPayment = false; } else { AllowPayment = true; } } } DataSet ds = new DataSet(); StudentDash.StudentID = AppSessions.StudentID; //ds = BLogic_Student.BAL_Validate_Student(StudentDash); ds = BLogic_Student.BAL_Validate_Student_Package(StudentDash); TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmployeeOrStudentID), Convert.ToInt16(AppSessions.DivisionID), "Login", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.LoginSuccess), "LoginId: " + txtEmail.Text, 0); if (AllowPayment == true) { //Session["ShowPaymentPages"] = "yes"; if (ds != null && dtLogin.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { Session["CheckValidity"] = "Yes"; ProceedToRedirect(); } else { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('We have sent your Login details on your registered Email Address, kindly check your Email to get your Password. ');window.open('../DashBoard/StudentDashboard.aspx','_self');", true); //Response.Redirect("~/DashBoard/StudentDashboard.aspx", false); //ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Congratulation! You got free trial for 30 days. \\n We have sent your Login details on your registered Email Address. ');window.open('../DashBoard/StudentDashboard.aspx','_self');", true); TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmployeeOrStudentID), Convert.ToInt16(AppSessions.DivisionID), "Login", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.PackageSelection), "LoginId: " + txtEmail.Text, 0); } } else { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('We have sent your Login details on your registered Email Address, kindly check your Email to get your Password. ');window.open('../DashBoard/StudentDashboard.aspx','_self');", true); //Response.Redirect("~/DashBoard/StudentDashboard.aspx", false); TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmployeeOrStudentID), Convert.ToInt16(AppSessions.DivisionID), "Login", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.PackageSelection), "LoginId: " + txtEmail.Text, 0); } } else { Session["CheckValidity"] = "Yes"; Session["ShowPaymentPages"] = "No"; ProceedToRedirect(); } } } catch (Exception) { } }
protected void btnGo_Click(object sender, EventArgs e) { try { StoreCookie(); int status = CheckLogin(); //if (ddlUserType.SelectedValue == "0") if (status == 2) { WebMsg.Show("invalid username or password"); return; } else if (status == 0) { // 0 Indicates Student StudentDash = new StudentDash(); BLogic_Student = new Student_DashBoard_BLogic(); DataSet dtLogin = new DataSet(); DataTable LoginInfo = new DataTable(); DataTable UserInfo = new DataTable(); obj_SYS_Role = new SYS_Role(); obj_BAL_SYS_Role = new SYS_Role_BLogic(); obj_SYS_Role.Username = txtUserName.Text; obj_SYS_Role.Password = txtUserPassword.Text; //obj_SYS_Role.roleid = Convert.ToInt16(DdlRole.SelectedValue); dtLogin = obj_BAL_SYS_Role.BAL_SYS_Student_Login(obj_SYS_Role); LoginInfo = dtLogin.Tables[0]; if (LoginInfo.Rows.Count > 0 && LoginInfo != null) { AppSessions.AppUserType = "Student"; AppSessions.StudentID = Convert.ToInt32(LoginInfo.Rows[0]["StudentID"].ToString()); AppSessions.UserName = LoginInfo.Rows[0]["FirstName"].ToString(); AppSessions.BMSID = Convert.ToInt32(LoginInfo.Rows[0]["BMSID"].ToString()); AppSessions.BMS = LoginInfo.Rows[0]["BMS"].ToString(); AppSessions.BoardID = Convert.ToInt32(LoginInfo.Rows[0]["BoardID"].ToString()); AppSessions.Board = LoginInfo.Rows[0]["Board"].ToString(); AppSessions.MediumID = Convert.ToInt32(LoginInfo.Rows[0]["MediumID"].ToString()); AppSessions.Medium = LoginInfo.Rows[0]["Medium"].ToString(); AppSessions.StandardID = Convert.ToInt32(LoginInfo.Rows[0]["StandardID"].ToString()); AppSessions.Standard = LoginInfo.Rows[0]["Standard"].ToString(); AppSessions.DivisionID = Convert.ToInt32(LoginInfo.Rows[0]["DivisionID"].ToString()); //AppSessions.Division = LoginInfo.Rows[0]["Division"].ToString(); AppSessions.SchoolID = Convert.ToInt32(LoginInfo.Rows[0]["SchoolID"].ToString()); //AppSessions.SchoolName = LoginInfo.Rows[0]["SchoolName"].ToString(); AppSessions.Role = LoginInfo.Rows[0]["Role"].ToString(); AppSessions.RoleID = Convert.ToInt32(LoginInfo.Rows[0]["RoleID"].ToString()); yourLoginMethodStudent(LoginInfo); bool AllowPayment = false; DataSet dsPaymentInfo = new DataSet(); dsPaymentInfo = BLogic_Student.BAL_Select_PaymentPagesInfo("Payment"); if (dsPaymentInfo != null & dsPaymentInfo.Tables.Count > 0) { if (dsPaymentInfo.Tables[0].Rows.Count > 0) { string a = dsPaymentInfo.Tables[0].Rows[0]["value"].ToString(); if (a == "0") { AllowPayment = false; } else { AllowPayment = true; } } } DataSet ds = new DataSet(); StudentDash.StudentID = AppSessions.StudentID; // ds = BLogic_Student.BAL_Validate_Student(StudentDash); ds = BLogic_Student.BAL_Validate_Student_Package(StudentDash); if (AllowPayment == true) { if (ds != null && dtLogin.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { Session["CheckValidity"] = "Yes"; ProceedToRedirect(); } else { Response.Redirect("~/DashBoard/SelectPackage.aspx"); } } else { Response.Redirect("~/DashBoard/SelectPackage.aspx"); } } else { Session["CheckValidity"] = "Yes"; Session["ShowPaymentPages"] = "No"; ProceedToRedirect(); } } } else if (status == 1) { // 1 Indicates Teacher DataSet dtLogin = new DataSet(); DataTable LoginInfo = new DataTable(); DataTable UserInfo = new DataTable(); obj_SYS_Role = new SYS_Role(); obj_BAL_SYS_Role = new SYS_Role_BLogic(); obj_SYS_Role.Username = txtUserName.Text; obj_SYS_Role.Password = txtUserPassword.Text; //obj_SYS_Role.roleid = Convert.ToInt16(DdlRole.SelectedValue); dtLogin = obj_BAL_SYS_Role.BAL_SYS_Active_Login(obj_SYS_Role); LoginInfo = dtLogin.Tables[0]; if (LoginInfo.Rows.Count > 0 && LoginInfo != null && LoginInfo.Rows[0]["Status"].ToString().Equals("1")) { if (dtLogin.Tables[1].Rows[0]["RoleID"].ToString() != "3") { bool AllowMultipleSession = false; UserInfo = dtLogin.Tables[1]; if (UserInfo.Rows.Count > 0 && UserInfo != null) { AppSessions.AppUserType = "School"; AppSessions.EmpolyeeID = int.Parse(UserInfo.Rows[0]["EmployeeID"].ToString()); AppSessions.RoleID = int.Parse(UserInfo.Rows[0]["RoleID"].ToString()); AppSessions.SchoolID = int.Parse(UserInfo.Rows[0]["SchoolID"].ToString()); AppSessions.UserName = UserInfo.Rows[0]["FirstName"].ToString(); AppSessions.SchoolName = UserInfo.Rows[0]["Name"].ToString(); AppSessions.Role = UserInfo.Rows[0]["Role"].ToString(); AllowMultipleSession = Convert.ToBoolean(UserInfo.Rows[0]["AllowMultipleSession"].ToString()); TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmpolyeeID), Convert.ToInt16(AppSessions.DivisionID), "LoginPage", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.LoginSuccess), "LoginId: " + txtUserName.Text, 0); } if (AllowMultipleSession == false) { Hashtable sessions = (Hashtable)Application["WEB_SESSIONS_OBJECT"]; if (sessions == null) { sessions = new Hashtable(); } ////////getting the pointer to the Session of the current logged in user HttpSessionState existingUserSession = (HttpSessionState)sessions[Session["EmpolyeeID"].ToString()]; if (existingUserSession != null) { ////existingUserSession[Session["EmpolyeeID"].ToString()] = null; //logout current logged in user lblError1.Visible = true; } else { yourLoginMethod(UserInfo); ProceedToRedirectPage(UserInfo); } } else { yourLoginMethod(UserInfo); ProceedToRedirectPage(UserInfo); } } else { // For Teacher Redirection bool AllowMultipleSession = false; UserInfo = dtLogin.Tables[1]; if (UserInfo.Rows.Count > 0 && UserInfo != null) { Session["UserInfoTable"] = UserInfo; ViewState["AppUserType"] = "School"; ViewState["EmpolyeeID"] = int.Parse(UserInfo.Rows[0]["EmployeeID"].ToString()); ViewState["RoleID"] = int.Parse(UserInfo.Rows[0]["RoleID"].ToString()); ViewState["SchoolID"] = int.Parse(UserInfo.Rows[0]["SchoolID"].ToString()); ViewState["UserName"] = UserInfo.Rows[0]["FirstName"].ToString(); ViewState["SchoolName"] = UserInfo.Rows[0]["Name"].ToString(); ViewState["Role"] = UserInfo.Rows[0]["Role"].ToString(); AllowMultipleSession = Convert.ToBoolean(UserInfo.Rows[0]["AllowMultipleSession"].ToString()); TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmpolyeeID), Convert.ToInt16(AppSessions.DivisionID), "LoginPage", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.LoginSuccess), "LoginId: " + txtUserName.Text, 0); } if (AllowMultipleSession == false) { Hashtable sessions = (Hashtable)Application["WEB_SESSIONS_OBJECT"]; if (sessions == null) { sessions = new Hashtable(); } ////////getting the pointer to the Session of the current logged in user // HttpSessionState existingUserSession = (HttpSessionState)sessions[Session["EmpolyeeID"].ToString()]; HttpSessionState existingUserSession = (HttpSessionState)sessions[ViewState["EmpolyeeID"].ToString()]; if (existingUserSession != null) { ////existingUserSession[Session["EmpolyeeID"].ToString()] = null; //logout current logged in user lblError1.Visible = true; } else { yourLoginMethod(UserInfo); ProceedToRedirectPage(UserInfo); } } else { yourLoginMethod(UserInfo); ProceedToRedirectPage(UserInfo); } } } else { TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmpolyeeID), Convert.ToInt16(AppSessions.DivisionID), "LoginPage", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.LoginFailed), "LoginId: " + txtUserName.Text + " , Password: "******"Authentication Failed,unable to login"); } } } catch (Exception ex) { WebMsg.Show(ex.Message); } }
protected void btnGo_Click(object sender, EventArgs e) { try { if (uctxtUserName.Text == string.Empty || uctxtUserPassword.Text == string.Empty) { WebMsg.Show("Please enter User ID and Password"); } else { StoreCookie(); int status = CheckLogin(); //if (ddlUserType.SelectedValue == "0") if (status == 2) { //WebMsg.Show("invalid username or password"); uctxtUserName.Text = string.Empty; uctxtUserPassword.Text = string.Empty; ucinvalididpassword.Text = "Invalid User ID or Password"; //Page.ClientScript.RegisterStartupScript(GetType(), "msgbox", "alert('FiveDot File uploaded successfully'); ", true); //Response.Write("<script>alert('my message');</script> "); //ScriptManager.RegisterClientScriptBlock(ucbtnGo, this.GetType(), "Alert Message", "<script> alert('invalid username or password');</script>", true); return; } else if (status == 0) { // 0 Indicates Student StudentDash = new StudentDash(); BLogic_Student = new Student_DashBoard_BLogic(); DataSet dtLogin = new DataSet(); DataTable LoginInfo = new DataTable(); DataTable UserInfo = new DataTable(); obj_SYS_Role = new SYS_Role(); obj_BAL_SYS_Role = new SYS_Role_BLogic(); obj_SYS_Role.Username = uctxtUserName.Text; obj_SYS_Role.Password = uctxtUserPassword.Text; //obj_SYS_Role.roleid = Convert.ToInt16(DdlRole.SelectedValue); //if (uctxtEmail.Text != "" && uctxtpass.Text != "") //{ dtLogin = obj_BAL_SYS_Role.BAL_SYS_Student_Login(obj_SYS_Role); LoginInfo = dtLogin.Tables[0]; //} if (LoginInfo.Rows.Count > 0 && LoginInfo != null) { AppSessions.AppUserType = "Student"; AppSessions.StudentID = Convert.ToInt32(LoginInfo.Rows[0]["StudentID"].ToString()); AppSessions.UserName = LoginInfo.Rows[0]["FirstName"].ToString(); AppSessions.LoginID = LoginInfo.Rows[0]["LoginID"].ToString(); AppSessions.BMSID = Convert.ToInt32(LoginInfo.Rows[0]["BMSID"].ToString()); AppSessions.BMS = LoginInfo.Rows[0]["BMS"].ToString(); AppSessions.BoardID = Convert.ToInt32(LoginInfo.Rows[0]["BoardID"].ToString()); AppSessions.Board = LoginInfo.Rows[0]["Board"].ToString(); AppSessions.MediumID = Convert.ToInt32(LoginInfo.Rows[0]["MediumID"].ToString()); AppSessions.Medium = LoginInfo.Rows[0]["Medium"].ToString(); AppSessions.StandardID = Convert.ToInt32(LoginInfo.Rows[0]["StandardID"].ToString()); AppSessions.Standard = LoginInfo.Rows[0]["Standard"].ToString(); AppSessions.DivisionID = Convert.ToInt32(LoginInfo.Rows[0]["DivisionID"].ToString()); //AppSessions.Division = LoginInfo.Rows[0]["Division"].ToString(); AppSessions.SchoolID = Convert.ToInt32(LoginInfo.Rows[0]["SchoolID"].ToString()); //AppSessions.SchoolName = LoginInfo.Rows[0]["SchoolName"].ToString(); AppSessions.Role = LoginInfo.Rows[0]["Role"].ToString(); AppSessions.RoleID = Convert.ToInt32(LoginInfo.Rows[0]["RoleID"].ToString()); AppSessions.IsFreePackage = IsFreePackage(); //AppSessions.EmailID = Convert.ToString(LoginInfo.Rows[0]["EmailID"]); //yourLoginMethodStudent(LoginInfo); bool AllowMultipleSession = false; AllowMultipleSession = Convert.ToBoolean(LoginInfo.Rows[0]["AllowMultipleSession"].ToString()); //Hashtable sessions1 = (Hashtable)Application["WEB_SESSIONS_OBJECT"]; //HttpSessionState existingUserSession1 = (HttpSessionState)sessions1[Session["StudentID"].ToString()]; //if (existingUserSession1 != null) //{ // Response.Redirect("../Dashboard/StudentDashboard.aspx"); //} if (AllowMultipleSession == false) { Hashtable sessions = (Hashtable)Application["WEB_SESSIONS_OBJECT"]; if (sessions == null) { sessions = new Hashtable(); } HttpSessionState existingUserSession = (HttpSessionState)sessions[Session["StudentID"].ToString()]; if (existingUserSession != null) { ////existingUserSession[Session["EmpolyeeID"].ToString()] = null; //logout current logged in user Session["StudentID"] = null; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", "<script>alert('You are already Logged In.')</script>", false); return; } } ////////getting the pointer to the Session of the current logged in user yourLoginMethodStudent(LoginInfo); ProceedToRedirectPage(LoginInfo); bool AllowPayment = false; DataSet dsPaymentInfo = new DataSet(); dsPaymentInfo = BLogic_Student.BAL_Select_PaymentPagesInfo("Payment"); if (dsPaymentInfo != null & dsPaymentInfo.Tables.Count > 0) { if (dsPaymentInfo.Tables[0].Rows.Count > 0) { string a = dsPaymentInfo.Tables[0].Rows[0]["value"].ToString(); if (a == "0") { AllowPayment = false; } else { AllowPayment = true; } } } DataSet ds = new DataSet(); StudentDash.StudentID = AppSessions.StudentID; //ds = BLogic_Student.BAL_Validate_Student(StudentDash); ds = BLogic_Student.BAL_Validate_Student_Package(StudentDash); TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmployeeOrStudentID), Convert.ToInt16(AppSessions.DivisionID), "Login", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.LoginSuccess), "LoginId: " + uctxtUserName.Text, 0); if (AllowPayment == true) { //Session["ShowPaymentPages"] = "yes"; if (ds != null && dtLogin.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { Session["CheckValidity"] = "Yes"; ProceedToRedirect(); } else { Response.Redirect("~/DashBoard/SelectPackage.aspx", false); TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmployeeOrStudentID), Convert.ToInt16(AppSessions.DivisionID), "Login", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.PackageSelection), "LoginId: " + uctxtUserName.Text, 0); } } else { Response.Redirect("~/DashBoard/SelectPackage.aspx", false); TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmployeeOrStudentID), Convert.ToInt16(AppSessions.DivisionID), "Login", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.PackageSelection), "LoginId: " + uctxtUserName.Text, 0); } } else { Session["CheckValidity"] = "Yes"; Session["ShowPaymentPages"] = "No"; ProceedToRedirect(); } } } //else if (ddlUserType.SelectedValue == "1") else if (status == 1) { // 1 Indicates Teacher DataSet dtLogin = new DataSet(); DataTable LoginInfo = new DataTable(); DataTable UserInfo = new DataTable(); obj_SYS_Role = new SYS_Role(); obj_BAL_SYS_Role = new SYS_Role_BLogic(); obj_SYS_Role.Username = uctxtUserName.Text; obj_SYS_Role.Password = uctxtUserPassword.Text; //obj_SYS_Role.roleid = Convert.ToInt16(DdlRole.SelectedValue); dtLogin = obj_BAL_SYS_Role.BAL_SYS_Active_Login(obj_SYS_Role); LoginInfo = dtLogin.Tables[0]; if (LoginInfo.Rows.Count > 0 && LoginInfo != null && LoginInfo.Rows[0]["Status"].ToString().Equals("1")) { if (dtLogin.Tables[1].Rows[0]["RoleID"].ToString() != "3") { bool AllowMultipleSession = false; UserInfo = dtLogin.Tables[1]; if (UserInfo.Rows.Count > 0 && UserInfo != null) { AppSessions.AppUserType = "School"; AppSessions.EmpolyeeID = int.Parse(UserInfo.Rows[0]["EmployeeID"].ToString()); AppSessions.RoleID = int.Parse(UserInfo.Rows[0]["RoleID"].ToString()); AppSessions.SchoolID = int.Parse(UserInfo.Rows[0]["SchoolID"].ToString()); AppSessions.UserName = UserInfo.Rows[0]["FirstName"].ToString(); AppSessions.SchoolName = UserInfo.Rows[0]["Name"].ToString(); AppSessions.Role = UserInfo.Rows[0]["Role"].ToString(); AllowMultipleSession = Convert.ToBoolean(UserInfo.Rows[0]["AllowMultipleSession"].ToString()); TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmpolyeeID), Convert.ToInt16(AppSessions.DivisionID), "LoginPage", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.LoginSuccess), "LoginId: " + uctxtUserName.Text, 0); } if (AllowMultipleSession == false) { Hashtable sessions = (Hashtable)Application["WEB_SESSIONS_OBJECT"]; if (sessions == null) { sessions = new Hashtable(); } ////////getting the pointer to the Session of the current logged in user HttpSessionState existingUserSession = (HttpSessionState)sessions[Session["EmpolyeeID"].ToString()]; if (existingUserSession != null) { ////existingUserSession[Session["EmpolyeeID"].ToString()] = null; //logout current logged in user } else { yourLoginMethod(UserInfo); ProceedToRedirectPage(UserInfo); } } else { yourLoginMethod(UserInfo); ProceedToRedirectPage(UserInfo); } } else { // For Teacher Redirection bool AllowMultipleSession = false; UserInfo = dtLogin.Tables[1]; if (UserInfo.Rows.Count > 0 && UserInfo != null) { Session["UserInfoTable"] = UserInfo; ViewState["AppUserType"] = "School"; ViewState["EmpolyeeID"] = int.Parse(UserInfo.Rows[0]["EmployeeID"].ToString()); ViewState["RoleID"] = int.Parse(UserInfo.Rows[0]["RoleID"].ToString()); ViewState["SchoolID"] = int.Parse(UserInfo.Rows[0]["SchoolID"].ToString()); ViewState["UserName"] = UserInfo.Rows[0]["FirstName"].ToString(); ViewState["SchoolName"] = UserInfo.Rows[0]["Name"].ToString(); ViewState["Role"] = UserInfo.Rows[0]["Role"].ToString(); AllowMultipleSession = Convert.ToBoolean(UserInfo.Rows[0]["AllowMultipleSession"].ToString()); TrackLog_Utils.Log(Convert.ToInt32(ViewState["SchoolID"]), Convert.ToInt32(ViewState["EmpolyeeID"]), Convert.ToInt16(AppSessions.DivisionID), "LoginMasterPage.master", "ucbtnGo", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.LoginSuccess), ViewState["UserName"] + " (" + uctxtUserName.Text + ") From " + ViewState["SchoolName"] + " school Logged in.", 0); } if (AllowMultipleSession == false) { Hashtable sessions = (Hashtable)Application["WEB_SESSIONS_OBJECT"]; if (sessions == null) { sessions = new Hashtable(); } ////////getting the pointer to the Session of the current logged in user // HttpSessionState existingUserSession = (HttpSessionState)sessions[Session["EmpolyeeID"].ToString()]; HttpSessionState existingUserSession = (HttpSessionState)sessions[ViewState["EmpolyeeID"].ToString()]; if (existingUserSession != null) { WebMsg.Show("This user is already logged in"); } else { yourLoginMethod(UserInfo); ProceedToRedirectPage(UserInfo); } } else { yourLoginMethod(UserInfo); ProceedToRedirectPage(UserInfo); } } } else { TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmpolyeeID), Convert.ToInt16(AppSessions.DivisionID), "LoginPage", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.LoginFailed), "LoginId: " + uctxtUserName.Text + " , Password: "******"Authentication Failed,unable to login"); } } uctxtUserName.Text = string.Empty; uctxtUserPassword.Text = string.Empty; } } catch (Exception ex) { WebMsg.Show(ex.Message); } }