UU跑腿标准版

usermodify.aspx.cs 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. using HySoft.Common;
  9. namespace HySoft.BaseCallCenter.Web.sysmanage
  10. {
  11. public partial class usermodify : System.Web.UI.Page
  12. {
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15. if (!IsPostBack)
  16. {
  17. if (Request.QueryString["actionFlag"].ToString() == "edit")
  18. {
  19. getOrderInformerEdit(Request.QueryString["singleFlage"].ToString());
  20. }
  21. }
  22. }
  23. /// <summary>
  24. /// 初始化信息
  25. /// </summary>
  26. private void getOrderInformerEdit(string Flage)
  27. {
  28. DataTable dt = new DataTable();
  29. DataTable dtItems = new DataTable();
  30. string sql = "select * from T_Sys_UserAccount where F_UserId=" + Flage + "";
  31. dt = DBUtility.DbHelperSQL.Query(sql).Tables[0];
  32. if (dt.Rows.Count > 0)
  33. {
  34. F_UserName.Text = dt.Rows[0]["F_UserName"].ToString();
  35. hfbirthday.Value = dt.Rows[0]["F_Password"].ToString();
  36. F_UserCode.Text = dt.Rows[0]["F_UserCode"].ToString();
  37. hfRoleText.Value = dt.Rows[0]["F_RoleId"].ToString();
  38. hfDeptText.Value = dt.Rows[0]["F_DeptId"].ToString();
  39. if (dt.Rows[0]["F_SeatFlag"].ToString() == "True")
  40. {
  41. hdradiolist.Value = "1";
  42. }
  43. else
  44. {
  45. hdradiolist.Value = "0";
  46. }
  47. hfzuoxiquanxian.Value = dt.Rows[0]["F_SeatRight"].ToString();
  48. hfzuoxileixing.Value = dt.Rows[0]["F_HJType"].ToString();
  49. if (dt.Rows[0]["F_SexFlag"].ToString() == "男")
  50. {
  51. hfxinbie.Value = "1";
  52. }
  53. else
  54. {
  55. hfxinbie.Value = "0";
  56. }
  57. hfF_GroupId.Value = dt.Rows[0]["F_GroupId"].ToString();
  58. txtExtNo.Text = dt.Rows[0]["F_ExtensionNumber"].ToString();
  59. txtWorkNumber.Text = dt.Rows[0]["F_WorkNumber"].ToString();
  60. txtBirthday.Text = dt.Rows[0]["F_Birthday"].ToString();
  61. txtTelphone.Text = dt.Rows[0]["F_Telephone"].ToString();
  62. txtMobel.Text = dt.Rows[0]["F_Mobile"].ToString();
  63. txtRemark.Text = dt.Rows[0]["F_Remark"].ToString();
  64. }
  65. }
  66. /// <summary>
  67. /// 保存用户方法
  68. /// </summary>
  69. /// <param name="sender"></param>
  70. /// <param name="e"></param>
  71. protected void btnSubmit_Click(object sender, EventArgs e)
  72. {
  73. try
  74. {
  75. string struserId = Request.QueryString["singleFlage"].ToString();
  76. int userId = 0;
  77. HySoft.BaseCallCenter.Model.T_Sys_UserAccount userAccountModel = new Model.T_Sys_UserAccount();
  78. if (int.TryParse(struserId, out userId))
  79. userAccountModel = new BLL.T_Sys_UserAccount().GetModel(userId);
  80. HySoft.BaseCallCenter.BLL.T_Sys_UserAccount sysUserAccountBll = new BLL.T_Sys_UserAccount();
  81. userAccountModel.F_UserCode = F_UserCode.Text.Trim();
  82. userAccountModel.F_UserName = F_UserName.Text.Trim();
  83. userAccountModel.F_Password = hfbirthday.Value;
  84. userAccountModel.F_ExtensionNumber = txtExtNo.Text.Trim();
  85. userAccountModel.F_WorkNumber = txtWorkNumber.Text.Trim();
  86. userAccountModel.F_DeptId = Convert.ToInt32(hfDeptText.Value);
  87. userAccountModel.F_RoleId = Convert.ToInt32(hfRoleText.Value);
  88. if (hfF_GroupId.Value != "")
  89. {
  90. userAccountModel.F_GroupId = Convert.ToInt32(hfF_GroupId.Value);
  91. }
  92. if (hdradiolist.Value == "0")
  93. {
  94. userAccountModel.F_SeatFlag = false;
  95. }
  96. if (hdradiolist.Value == "1")
  97. {
  98. userAccountModel.F_SeatFlag = true;
  99. }
  100. userAccountModel.F_SeatRight = hfzuoxiquanxian.Value;
  101. if (hfxinbie.Value == "1")
  102. {
  103. userAccountModel.F_SexFlag = "男";
  104. }
  105. else
  106. {
  107. userAccountModel.F_SexFlag = "女";
  108. }
  109. userAccountModel.F_Remark = txtRemark.Text;
  110. userAccountModel.F_Mobile = txtMobel.Text;
  111. userAccountModel.F_Telephone = txtTelphone.Text;
  112. DateTime dttime = new DateTime();
  113. bool b = DateTime.TryParse(txtBirthday.Text, out dttime);
  114. if (b)
  115. userAccountModel.F_Birthday = Convert.ToDateTime(txtBirthday.Text);
  116. userAccountModel.F_CreateOn = DateTime.Now;
  117. userAccountModel.F_DeleteFlag = 0;
  118. userAccountModel.F_HJType = Convert.ToInt32(hfzuoxileixing.Value);
  119. if (Request.QueryString["actionFlag"].Trim() == "edit")
  120. {
  121. DataTable dt = sysUserAccountBll.GetList("F_UserCode='" + F_UserCode.Text.Trim() + "' and F_UserId!=" + Request.QueryString["singleFlage"] + "").Tables[0];
  122. if (dt.Rows.Count > 0)
  123. {
  124. MessageBoxToWindow("当前员工工号存在,请更换!", "提示", "error");
  125. }
  126. else
  127. {
  128. userAccountModel.F_UserId = Convert.ToInt32(Request.QueryString["singleFlage"]);
  129. if (sysUserAccountBll.Update(userAccountModel))
  130. {
  131. MessageBoxToWindow("修改成功", "修改提示!", "success");
  132. }
  133. else
  134. {
  135. MessageBoxToWindow("修改失败", "修改提示!", "error");
  136. }
  137. }
  138. }
  139. }
  140. catch (Exception ex)
  141. {
  142. SysLog.WriteLog(ex);
  143. MessageBoxToWindow("异常提示!" + ex.Message, "提示", "catch");
  144. }
  145. }
  146. #region 弹出对话框
  147. /// <summary>
  148. /// 弹出对话框
  149. /// </summary>
  150. /// <param name="title"></param>
  151. /// <param name="content"></param>
  152. /// <param name="type"></param>
  153. public void MessageBoxToWindow(string title, string content, string type)
  154. {
  155. string script = "";
  156. switch (type)
  157. {
  158. case "error"://失败
  159. type = "error";
  160. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  161. break;
  162. case "success"://成功
  163. type = "info";
  164. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "',CloseThis);</script>";
  165. break;
  166. case "catch"://异常
  167. type = "warning";
  168. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  169. break;
  170. default:
  171. type = "question";
  172. break;
  173. }
  174. ClientScript.RegisterClientScriptBlock(this.GetType(), "", script);
  175. }
  176. #endregion
  177. }
  178. }