MemberExpiresRemindSetForm.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. namespace LYFZ.Software.MainBusiness.MembershipManage.StatisticsForm
  10. {
  11. public partial class MemberExpiresRemindSetForm : LYFZ.Software.UI.MembershipManage.StatisticsForm.MemberExpiresRemindSetForm
  12. {
  13. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  14. LYFZ.BLL.BLL_ErpSystemConfigure sgbll = new BLL.BLL_ErpSystemConfigure();
  15. public MemberExpiresRemindSetForm()
  16. {
  17. this.Load += MemberExpiresRemindSetForm_Load;
  18. this.Shown += MemberExpiresRemindSetForm_Shown;
  19. this.btnSaveed.Click += btnSaveed_Click;
  20. this.btnCancel.Click += btnCancel_Click;
  21. }
  22. /// <summary>
  23. /// 是否保存
  24. /// </summary>
  25. public bool IsSaveed = false;
  26. /// <summary>
  27. /// 保存后的数据
  28. /// </summary>
  29. public string StrJosnData = "";
  30. DataRow dtRows;
  31. /// <summary>
  32. /// 窗体加载事件
  33. /// </summary>
  34. /// <param name="sender"></param>
  35. /// <param name="e"></param>
  36. void MemberExpiresRemindSetForm_Load(object sender, EventArgs e)
  37. {
  38. DataTable tbl = sgbll.GetList("Sconfig_Code in ('MemberExpiresSet')").Tables[0];
  39. if (tbl.Rows.Count > 0)
  40. {
  41. dtRows = tbl.Rows[0];
  42. DataTable dt = new Json.JsontoDataTable().toObject(tbl.Rows[0]["Sconfig_Value"].ToString().Trim());
  43. for (int i = 0; i < dt.Rows.Count; i++)
  44. {
  45. switch (dt.Rows[i]["StrName"].ToString().Trim())
  46. {
  47. case "Points":
  48. this.txtPoints.Text = dt.Rows[i]["StrValue"].ToString().Trim();
  49. this.chkPoints.Checked = Convert.ToBoolean(dt.Rows[i]["StrCheck"]);
  50. break;
  51. case "StoredValue":
  52. this.txtStoredValue.Text = dt.Rows[i]["StrValue"].ToString().Trim();
  53. this.chkStoredValue.Checked = Convert.ToBoolean(dt.Rows[i]["StrCheck"]);
  54. break;
  55. case "BackCash":
  56. this.txtBackCash.Text = dt.Rows[i]["StrValue"].ToString().Trim();
  57. this.chkBackCash.Checked = Convert.ToBoolean(dt.Rows[i]["StrCheck"]);
  58. break;
  59. case "Service":
  60. this.txtService.Text = dt.Rows[i]["StrValue"].ToString().Trim();
  61. this.chkService.Checked = Convert.ToBoolean(dt.Rows[i]["StrCheck"]);
  62. break;
  63. case "Photographer":
  64. this.txtPhotographer.Text = dt.Rows[i]["StrValue"].ToString().Trim();
  65. this.chkPhotographer.Checked = Convert.ToBoolean(dt.Rows[i]["StrCheck"]);
  66. break;
  67. }
  68. }
  69. }
  70. //else
  71. //{ this.txtServiceItemCount.Text = "0"; }
  72. }
  73. /// <summary>
  74. /// 窗体加载事件
  75. /// </summary>
  76. /// <param name="sender"></param>
  77. /// <param name="e"></param>
  78. void MemberExpiresRemindSetForm_Shown(object sender, EventArgs e)
  79. {
  80. }
  81. /// <summary>
  82. /// 保存
  83. /// </summary>
  84. /// <param name="sender"></param>
  85. /// <param name="e"></param>
  86. void btnSaveed_Click(object sender, EventArgs e)
  87. {
  88. if (this.txtPoints.Text.Trim().Length <= 0)
  89. { MessageBoxCustom.Show("积分提醒期限不能为空!"); return; }
  90. if (this.txtStoredValue.Text.Trim().Length <= 0)
  91. { MessageBoxCustom.Show("储值提醒期限不能为空!"); return; }
  92. if (this.txtBackCash.Text.Trim().Length <= 0)
  93. { MessageBoxCustom.Show("返现提醒期限不能为空!"); return; }
  94. if (this.txtService.Text.Trim().Length <= 0)
  95. { MessageBoxCustom.Show("服务提醒期限不能为空!"); return; }
  96. if (this.txtPhotographer.Text.Trim().Length <= 0)
  97. { MessageBoxCustom.Show("新摄会提醒期限不能为空!"); return; }
  98. DateTime strTime = SDateTime.Now;
  99. LYFZ.Model.Model_ErpSystemConfigure model = null;
  100. List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
  101. string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  102. DataTable newtable = new DataTable();
  103. newtable.Columns.Add("StrName", typeof(string));
  104. newtable.Columns.Add("StrValue", typeof(string));
  105. newtable.Columns.Add("StrCheck", typeof(string));
  106. DataRow dtNewRow = newtable.NewRow();
  107. dtNewRow["StrName"] = "Points";
  108. dtNewRow["StrValue"] = this.txtPoints.Text.Trim();
  109. dtNewRow["StrCheck"] = this.chkPoints.Checked.ToString().Trim();
  110. newtable.Rows.Add(dtNewRow);
  111. dtNewRow = newtable.NewRow();
  112. dtNewRow["StrName"] = "StoredValue";
  113. dtNewRow["StrValue"] = this.txtStoredValue.Text.Trim();
  114. dtNewRow["StrCheck"] = this.chkStoredValue.Checked.ToString().Trim();
  115. newtable.Rows.Add(dtNewRow);
  116. dtNewRow = newtable.NewRow();
  117. dtNewRow["StrName"] = "BackCash";
  118. dtNewRow["StrValue"] = this.txtBackCash.Text.Trim();
  119. dtNewRow["StrCheck"] = this.chkBackCash.Checked.ToString().Trim();
  120. newtable.Rows.Add(dtNewRow);
  121. dtNewRow = newtable.NewRow();
  122. dtNewRow["StrName"] = "Service";
  123. dtNewRow["StrValue"] = this.txtService.Text.Trim();
  124. dtNewRow["StrCheck"] = this.chkService.Checked.ToString().Trim();
  125. newtable.Rows.Add(dtNewRow);
  126. dtNewRow = newtable.NewRow();
  127. dtNewRow["StrName"] = "Photographer";
  128. dtNewRow["StrValue"] = this.txtPhotographer.Text.Trim();
  129. dtNewRow["StrCheck"] = this.chkPhotographer.Checked.ToString().Trim();
  130. newtable.Rows.Add(dtNewRow);
  131. string StrJosnData = new Json.JsontoDataTable().toJson(newtable);
  132. if (this.dtRows != null)
  133. {
  134. model = sgbll.GetModel("Sconfig_Code", "MemberExpiresSet");
  135. if (model.Sconfig_Value.Trim() != StrJosnData)
  136. {
  137. model.Sconfig_Name = "会员到期提醒设置";
  138. model.Sconfig_Value = StrJosnData;
  139. model.Sconfig_Remark = "服务项次数低于N次提醒";
  140. model.Sconfig_CreateDatetime = strTime;
  141. model.Sconfig_CreateName = strUserID;
  142. clist.Add(sgbll.GetUpdateCommandInfo(model));
  143. }
  144. }
  145. else
  146. {
  147. model = new Model.Model_ErpSystemConfigure();
  148. model.Sconfig_Code = "MemberExpiresSet";
  149. model.Sconfig_Name = "会员到期提醒设置";
  150. model.Sconfig_Value = StrJosnData;
  151. model.Sconfig_IsEnabled = true;
  152. model.Sconfig_Remark = "会员到期前N天提醒";
  153. model.Sconfig_Type = "";
  154. model.Sconfig_Order = 1;
  155. model.Sconfig_CreateDatetime = strTime;
  156. model.Sconfig_CreateName = strUserID;
  157. clist.Add(sgbll.GetAddCommandInfo(model));
  158. }
  159. if (clist.Count > 0)
  160. {
  161. if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0)
  162. { MessageBoxCustom.Show("保存失败"); return; }
  163. this.IsSaveed = true;
  164. this.StrJosnData = StrJosnData;
  165. MessageBoxCustom.Show("保存成功");
  166. this.Close();
  167. }
  168. else
  169. { MessageBoxCustom.Show("没做任何修改,无须保存!"); return; }
  170. }
  171. /// <summary>
  172. /// 取消
  173. /// </summary>
  174. /// <param name="sender"></param>
  175. /// <param name="e"></param>
  176. void btnCancel_Click(object sender, EventArgs e)
  177. { this.Close(); }
  178. }
  179. }