鹤壁电销版 自用

useredit.aspx.cs 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 useredit : System.Web.UI.Page
  12. {
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15. }
  16. /// <summary>
  17. /// 保存用户方法
  18. /// </summary>
  19. /// <param name="sender"></param>
  20. /// <param name="e"></param>
  21. protected void btnSubmit_Click(object sender, EventArgs e)
  22. {
  23. try
  24. {
  25. HySoft.BaseCallCenter.Model.T_Sys_UserAccount userAccountModel = new Model.T_Sys_UserAccount();
  26. HySoft.BaseCallCenter.BLL.T_Sys_UserAccount sysUserAccountBll = new BLL.T_Sys_UserAccount();
  27. userAccountModel.F_UserCode = F_UserCode.Text.Trim();
  28. userAccountModel.F_UserName = F_UserName.Text.Trim();
  29. userAccountModel.F_Password = F_Password.Text.Trim();
  30. userAccountModel.F_ExtensionNumber = txtExtNo.Text.Trim();
  31. userAccountModel.F_WorkNumber = txtWorkNumber.Text.Trim();
  32. userAccountModel.F_DeptId = Convert.ToInt32(hfDeptText.Value);
  33. userAccountModel.F_RoleId = Convert.ToInt32(hfRoleText.Value);
  34. if (hfF_GroupId.Value != "")
  35. {
  36. userAccountModel.F_GroupId = Convert.ToInt32(hfF_GroupId.Value);
  37. }
  38. if (hdradiolist.Value == "0")
  39. {
  40. userAccountModel.F_SeatFlag = false;
  41. }
  42. if (hdradiolist.Value == "1")
  43. {
  44. userAccountModel.F_SeatFlag = true;
  45. }
  46. userAccountModel.F_SeatRight = hfzuoxiquanxian.Value;
  47. if (hfxinbie.Value == "1")
  48. {
  49. userAccountModel.F_SexFlag = "男";
  50. }
  51. else
  52. {
  53. userAccountModel.F_SexFlag = "女";
  54. }
  55. userAccountModel.F_Remark = txtRemark.Text;
  56. userAccountModel.F_Mobile = txtMobel.Text;
  57. userAccountModel.F_Telephone = txtTelphone.Text;
  58. DateTime dttime = new DateTime();
  59. bool b = DateTime.TryParse(txtBirthday.Text, out dttime);
  60. if (b)
  61. userAccountModel.F_Birthday = Convert.ToDateTime(txtBirthday.Text);
  62. userAccountModel.F_CreateOn = DateTime.Now;
  63. userAccountModel.F_DeleteFlag = 0;
  64. userAccountModel.F_HJType = Convert.ToInt32(hfzuoxileixing.Value);
  65. if (Request.QueryString["actionFlag"].Trim() == "add")
  66. {
  67. DataTable dt = sysUserAccountBll.GetList(" F_UserCode='" + F_UserCode.Text.Trim() + "'").Tables[0];
  68. if (dt.Rows.Count > 0)
  69. {
  70. MessageBoxToWindow("当前员工工号存在,请更换!", "提示", "error");
  71. }
  72. else
  73. {
  74. if (sysUserAccountBll.Add(userAccountModel) > 0)
  75. {
  76. MessageBoxToWindow("新增成功", "新增提示", "success");
  77. }
  78. else
  79. {
  80. MessageBoxToWindow("新增失败", "新增提示!", "error");
  81. }
  82. }
  83. dt.Clear();
  84. dt.Dispose();
  85. }
  86. }
  87. catch (Exception ex)
  88. {
  89. SysLog.WriteLog(ex);
  90. MessageBoxToWindow("异常提示!" + ex.Message, "提示", "catch");
  91. }
  92. }
  93. #region 弹出对话框
  94. /// <summary>
  95. /// 弹出对话框
  96. /// </summary>
  97. /// <param name="title"></param>
  98. /// <param name="content"></param>
  99. /// <param name="type"></param>
  100. public void MessageBoxToWindow(string title, string content, string type)
  101. {
  102. string script = "";
  103. switch (type)
  104. {
  105. case "error"://失败
  106. type = "error";
  107. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  108. break;
  109. case "success"://成功
  110. type = "info";
  111. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "',CloseThis);</script>";
  112. break;
  113. case "catch"://异常
  114. type = "warning";
  115. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  116. break;
  117. default:
  118. type = "question";
  119. break;
  120. }
  121. ClientScript.RegisterClientScriptBlock(this.GetType(), "", script);
  122. }
  123. #endregion
  124. }
  125. }