UU跑腿标准版

personmodify.aspx.cs 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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 personmodify : 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 = 0;
  37. if (Request.QueryString["cid"] != null && Request.QueryString["cid"] != "")
  38. {
  39. Model.T_Cus_ContactPerson tccp = new Model.T_Cus_ContactPerson();
  40. string cid = Request.QueryString["cid"].Trim();
  41. tccp = T_Cus_ContactPerson;
  42. tccp.F_CustomerId = Convert.ToInt32(cid);
  43. b1 = new BLL.T_Cus_ContactPerson().Add(tccp);
  44. }
  45. else
  46. b1 = new BLL.T_Cus_ContactPerson().Add(T_Cus_ContactPerson);
  47. if (b1 > 0)
  48. {
  49. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('success')</script>");
  50. }
  51. else
  52. {
  53. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('warn')</script>");
  54. }
  55. }
  56. if (actionFlag == "modify")
  57. {
  58. bool b2 = new BLL.T_Cus_ContactPerson().Update(T_Cus_ContactPerson);
  59. if (b2)
  60. {
  61. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('success')</script>");
  62. }
  63. else
  64. {
  65. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('warn')</script>");
  66. }
  67. }
  68. }
  69. }
  70. catch
  71. {
  72. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('error')</script>");
  73. }
  74. }
  75. #region 信息初始化
  76. private void Initialize(string id)
  77. {
  78. T_Cus_ContactPerson = new BLL.T_Cus_ContactPerson().GetModel(Convert.ToInt32(hiddPersonId.Value));
  79. }
  80. #endregion
  81. #region 公共属性
  82. private Model.T_Cus_ContactPerson T_Cus_ContactPerson
  83. {
  84. get
  85. {
  86. Model.T_Cus_ContactPerson _model = new Model.T_Cus_ContactPerson();
  87. if (hiddPersonId.Value == "" || hiddPersonId.Value == null) { }
  88. else
  89. _model.F_ManId = Convert.ToInt32(hiddPersonId.Value);
  90. if (hiddCustomerId.Value == "" || hiddCustomerId.Value == null) { }
  91. else
  92. _model.F_CustomerId = Convert.ToInt32(hiddCustomerId.Value);
  93. _model.F_Name = txtContactName.Text;
  94. if (hfSex.Value == "1" || hfSex.Value == "")
  95. {
  96. _model.F_Sex = "男";
  97. }
  98. else
  99. {
  100. _model.F_Sex = "女";
  101. }
  102. _model.F_Duty = txtDuty.Text;
  103. _model.F_Email = txtEmail.Text;
  104. _model.F_Telephone = txtTelePhone.Text;
  105. _model.F_Mobile = txtMobile.Text;
  106. _model.F_QQ = txtQQ.Text;
  107. _model.F_Fax = txtFax.Text;
  108. _model.F_Remark = txtRemark.Value;
  109. return _model;
  110. }
  111. set
  112. {
  113. if (value != null)
  114. {
  115. hiddPersonId.Value = value.F_ManId.ToString();
  116. hiddCustomerId.Value = value.F_CustomerId.ToString();
  117. txtContactName.Text = value.F_Name;
  118. if (value.F_Sex == "男")
  119. {
  120. hfSex.Value = "1";
  121. }
  122. else
  123. {
  124. hfSex.Value = "0";
  125. }
  126. txtDuty.Text = value.F_Duty;
  127. txtEmail.Text = value.F_Email;
  128. txtTelePhone.Text = value.F_Telephone;
  129. txtMobile.Text = value.F_Mobile;
  130. txtQQ.Text = value.F_QQ;
  131. txtFax.Text = value.F_Fax;
  132. txtRemark.Value = value.F_Remark;
  133. }
  134. }
  135. }
  136. #endregion
  137. private string getCustomerName(int id)
  138. {
  139. Model.T_Cus_CustomerBase model = new BLL.T_Cus_CustomerBase().GetModel(id);
  140. if (model != null)
  141. return model.F_CustomerName;
  142. else return "";
  143. }
  144. }
  145. }