protected void Userlist_SelectedIndexChanged(object sender, EventArgs e) { _otpService = new OTPService(Session["UserId"].ToString() + Session["UserName"].ToString()); generatedotp = _otpService.GenerateOTP(Session["UserName"].ToString(), email: Session["UserEmail"].ToString(), notifyByEmail:false); const string subject = "Your OTP from the most secure bank, SBS, ever."; string body = string.Format("Hello {0}, <br /> <br />Your <b>OTP</b> from the most secure bank: <br /> {1} <br /><br /> Regards, <br /> SBS Team.", "", generatedotp); OTPUtility.SendMail("Group 2", "*****@*****.**", "Government", "*****@*****.**", subject, body); OTPDiv.Visible = true; }
//private static String userId = "1234"; protected void SendOTPBtn_Click(object sender, EventArgs e) { try { string[] arglist = new String[2]; Business.XSwitch xsw = new Business.XSwitch(); if (!UI.Validate.isUserNameValid(UserNameTextBox.Text)) { MessageLabel.Text = "Error: The User Name that was entered was not found."; return; } var employeeOutput = new Entity.Empm(); var output = xsw.getExternalUserDataFromUserName(Global.ConnectionString, UserNameTextBox.Text); if (output == null) { employeeOutput = xsw.getInternalUserDataFromUserName(Global.ConnectionString, UserNameTextBox.Text); if (employeeOutput == null) { MessageLabel.Text = "Error: The User Name that was entered was not found."; return; } } if (output != null) { Session["TempUserId"] = output.cs_no; String userName = output.cs_fname + " " + output.cs_lname; _otpService = new OTPService(output.cs_uid + userName); _otpService.GenerateOTP(userName, email: output.cs_email); } else if (employeeOutput != null) { Session["TempUserId"] = employeeOutput.emp_no; String userName = employeeOutput.emp_fname + " " + employeeOutput.emp_lname; _otpService = new OTPService(employeeOutput.emp_no + userName); _otpService.GenerateOTP(userName, email: employeeOutput.emp_email); } } catch { } }
protected void ResendOTPLink_Click(object sender, EventArgs e) { var amount = Convert.ToDecimal(Amount.Text); var xsw = new Business.XSwitch(); var customer = new Entity.Cstm(); customer = xsw.getExternalUserDataFromUserName(Global.ConnectionString, CustomerDropDown.SelectedValue.ToString()); var customeremail = customer.cs_email; var customername = customer.cs_fname + " " + customer.cs_lname; _otpService = new OTPService(Session["UserId"].ToString() + Session["UserName"].ToString()); generatedotp = _otpService.GenerateOTP(Session["UserName"].ToString(), email: Session["UserEmail"].ToString(), notifyByEmail: false); const string subject = "Your OTP from the most secure bank, SBS, "; string body = string.Format("Hello {0}, <br /> <br />Your <b>OTP</b> from the most secure bank: <br /> {1} <br /><br /> Regards, <br /> SBS Team.", "", generatedotp); OTPUtility.SendMail("Group 2", "*****@*****.**", customername, customeremail, subject, body); }
protected void MakePayment_Click(object sender, EventArgs e) { try { if (Session["Access"].ToString() == "2") { if (FromDropdown.SelectedValue == "0") { Master.ErrorMessage = "Error: Select the Account from which an amount has to be Debited"; } if (ToDropdown.SelectedValue == "0") { Master.ErrorMessage = "Error: Select the Account to which the amount has to be Debited"; } else if (Amount.Text == "" || !UI.Validate.isAmountValid(Amount.Text)) { Master.ErrorMessage = "Error: Amount cannot be empty, and amount accepts only decimal values."; } else { var amount = Convert.ToDecimal(Amount.Text); var xsw = new Business.XSwitch(); var customer = new Entity.Cstm(); customer = xsw.getExternalUserDataFromUserName(Global.ConnectionString, CustomerDropDown.SelectedValue.ToString()); var customeremail = customer.cs_email; var customername = customer.cs_fname + " " + customer.cs_lname; _otpService = new OTPService(Session["UserId"].ToString() + Session["UserName"].ToString()); generatedotp = _otpService.GenerateOTP(Session["UserName"].ToString(), email: Session["UserEmail"].ToString(), notifyByEmail: false); const string subject = "Your OTP from the most secure bank, SBS, "; string body = string.Format("Hello {0}, <br /> <br />Your <b>OTP</b> from the most secure bank: <br /> {1} <br /><br /> Regards, <br /> SBS Team.", "", generatedotp); OTPUtility.SendMail("Group 2", "*****@*****.**", customername, customeremail, subject, body); OTPDiv.Visible = true; MakePaymentButton.Visible = false; } } else { } } catch { } }
protected void DebitButton_Click(object sender, EventArgs e) { try { if (Session["Access"].ToString() == "1" || Session["Access"].ToString() == "2") { if (FromDropdown.SelectedValue == "0") { Master.ErrorMessage = "Error: Select the Account from which an amount has to be Debited"; } else if (Amount.Text == "" || !UI.Validate.isAmountValid(Amount.Text)) { Master.ErrorMessage = "Error: Amount cannot be empty, and amount accepts only decimal values."; } else { var amount = Convert.ToDecimal(Amount.Text); if (amount > 1000) { _otpService = new OTPService(Session["UserId"].ToString() + Session["UserName"].ToString()); _otpService.GenerateOTP(Session["UserName"].ToString(), email: Session["UserEmail"].ToString()); //show otp DebitButton.Visible = false; OTPDiv.Visible = true; VirtualCheckBoxArea.Style.Remove("display"); VirtualCheckBoxArea.Style.Add("display", "block"); } else { ProcessTransaction(amount); } } } else { var amount = Convert.ToDecimal(Amount.Text); ProcessTransaction(amount); } } catch { } }
protected void ChangePwdBtn_Click(object sender, EventArgs e) { try { if (!_otpService.VerifyOTP(OTPTextBox.Text.Trim())) { MessageLabel.Text = "Error: Could not verify the OTP that you entered."; return; } if (!UI.Validate.isPasswordValid(pwdTextBox.Text) || hashPwdHiddenField.Value.Equals("0") || !hashPwdHiddenField.Value.Equals(hashCpwdHiddenField.Value)) { MessageLabel.Text = "Error: Invalid Password Entered, or passwords do not match."; return; } string[] arglist = new String[3]; int argIndex = 0; arglist[argIndex++] = Mnemonics.TxnCodes.TX_FORGET_PASSWORD; arglist[argIndex++] = Session["TempUserId"].ToString(); arglist[argIndex++] = hashPwdHiddenField.Value; var output = new Business.XSwitch(Global.ConnectionString, Session["TempUserId"].ToString(), string.Format("{0}|{1}|{2}", arglist)); MessageLabel.Text = "Password changed successfully."; _otpService = null; System.Threading.Thread.Sleep(2000); } catch { } MessageLabel.Text = ""; Response.Redirect("UserLogin.aspx"); }