市长热线演示版

worktimessetaddandedit.aspx.cs 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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.telmanage
  8. {
  9. public partial class worktimessetaddandedit : 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["singleFlage"]))
  17. {
  18. Initialize(Request.QueryString["singleFlage"]);
  19. }
  20. }
  21. }
  22. protected void btnSubmit_Click(object sender, EventArgs e)
  23. {
  24. SaveInfo();
  25. }
  26. private void SaveInfo()
  27. {
  28. try
  29. {
  30. if (!string.IsNullOrWhiteSpace(Request.QueryString["actionFlag"].Trim()))
  31. {
  32. string actionFlag = Request.QueryString["actionFlag"].Trim();
  33. if (actionFlag == "add")
  34. {
  35. bool bl = new BLL.T_Sys_WorkTimes().Add(T_Sys_MobileData);
  36. if (bl)
  37. {
  38. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('success')</script>");
  39. }
  40. else
  41. {
  42. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('warn')</script>");
  43. }
  44. }
  45. if (actionFlag == "edit")
  46. {
  47. bool b2 = new BLL.T_Sys_WorkTimes().Update(T_Sys_MobileData);
  48. if (b2)
  49. {
  50. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('success')</script>");
  51. }
  52. else
  53. {
  54. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('warn')</script>");
  55. }
  56. }
  57. }
  58. }
  59. catch
  60. {
  61. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('error')</script>");
  62. }
  63. }
  64. #region 信息初始化
  65. private void Initialize(string id)
  66. {
  67. DateTime dt = new DateTime();
  68. if (DateTime.TryParse(id, out dt))
  69. T_Sys_MobileData = new BLL.T_Sys_WorkTimes().GetModel(dt);
  70. }
  71. #endregion
  72. #region 公共属性
  73. private Model.T_Sys_WorkTimes T_Sys_MobileData
  74. {
  75. get
  76. {
  77. Model.T_Sys_WorkTimes _model = new Model.T_Sys_WorkTimes();
  78. if (!string.IsNullOrWhiteSpace(txtMobileNum.Text.Trim()))
  79. {
  80. DateTime dt = new DateTime();
  81. if (DateTime.TryParse(txtMobileNum.Text.Trim(), out dt))
  82. _model.F_WorkStartTimes = Convert.ToDateTime(dt.ToString("1900-01-01 HH:mm:ss"));
  83. }
  84. if (!string.IsNullOrWhiteSpace(txtZipCode.Text.Trim()))
  85. {
  86. DateTime dt = new DateTime();
  87. if (DateTime.TryParse(txtZipCode.Text.Trim(), out dt))
  88. _model.F_WorkEndTimes = Convert.ToDateTime(dt.ToString("1900-01-01 HH:mm:ss"));
  89. }
  90. if (!string.IsNullOrWhiteSpace(txtCityDes.Text.Trim()))
  91. {
  92. _model.F_TimeName = txtCityDes.Text.Trim();
  93. }
  94. if (!string.IsNullOrWhiteSpace(txtCardDes.Text.Trim()))
  95. {
  96. _model.F_Remark = txtCardDes.Text.Trim();
  97. }
  98. return _model;
  99. }
  100. set
  101. {
  102. if (value != null)
  103. {
  104. txtMobileNum.Text = value.F_WorkStartTimes.ToString("HH:mm:ss");
  105. txtZipCode.Text = value.F_WorkEndTimes.ToString("HH:mm:ss");
  106. txtCityDes.Text = value.F_TimeName;
  107. txtCardDes.Text = value.F_Remark;
  108. }
  109. }
  110. }
  111. #endregion
  112. }
  113. }