protected void LoginButton_Click(object sender, EventArgs e) { try { DTOLogin tologin = new DTOLogin(); tologin.UserID = UserName.Text; tologin.Password = PasswordEncDec.EncodePasswordToBase64(Password.Text); bool authenticated = new BOLogin().CheckAdminUser(tologin); if (authenticated) { Session["UserName"] = UserName.Text; Response.Redirect("AdminDefault.aspx"); } else { FailureText.Text = "Username or Password is incorrect."; } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
protected void btnChangePassword_Click(object sender, EventArgs e) { DTOLogin tologin = new DTOLogin(); tologin.UserID = Session["UserName"].ToString(); tologin.Password = PasswordEncDec.EncodePasswordToBase64(txtCurrentPassword.Text); bool isCurrentPasswordCorrect = new BOLogin().CheckInstituteUser(tologin); if (isCurrentPasswordCorrect) { tologin.Password = PasswordEncDec.EncodePasswordToBase64(txtNewPassword.Text); if (new BOLogin().ChangeInstituteUserPassword(tologin)) { //string script = @"document.getElementById('" + divStatus.ClientID + "').innerHTML='Password changed successfully';var elem = document.createElement('img');elem.setAttribute('src', 'tick.jpg');document.getElementById('" + divStatus.ClientID + "').appendChild(elem);document.getElementById('" + divStatus.ClientID + "').style.color = 'Green';document.getElementById('" + divStatus.ClientID + "').style.fontSize = '1em' ;document.getElementById('" + divStatus.ClientID + "').style.fontWeight = 'bold' ;setTimeout(function(){document.getElementById('" + divStatus.ClientID + "').style.display='none';},4500);"; //ScriptManager.RegisterStartupScript(this, this.GetType(), "script", script, true); string alertScript = "jAlert('Password Changed Successfully', 'Campus2Caretaker');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alertScript", alertScript, true); Clear(); Session.Abandon(); Response.Redirect("InstituteLogin.aspx"); } else { //string script = @"document.getElementById('" + divStatus.ClientID + "').innerHTML='Error';var elem = document.createElement('img');elem.setAttribute('src', 'cross.jpg');document.getElementById('" + divStatus.ClientID + "').appendChild(elem);document.getElementById('" + divStatus.ClientID + "').style.color = 'Red';document.getElementById('" + divStatus.ClientID + "').style.fontSize = '1em' ;document.getElementById('" + divStatus.ClientID + "').style.fontWeight = 'bold' ;setTimeout(function(){document.getElementById('" + divStatus.ClientID + "').style.display='none';},4500);"; //ScriptManager.RegisterStartupScript(this, this.GetType(), "script", script, true); string alertScript = "jAlert('Error', 'Campus2Caretaker');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alertScript", alertScript, true); } } else { //string script = @"document.getElementById('" + divStatus.ClientID + "').innerHTML='Please enter the valid current password.';var elem = document.createElement('img');elem.setAttribute('src', 'cross.jpg');document.getElementById('" + divStatus.ClientID + "').appendChild(elem);document.getElementById('" + divStatus.ClientID + "').style.color = 'Red';document.getElementById('" + divStatus.ClientID + "').style.fontSize = '1em' ;document.getElementById('" + divStatus.ClientID + "').style.fontWeight = 'bold' ;setTimeout(function(){document.getElementById('" + divStatus.ClientID + "').style.display='none';},4500);"; //ScriptManager.RegisterStartupScript(this, this.GetType(), "script", script, true); string alertScript = "jAlert('Please Enter Valid Current Password', 'Campus2Caretaker');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alertScript", alertScript, true); } }
protected void LoginButton_Click(object sender, EventArgs e) { try { DTOLogin tologin = new DTOLogin(); tologin.UserID = UserName.Text; tologin.Password = PasswordEncDec.EncodePasswordToBase64(Password.Text); bool authenticated = new BOLogin().CheckInstituteUser(tologin); if (authenticated) { Session["InstituteID"] = new BOInstituteDetails().GetInstituteId(UserName.Text); Session["UserName"] = UserName.Text; DTOInstituteDetails toins = new DTOInstituteDetails(); toins.InstituteEmail = Session["UserName"].ToString(); toins.InstituteID = int.Parse(Session["InstituteID"].ToString()); DataTable dt = new BOInstituteDetails().GetInstituteDetails(toins); Session["LogoPath"] = dt.Rows[0][3].ToString(); Session["InstituteName"] = dt.Rows[0][0].ToString(); Session["InstituteType"] = dt.Rows[0][6].ToString(); Session["MaxStudentsInstitute"] = dt.Rows[0][10].ToString(); Response.Redirect("InstituteDefault.aspx"); } else { FailureText.Text = "Username or Password is incorrect."; } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public bool CheckParentsMobileNumber(DTOLogin tologin) { return new DAOLogin().CheckParentsMobileNumber(tologin); }
public bool ChangeInstituteUserPassword(DTOLogin tologin) { return new DAOLogin().ChangeInstituteUserPassword(tologin); }
public bool CheckInstituteUser(DTOLogin tologin) { return new DAOLogin().CheckInstituteUser(tologin); }
public bool CheckAdminUser(DTOLogin tologin) { return new DAOLogin().CheckAdminUser(tologin); }