UU跑腿标准版

ResetPassword.aspx.cs 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using System.Data;
  8. namespace HySoft.BaseCallCenter.Web.sysmanage
  9. {
  10. public partial class ResetPassword : System.Web.UI.Page
  11. {
  12. protected void Page_Load(object sender, EventArgs e)
  13. {
  14. if (!IsPostBack)
  15. {
  16. if (Request.QueryString["ResetPass"] != null)
  17. {
  18. string resetPassId = Request.QueryString["ResetPass"];
  19. initistration(resetPassId);//初始化方法
  20. }
  21. }
  22. }
  23. /// <summary>
  24. /// 初始化重新设置密码的信息
  25. /// </summary>
  26. /// <param name="resetPassWord"></param>
  27. public void initistration(string resetPassWord)
  28. {
  29. string sql = "";
  30. if (!string.IsNullOrEmpty(resetPassWord))
  31. {
  32. sql = "select * from t_sys_userAccount where F_UserId ='" + resetPassWord + "'";
  33. }
  34. DataTable dt = DBUtility.DbHelperSQL.Query(sql).Tables[0];
  35. if (dt.Rows.Count > 0)
  36. {
  37. txtWorkingCode.Text = dt.Rows[0]["F_UserCode"].ToString();
  38. txtRealName.Text = dt.Rows[0]["F_UserName"].ToString();
  39. }
  40. }
  41. protected void btnSubmit_Click(object sender, EventArgs e)
  42. {
  43. string usercode = txtWorkingCode.Text.Trim();
  44. string username = txtRealName.Text.Trim();
  45. string password = txtone_password.Text.Trim();
  46. string password1 = txtone_password1.Text.Trim();
  47. string sql = string.Format("F_UserCode='{0}' and F_UserName='{1}'", usercode, username);
  48. List<Model.T_Sys_UserAccount> tsua = new BLL.T_Sys_UserAccount().GetModelList(sql);
  49. if (tsua.Count <= 0)
  50. {
  51. MessageBoxToWindow("重设密码失败:工号和姓名不匹配", "提示!", "error");
  52. }
  53. else if (tsua.Count == 1)
  54. {
  55. string userId = HySoft.Common.CookieUtil.GetCookie("BaseCallCenter_T_User", "F_UserID");
  56. if (userId != null && !string.IsNullOrWhiteSpace(userId))
  57. {
  58. int ID = 0;
  59. int.TryParse(userId, out ID);
  60. if (ID > 0)
  61. {
  62. Model.T_Sys_UserAccount user = new BLL.T_Sys_UserAccount().GetModel(ID);
  63. if (user != null)
  64. {
  65. if (user.F_RoleId == 17)
  66. {
  67. if (password == password1)
  68. {
  69. tsua[0].F_Password = password;
  70. bool b = new BLL.T_Sys_UserAccount().Update(tsua[0]);
  71. if (b) MessageBoxToWindow("重设密码成功", "提示!", "success");
  72. }
  73. else
  74. {
  75. MessageBoxToWindow("重设密码失败:新密码输入不一致", "提示!", "error");
  76. }
  77. }
  78. else
  79. {
  80. MessageBoxToWindow("重设密码失败:权限不足", "提示!", "error");
  81. }
  82. }
  83. }
  84. }
  85. }
  86. else
  87. {
  88. MessageBoxToWindow("数据异常:存在相同工号和姓名的人员", "提示!", "catch");
  89. }
  90. }
  91. #region 弹出对话框
  92. /// <summary>
  93. /// 弹出对话框
  94. /// </summary>
  95. /// <param name="title"></param>
  96. /// <param name="content"></param>
  97. /// <param name="type"></param>
  98. public void MessageBoxToWindow(string title, string content, string type)
  99. {
  100. string script = "";
  101. switch (type)
  102. {
  103. case "error"://失败
  104. type = "error";
  105. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  106. break;
  107. case "success"://成功
  108. type = "info";
  109. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "',CloseThis);</script>";
  110. break;
  111. case "catch"://异常
  112. type = "warning";
  113. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  114. break;
  115. default:
  116. type = "question";
  117. break;
  118. }
  119. ClientScript.RegisterClientScriptBlock(this.GetType(), "", script);
  120. }
  121. #endregion
  122. }
  123. }