UU跑腿标准版

userResetPasswod.aspx.cs 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 userResetPasswod : System.Web.UI.Page
  11. {
  12. string resetPassId = "";
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15. if (!IsPostBack)
  16. {
  17. resetPassId = Request.QueryString["ResetPass"];
  18. initistration(resetPassId);//初始化方法
  19. }
  20. }
  21. #region
  22. /// <summary>
  23. /// 初始化重新设置密码的信息
  24. /// </summary>
  25. /// <param name="resetPassWord"></param>
  26. public void initistration(string resetPassWord)
  27. {
  28. string sql = "";
  29. string userId = HySoft.Common.CookieUtil.GetCookie("BaseCallCenter_T_User", "F_UserID");
  30. if (!string.IsNullOrEmpty(resetPassWord))
  31. {
  32. sql = "select * from t_sys_userAccount where F_UserId ='" + resetPassWord + "'";
  33. }
  34. else
  35. {
  36. sql = "select * from t_sys_userAccount where F_UserId ='" + userId + "'";
  37. }
  38. DataTable dt = DBUtility.DbHelperSQL.Query(sql).Tables[0];
  39. if (dt.Rows.Count > 0)
  40. {
  41. txtWorkingCode.Text = dt.Rows[0]["F_UserCode"].ToString();
  42. txtRealName.Text = dt.Rows[0]["F_UserName"].ToString();
  43. }
  44. }
  45. #endregion
  46. protected void btnSubmit_Click(object sender, EventArgs e)
  47. {
  48. try
  49. {
  50. string sql = "";
  51. string sqlstr = "";
  52. int reslust = 0;
  53. if (!string.IsNullOrEmpty(txtone_password.Text))
  54. {
  55. string userId = HySoft.Common.CookieUtil.GetCookie("BaseCallCenter_T_User", "F_UserID");
  56. //根据用户id和原密码确定用户是否存在
  57. if (!string.IsNullOrEmpty(Request.QueryString["ResetPass"]))
  58. {
  59. sqlstr = "select * from t_sys_userAccount where F_Password='" + txtone_password.Text + "' and F_UserId='" + Request.QueryString["ResetPass"] + "'";
  60. }
  61. else
  62. {
  63. sqlstr = "select * from t_sys_userAccount where F_Password='" + txtone_password.Text + "' and F_UserId='" + userId + "'";
  64. }
  65. DataTable dt = DBUtility.DbHelperSQL.Query(sqlstr).Tables[0];
  66. if (dt.Rows.Count > 0)
  67. {
  68. if (!string.IsNullOrEmpty(Request.QueryString["ResetPass"]))
  69. {
  70. sql = "update t_sys_userAccount set F_Password='" + txtone_passwodnew.Text + "' where F_UserId ='" + Request.QueryString["ResetPass"] + "'";
  71. }
  72. else
  73. {
  74. sql = "update t_sys_userAccount set F_Password='" + txtone_passwodnew.Text + "' where F_UserId='" + userId + "'";
  75. }
  76. reslust = DBUtility.DbHelperSQL.ExecuteSql(sql);
  77. if (reslust > 0)
  78. {
  79. MessageBoxToWindow("重设密码成功", "提示!", "success");
  80. }
  81. else
  82. {
  83. MessageBoxToWindow("重设密码失败", "提示!", "error");
  84. }
  85. }
  86. else
  87. {
  88. MessageBoxToWindow("没有找到输入原密码的人员", "提示!", "error");
  89. }
  90. }
  91. }
  92. catch (Exception ex)
  93. {
  94. }
  95. }
  96. #region 弹出对话框
  97. /// <summary>
  98. /// 弹出对话框
  99. /// </summary>
  100. /// <param name="title"></param>
  101. /// <param name="content"></param>
  102. /// <param name="type"></param>
  103. public void MessageBoxToWindow(string title, string content, string type)
  104. {
  105. string script = "";
  106. switch (type)
  107. {
  108. case "error"://失败
  109. type = "error";
  110. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  111. break;
  112. case "success"://成功
  113. type = "info";
  114. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "',CloseThis);</script>";
  115. break;
  116. case "catch"://异常
  117. type = "warning";
  118. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  119. break;
  120. default:
  121. type = "question";
  122. break;
  123. }
  124. ClientScript.RegisterClientScriptBlock(this.GetType(), "", script);
  125. }
  126. #endregion
  127. }
  128. }