UU跑腿标准版

personedit.aspx.cs 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. namespace HySoft.BaseCallCenter.Web.customermanage
  8. {
  9. public partial class personedit : System.Web.UI.Page
  10. {
  11. protected void Page_Load(object sender, EventArgs e)
  12. {
  13. Response.Expires = -1;
  14. if (!IsPostBack)
  15. {
  16. if (!string.IsNullOrEmpty(Request.QueryString["personId"]))
  17. {
  18. hiddPersonId.Value = Request.QueryString["personId"];
  19. Initialize(Request.QueryString["personId"]);
  20. }
  21. }
  22. }
  23. protected void btnSubmit_Click(object sender, EventArgs e)
  24. {
  25. SaveInfo();
  26. }
  27. private void SaveInfo()
  28. {
  29. try
  30. {
  31. if (!string.IsNullOrWhiteSpace(Request.QueryString["actionFlag"].Trim()))
  32. {
  33. string actionFlag = Request.QueryString["actionFlag"].Trim();
  34. if (actionFlag == "add")
  35. {
  36. int b1 = new BLL.T_Cus_ContactPerson().Add(T_Cus_ContactPerson);
  37. if (b1 > 0)
  38. {
  39. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('success')</script>");
  40. }
  41. else
  42. {
  43. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('warn')</script>");
  44. }
  45. }
  46. if (actionFlag == "modify")
  47. {
  48. bool b2 = new BLL.T_Cus_ContactPerson().Update(T_Cus_ContactPerson);
  49. if (b2)
  50. {
  51. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('success')</script>");
  52. }
  53. else
  54. {
  55. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('warn')</script>");
  56. }
  57. }
  58. }
  59. }
  60. catch
  61. {
  62. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('error')</script>");
  63. }
  64. }
  65. #region 信息初始化
  66. private void Initialize(string id)
  67. {
  68. T_Cus_ContactPerson = new BLL.T_Cus_ContactPerson().GetModel(Convert.ToInt32(hiddPersonId.Value));
  69. }
  70. #endregion
  71. #region 公共属性
  72. private Model.T_Cus_ContactPerson T_Cus_ContactPerson
  73. {
  74. get
  75. {
  76. Model.T_Cus_ContactPerson _model = new Model.T_Cus_ContactPerson();
  77. if (hiddPersonId.Value == "" || hiddPersonId.Value == null) { }
  78. else
  79. _model.F_ManId = Convert.ToInt32(hiddPersonId.Value);
  80. if (hiddCustomerId.Value == "" || hiddCustomerId.Value == null) { }
  81. else
  82. _model.F_CustomerId = Convert.ToInt32(hiddCustomerId.Value);
  83. _model.F_Name = txtContactName.Text;
  84. if (hfSex.Value == "1" || hfSex.Value == "")
  85. {
  86. _model.F_Sex = "男";
  87. }
  88. else
  89. {
  90. _model.F_Sex = "女";
  91. }
  92. _model.F_Duty = txtDuty.Text;
  93. _model.F_Email = txtEmail.Text;
  94. _model.F_Telephone = txtTelePhone.Text;
  95. _model.F_Mobile = txtMobile.Text;
  96. _model.F_QQ = txtQQ.Text;
  97. _model.F_Fax = txtFax.Text;
  98. _model.F_Remark = txtRemark.Value;
  99. //wbx 5-29 添加账户和密码字段
  100. _model.F_UserAccount = txtAccount.Text;
  101. _model.F_Password = txtPwd.Text;
  102. return _model;
  103. }
  104. set
  105. {
  106. if (value != null)
  107. {
  108. hiddPersonId.Value = value.F_ManId.ToString();
  109. hiddCustomerId.Value = value.F_CustomerId.ToString();
  110. txtCustomerName.Text = getCustomerName((int)value.F_CustomerId);
  111. txtContactName.Text = value.F_Name;
  112. if (value.F_Sex == "男")
  113. {
  114. hfSex.Value = "1";
  115. }
  116. else
  117. {
  118. hfSex.Value = "0";
  119. }
  120. txtDuty.Text = value.F_Duty;
  121. txtEmail.Text = value.F_Email;
  122. txtTelePhone.Text = value.F_Telephone;
  123. txtMobile.Text = value.F_Mobile;
  124. txtQQ.Text = value.F_QQ;
  125. txtFax.Text = value.F_Fax;
  126. txtRemark.Value = value.F_Remark;
  127. //wbx 5-29 添加账户和密码字段
  128. txtAccount.Text = value.F_UserAccount;
  129. txtPwd.Text = value.F_Password;
  130. }
  131. }
  132. }
  133. #endregion
  134. private string getCustomerName(int id)
  135. {
  136. Model.T_Cus_CustomerBase model = new BLL.T_Cus_CustomerBase().GetModel(id);
  137. if (model != null)
  138. return model.F_CustomerName;
  139. else return "";
  140. }
  141. }
  142. }