You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.8 KiB

  1. using Swift.DAL.BL.System.UserManagement;
  2. using Swift.DAL.SwiftDAL;
  3. using Swift.web.Library;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Web;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. namespace Swift.web.SwiftSystem.UserManagement.AgentUserSetup
  11. {
  12. public partial class ChangePassword : System.Web.UI.Page
  13. {
  14. private readonly ApplicationUserDao _obj = new ApplicationUserDao();
  15. private readonly SwiftLibrary _sl = new SwiftLibrary();
  16. protected void Page_Load(object sender, EventArgs e)
  17. {
  18. Authenticate();
  19. PopulateUserName();
  20. if (!IsPostBack)
  21. {
  22. }
  23. }
  24. private void Authenticate()
  25. {
  26. _sl.CheckSession();
  27. }
  28. private void ManageMessage2(DbResult dbResult)
  29. {
  30. GetStatic.SetMessage(dbResult);
  31. if (dbResult.ErrorCode == "0")
  32. {
  33. GetStatic.PrintMessage(Page);
  34. }
  35. else
  36. {
  37. GetStatic.AlertMessage(Page);
  38. }
  39. }
  40. protected void PopulateUserName()
  41. {
  42. userName.Text = GetStatic.GetUser();
  43. }
  44. private void Update()
  45. {
  46. DbResult dbResult = _obj.ChangePassword(userName.Text, pwd.Text, oldPwd.Text);
  47. ManageMessage2(dbResult);
  48. if (dbResult.ErrorCode == "0")
  49. {
  50. Response.Redirect("~/Agent/Dashboard2.aspx");
  51. }
  52. }
  53. protected void btnOk_Click(object sender, EventArgs e)
  54. {
  55. if (pwd.Text != confirmPwd.Text)
  56. {
  57. msg.Text = "Confirm Password Doesn't Match";
  58. return;
  59. }
  60. else
  61. {
  62. Update();
  63. }
  64. }
  65. }
  66. }