protected void btnLogin_Click(object sender, EventArgs e) { IBusinessAbstraction iba = GenericFactory <BusinessAbstraction, IBusinessAbstraction> .CreateInstance(); try { string chkAcctNum = iba.IsValidUser(Utils.StripPunctuation(txtUsername.Text), Utils.StripPunctuation(txtPassword.Text)); if (chkAcctNum != "") { lblStatus.Text = "Welcome User"; SessionFacade.USERNAME = txtUsername.Text; SessionFacade.CHECKINGACCTNUM = chkAcctNum; if (SessionFacade.PAGEREQUESTED != null) { Response.Redirect(SessionFacade.PAGEREQUESTED); } } else { lblStatus.Text = "Invalid User.."; } } catch (Exception ex) { lblStatus.Text = ex.Message; } }
protected void btnChangePwd_Click(object sender, EventArgs e) { IBusinessAbstraction iba = GenericFactory <BusinessAbstraction, IBusinessAbstraction> .CreateInstance(); try { string oldPwd = Utils.StripPunctuation(txtOldPwd.Text); string newPwd = Utils.StripPunctuation(txtNewPwd.Text); string rePwd = Utils.StripPunctuation(txtRetypePwd.Text); if (rePwd.Equals(newPwd)) { string userName = Utils.StripPunctuation(SessionFacade.USERNAME); string chkAcctNum = iba.IsValidUser(userName, oldPwd); if (chkAcctNum != "") { if (iba.ChangePassword(userName, oldPwd, newPwd)) { lblStatus.Text = "Password updated successfully!"; } else { lblStatus.Text = "Couldn't change password!!!"; } } else { lblStatus.Text = "Invalid old password ..."; } } else { lblStatus.Text = "Password mismatch ..."; } } catch (Exception ex) { lblStatus.Text = ex.Message; } }