UU跑腿标准版

firstlogin.aspx.cs 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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
  9. {
  10. public partial class firstlogin : 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 userId = Request.QueryString["ResetPass"];
  19. initistration(userId);//初始化方法
  20. }
  21. }
  22. }
  23. /// <summary>
  24. /// 初始化重新设置密码的信息
  25. /// </summary>
  26. /// <param name="resetPassWord"></param>
  27. public void initistration(string userId)
  28. {
  29. string sql = "";
  30. if (!string.IsNullOrEmpty(userId))
  31. {
  32. sql = "select * from t_sys_userAccount where F_UserId ='" + userId + "'";
  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. if (password == password1)
  56. {
  57. if (tsua[0].F_UserCode == password)
  58. {
  59. MessageBoxToWindow("重设密码失败:帐号和密码不允许相同", "提示!", "error");
  60. }
  61. else
  62. {
  63. tsua[0].F_Password = password;
  64. bool b = new BLL.T_Sys_UserAccount().Update(tsua[0]);
  65. if (b) MessageBoxToWindow("重设密码成功:请重新登录", "提示!", "success");
  66. }
  67. }
  68. else
  69. {
  70. MessageBoxToWindow("重设密码失败:新密码输入不一致", "提示!", "error");
  71. }
  72. }
  73. else
  74. {
  75. MessageBoxToWindow("数据异常:存在相同工号和姓名的人员", "提示!", "catch");
  76. }
  77. }
  78. #region 弹出对话框
  79. /// <summary>
  80. /// 弹出对话框
  81. /// </summary>
  82. /// <param name="title"></param>
  83. /// <param name="content"></param>
  84. /// <param name="type"></param>
  85. public void MessageBoxToWindow(string title, string content, string type)
  86. {
  87. string script = "";
  88. switch (type)
  89. {
  90. case "error"://失败
  91. type = "error";
  92. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  93. break;
  94. case "success"://成功
  95. type = "info";
  96. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "',CloseThis);</script>";
  97. break;
  98. case "catch"://异常
  99. type = "warning";
  100. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  101. break;
  102. default:
  103. type = "question";
  104. break;
  105. }
  106. ClientScript.RegisterClientScriptBlock(this.GetType(), "", script);
  107. }
  108. #endregion
  109. }
  110. }