PointsSetSuperSmallForm.cs 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. namespace LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm
  11. {
  12. public partial class PointsSetSuperSmallForm : LYFZ.Software.UI.MembershipManage.SuperSmallForm.PointsSetSuperSmallForm
  13. {
  14. public PointsSetSuperSmallForm()
  15. {
  16. this.chkHaveCardPoints.Click += chkHaveCardPoints_Click;
  17. this.chkNoCardPoints.Click += chkNoCardPoints_Click;
  18. }
  19. LYFZ.BLL.BLL_ErpSystemConfigure bll = new BLL.BLL_ErpSystemConfigure();
  20. LYFZ.BLL.BLL_ErpMemberCardPointsRuleSet mcprbll = new BLL.BLL_ErpMemberCardPointsRuleSet();
  21. string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  22. List<LYFZ.Model.Model_ErpMemberCardPointsRuleSet> mlist = new List<Model.Model_ErpMemberCardPointsRuleSet>();
  23. /// <summary>
  24. /// 窗体加载事件
  25. /// </summary>
  26. /// <param name="sender"></param>
  27. /// <param name="e"></param>
  28. protected override void PointsSetSuperSmallForm_Shown(object sender, EventArgs e)
  29. {
  30. //DataTable tbl = bll.GetList("Sconfig_Code = 'PointToRMB'").Tables[0];
  31. //if (tbl.Rows.Count > 0)
  32. //{ this.txtPointsToRMB_Points.Text = tbl.Rows[0]["Sconfig_Value"].ToString().Trim(); }
  33. mlist = mcprbll.GetModelList("");
  34. }
  35. /// <summary>
  36. /// 窗体加载事件
  37. /// </summary>
  38. /// <param name="sender"></param>
  39. /// <param name="e"></param>
  40. protected override void PointsSetSuperSmallForm_Load(object sender, EventArgs e)
  41. {
  42. DateTime strTime = SDateTime.Now;
  43. List<Helper.CommandInfo> clist = null;
  44. LYFZ.Model.Model_ErpMemberCardPointsRuleSet model = null;
  45. bool IsWhile = true;
  46. while (IsWhile)
  47. {
  48. clist = new List<Helper.CommandInfo>();
  49. IsWhile = false;
  50. DataTable tblPointsRule = mcprbll.GetAllList().Tables[0];
  51. tblPointsRule.PrimaryKey = new DataColumn[] { tblPointsRule.Columns["Mcprs_Code"] };
  52. DataRow dtRow = tblPointsRule.Rows.Find("PointToRMB_Point");//积分多少=人民币1元
  53. if (dtRow != null)
  54. {
  55. this.txtPointsToRMB_Points.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow["Mcprs_Value"].ToString().Trim());
  56. if (dtRow["Mcprs_Type"].ToString().Trim() == "0")
  57. {
  58. model = mcprbll.GetModel(Convert.ToInt32(dtRow["ID"]));
  59. model.Mcprs_Type = "3";
  60. model.Mcprs_UpdateDatetime = strTime;
  61. model.Mcprs_UpdateName = strUserID;
  62. model.Mcprs_CreateDatetime = strTime;
  63. model.Mcprs_CreateName = strUserID;
  64. clist.Add(mcprbll.GetUpdateCommandInfo(model));
  65. IsWhile = true;
  66. }
  67. }
  68. else
  69. {
  70. model = new Model.Model_ErpMemberCardPointsRuleSet();
  71. model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  72. model.Mcprs_Type = "3";
  73. model.Mcprs_Code = "PointToRMB_Point";
  74. model.Mcprs_Name = "积分兑换人民币";
  75. model.Mcprs_Value = 1;
  76. model.Mcprs_Remark = "积分多少=人民币1元";
  77. model.Mcprs_CreateDatetime = strTime;
  78. model.Mcprs_CreateName = strUserID;
  79. clist.Add(mcprbll.GetAddCommandInfo(model));
  80. IsWhile = true;
  81. }
  82. DataRow dtRow1 = tblPointsRule.Rows.Find("AgoPeriod_RMB");//前期消费多少元得1积分
  83. if (dtRow1 != null)
  84. { this.txtAgoPeriod_RMB.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow1["Mcprs_Value"].ToString().Trim()); }
  85. else
  86. {
  87. model = new Model.Model_ErpMemberCardPointsRuleSet();
  88. model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  89. model.Mcprs_Type = "0";
  90. model.Mcprs_Code = "AgoPeriod_RMB";
  91. model.Mcprs_Name = "前期消费";
  92. model.Mcprs_Value = 1;
  93. model.Mcprs_Remark = "前期消费多少元得1积分";
  94. model.Mcprs_CreateDatetime = strTime;
  95. model.Mcprs_CreateName = strUserID;
  96. clist.Add(mcprbll.GetAddCommandInfo(model));
  97. IsWhile = true;
  98. }
  99. DataRow dtRow2 = tblPointsRule.Rows.Find("LatePeriod_RMB");//后期消费多少元得1积分
  100. if (dtRow2 != null)
  101. { this.txtLatePeriod_RMB.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow2["Mcprs_Value"].ToString().Trim()); }
  102. else
  103. {
  104. model = new Model.Model_ErpMemberCardPointsRuleSet();
  105. model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  106. model.Mcprs_Type = "0";
  107. model.Mcprs_Code = "LatePeriod_RMB";
  108. model.Mcprs_Name = "后期消费";
  109. model.Mcprs_Value = 1;
  110. model.Mcprs_Remark = "后期消费多少元得1积分";
  111. model.Mcprs_CreateDatetime = strTime;
  112. model.Mcprs_CreateName = strUserID;
  113. clist.Add(mcprbll.GetAddCommandInfo(model));
  114. IsWhile = true;
  115. }
  116. DataRow dtRow3 = tblPointsRule.Rows.Find("txtReferral_RMB");//转介绍前期消费多少元得1积分
  117. if (dtRow3 != null)
  118. { this.txtReferral_RMB.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow3["Mcprs_Value"].ToString().Trim()); }
  119. else
  120. {
  121. model = new Model.Model_ErpMemberCardPointsRuleSet();
  122. model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  123. model.Mcprs_Type = "0";
  124. model.Mcprs_Code = "txtReferral_RMB";
  125. model.Mcprs_Name = "转介绍前期消费";
  126. model.Mcprs_Value = 1;
  127. model.Mcprs_Remark = "转介绍前期消费多少元得1积分";
  128. model.Mcprs_CreateDatetime = strTime;
  129. model.Mcprs_CreateName = strUserID;
  130. clist.Add(mcprbll.GetAddCommandInfo(model));
  131. IsWhile = true;
  132. }
  133. DataRow dtRow4 = tblPointsRule.Rows.Find("Dianqing_Day");//店庆当天
  134. if (dtRow4 != null)
  135. { this.txtDianqing_Day.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow4["Mcprs_Value"].ToString().Trim()); }
  136. else
  137. {
  138. model = new Model.Model_ErpMemberCardPointsRuleSet();
  139. model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  140. model.Mcprs_Type = "1";
  141. model.Mcprs_Code = "Dianqing_Day";
  142. model.Mcprs_Name = "店庆当天";
  143. model.Mcprs_Value = 0;
  144. model.Mcprs_Remark = "店庆当天";
  145. model.Mcprs_CreateDatetime = strTime;
  146. model.Mcprs_CreateName = strUserID;
  147. clist.Add(mcprbll.GetAddCommandInfo(model));
  148. IsWhile = true;
  149. }
  150. DataRow dtRow5 = tblPointsRule.Rows.Find("Dianqing_Month");//店庆当月
  151. if (dtRow5 != null)
  152. { this.txtDianqing_Month.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow5["Mcprs_Value"].ToString().Trim()); }
  153. else
  154. {
  155. model = new Model.Model_ErpMemberCardPointsRuleSet();
  156. model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  157. model.Mcprs_Type = "1";
  158. model.Mcprs_Code = "Dianqing_Month";
  159. model.Mcprs_Name = "店庆当月";
  160. model.Mcprs_Value = 0;
  161. model.Mcprs_Remark = "店庆当月";
  162. model.Mcprs_CreateDatetime = strTime;
  163. model.Mcprs_CreateName = strUserID;
  164. clist.Add(mcprbll.GetAddCommandInfo(model));
  165. IsWhile = true;
  166. }
  167. DataRow dtRow6 = tblPointsRule.Rows.Find("Birthday_Day");//生日当天
  168. if (dtRow6 != null)
  169. { this.txtBirthday_Day.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow6["Mcprs_Value"].ToString().Trim()); }
  170. else
  171. {
  172. model = new Model.Model_ErpMemberCardPointsRuleSet();
  173. model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  174. model.Mcprs_Type = "1";
  175. model.Mcprs_Code = "Birthday_Day";
  176. model.Mcprs_Name = "生日当天";
  177. model.Mcprs_Value = 0;
  178. model.Mcprs_Remark = "生日当天";
  179. model.Mcprs_CreateDatetime = strTime;
  180. model.Mcprs_CreateName = strUserID;
  181. clist.Add(mcprbll.GetAddCommandInfo(model));
  182. IsWhile = true;
  183. }
  184. DataRow dtRow7 = tblPointsRule.Rows.Find("Birthday_Month");//生日当月
  185. if (dtRow7 != null)
  186. { this.txtBirthday_Month.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow7["Mcprs_Value"].ToString().Trim()); }
  187. else
  188. {
  189. model = new Model.Model_ErpMemberCardPointsRuleSet();
  190. model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  191. model.Mcprs_Type = "1";
  192. model.Mcprs_Code = "Birthday_Month";
  193. model.Mcprs_Name = "生日当月";
  194. model.Mcprs_Value = 0;
  195. model.Mcprs_Remark = "生日当月";
  196. model.Mcprs_CreateDatetime = strTime;
  197. model.Mcprs_CreateName = strUserID;
  198. clist.Add(mcprbll.GetAddCommandInfo(model));
  199. IsWhile = true;
  200. }
  201. DataRow dtRow8 = tblPointsRule.Rows.Find("WeddingAnniversary_Day");//结婚纪念日当天
  202. if (dtRow8 != null)
  203. { this.txtWeddingAnniversary_Day.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow8["Mcprs_Value"].ToString().Trim()); }
  204. else
  205. {
  206. model = new Model.Model_ErpMemberCardPointsRuleSet();
  207. model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  208. model.Mcprs_Type = "1";
  209. model.Mcprs_Code = "WeddingAnniversary_Day";
  210. model.Mcprs_Name = "结婚纪念日当天";
  211. model.Mcprs_Value = 0;
  212. model.Mcprs_Remark = "结婚纪念日当天";
  213. model.Mcprs_CreateDatetime = strTime;
  214. model.Mcprs_CreateName = strUserID;
  215. clist.Add(mcprbll.GetAddCommandInfo(model));
  216. IsWhile = true;
  217. }
  218. DataRow dtRow9 = tblPointsRule.Rows.Find("WeddingAnniversary_Month");//结婚纪念日当月
  219. if (dtRow9 != null)
  220. { this.txtWeddingAnniversary_Month.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow9["Mcprs_Value"].ToString().Trim()); }
  221. else
  222. {
  223. model = new Model.Model_ErpMemberCardPointsRuleSet();
  224. model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  225. model.Mcprs_Type = "1";
  226. model.Mcprs_Code = "WeddingAnniversary_Month";
  227. model.Mcprs_Name = "结婚纪念日当月";
  228. model.Mcprs_Value = 0;
  229. model.Mcprs_Remark = "结婚纪念日当月";
  230. model.Mcprs_CreateDatetime = strTime;
  231. model.Mcprs_CreateName = strUserID;
  232. clist.Add(mcprbll.GetAddCommandInfo(model));
  233. IsWhile = true;
  234. }
  235. DataRow dtRow10 = tblPointsRule.Rows.Find("PointsSet_HaveCardPoints");//有卡积分
  236. if (dtRow10 != null)
  237. { this.chkHaveCardPoints.Checked = Convert.ToInt32(dtRow10["Mcprs_Value"]) > 0 ? true : false; }
  238. else
  239. {
  240. model = new Model.Model_ErpMemberCardPointsRuleSet();
  241. model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  242. model.Mcprs_Type = "4";
  243. model.Mcprs_Code = "PointsSet_HaveCardPoints";
  244. model.Mcprs_Name = "有卡积分";
  245. model.Mcprs_Value = 0;
  246. model.Mcprs_Remark = "积分设置有卡积分 0:为false不积分;1:为true积分";
  247. model.Mcprs_CreateDatetime = strTime;
  248. model.Mcprs_CreateName = strUserID;
  249. clist.Add(mcprbll.GetAddCommandInfo(model));
  250. IsWhile = true;
  251. }
  252. DataRow dtRow11 = tblPointsRule.Rows.Find("PointsSet_NoCardPoints");//无卡也积分
  253. if (dtRow11 != null)
  254. { this.chkNoCardPoints.Checked = Convert.ToInt32(dtRow11["Mcprs_Value"]) > 0 ? true : false; }
  255. else
  256. {
  257. model = new Model.Model_ErpMemberCardPointsRuleSet();
  258. model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  259. model.Mcprs_Type = "4";
  260. model.Mcprs_Code = "PointsSet_NoCardPoints";
  261. model.Mcprs_Name = "无卡也积分";
  262. model.Mcprs_Value = 0;
  263. model.Mcprs_Remark = "积分设置无卡也积分 0:为false不积分;1:为true积分";
  264. model.Mcprs_CreateDatetime = strTime;
  265. model.Mcprs_CreateName = strUserID;
  266. clist.Add(mcprbll.GetAddCommandInfo(model));
  267. IsWhile = true;
  268. }
  269. DataRow[] dtRow12 = tblPointsRule.Select("Mcprs_Type = '2'");//特定日期
  270. for (int j = 0; j < dtRow12.Length; j++)
  271. {
  272. DataGridViewRow dgvr = new DataGridViewRow();
  273. DataGridViewCell cell = null;
  274. cell = new DataGridViewTextBoxCell();
  275. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dtRow12[j]["Mcprs_DateStart"].ToString().Trim());
  276. dgvr.Cells.Add(cell);
  277. cell = new DataGridViewTextBoxCell();
  278. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dtRow12[j]["Mcprs_DateEnd"].ToString().Trim());
  279. dgvr.Cells.Add(cell);
  280. cell = new DataGridViewTextBoxCell();
  281. cell.Value = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow12[j]["Mcprs_Value"].ToString().Trim());
  282. dgvr.Cells.Add(cell);
  283. cell = new DataGridViewTextBoxCell();
  284. cell.Value = dtRow12[j]["ID"].ToString().Trim();
  285. dgvr.Cells.Add(cell);
  286. this.dgvData.Rows.Add(dgvr);
  287. }
  288. if (clist.Count > 0)
  289. { LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist); }
  290. }
  291. }
  292. /// <summary>
  293. /// 确定
  294. /// </summary>
  295. /// <param name="sender"></param>
  296. /// <param name="e"></param>
  297. protected override void btnOK_Click(object sender, EventArgs e)
  298. {
  299. DateTime strTime = SDateTime.Now;
  300. List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
  301. if (string.IsNullOrEmpty(this.txtPointsToRMB_Points.Text.Trim()))
  302. { MessageBoxCustom.Show("积分换人民币,不能为空!"); return; }
  303. if (string.IsNullOrEmpty(this.txtAgoPeriod_RMB.Text.Trim()))
  304. { MessageBoxCustom.Show("前期消费获得积分,不能为空!"); return; }
  305. if (string.IsNullOrEmpty(this.txtLatePeriod_RMB.Text.Trim()))
  306. { MessageBoxCustom.Show("后期消费获得积分,不能为空!"); return; }
  307. if (string.IsNullOrEmpty(this.txtReferral_RMB.Text.Trim()))
  308. { MessageBoxCustom.Show("转介绍前期消费获得积分,不能为空!"); return; }
  309. if (string.IsNullOrEmpty(this.txtDianqing_Day.Text.Trim()))
  310. { MessageBoxCustom.Show("婚庆当天倍数,不能为空!"); return; }
  311. if (string.IsNullOrEmpty(this.txtDianqing_Month.Text.Trim()))
  312. { MessageBoxCustom.Show("婚庆当月倍数,不能为空!"); return; }
  313. if (string.IsNullOrEmpty(this.txtBirthday_Day.Text.Trim()))
  314. { MessageBoxCustom.Show("生日当天倍数,不能为空!"); return; }
  315. if (string.IsNullOrEmpty(this.txtBirthday_Month.Text.Trim()))
  316. { MessageBoxCustom.Show("生日当月倍数,不能为空!"); return; }
  317. if (string.IsNullOrEmpty(this.txtWeddingAnniversary_Day.Text.Trim()))
  318. { MessageBoxCustom.Show("结婚纪念日当天倍数,不能为空!"); return; }
  319. if (string.IsNullOrEmpty(this.txtWeddingAnniversary_Month.Text.Trim()))
  320. { MessageBoxCustom.Show("结婚纪念日日当月倍数,不能为空!"); return; }
  321. #region 消费积分设置、节日积分设置
  322. List<int> ilist = new List<int>();
  323. for (int i = 0; i < mlist.Count; i++)
  324. {
  325. LYFZ.Model.Model_ErpMemberCardPointsRuleSet model = mlist[i];
  326. if (model.Mcprs_Type.Trim() != "2")
  327. {
  328. switch (model.Mcprs_Code.Trim())
  329. {
  330. case "PointToRMB_Point":
  331. model.Mcprs_Value = Convert.ToDecimal(this.txtPointsToRMB_Points.Text);
  332. break;
  333. case "AgoPeriod_RMB":
  334. model.Mcprs_Value = Convert.ToDecimal(this.txtAgoPeriod_RMB.Text);
  335. break;
  336. case "LatePeriod_RMB":
  337. model.Mcprs_Value = Convert.ToDecimal(this.txtLatePeriod_RMB.Text);
  338. break;
  339. case "txtReferral_RMB":
  340. model.Mcprs_Value = Convert.ToDecimal(this.txtReferral_RMB.Text);
  341. break;
  342. case "Dianqing_Day":
  343. model.Mcprs_Value = Convert.ToDecimal(this.txtDianqing_Day.Text);
  344. break;
  345. case "Dianqing_Month":
  346. model.Mcprs_Value = Convert.ToDecimal(this.txtDianqing_Month.Text);
  347. break;
  348. case "Birthday_Day":
  349. model.Mcprs_Value = Convert.ToDecimal(this.txtBirthday_Day.Text);
  350. break;
  351. case "Birthday_Month":
  352. model.Mcprs_Value = Convert.ToDecimal(this.txtBirthday_Month.Text);
  353. break;
  354. case "WeddingAnniversary_Day":
  355. model.Mcprs_Value = Convert.ToDecimal(this.txtWeddingAnniversary_Day.Text);
  356. break;
  357. case "WeddingAnniversary_Month":
  358. model.Mcprs_Value = Convert.ToDecimal(this.txtWeddingAnniversary_Month.Text);
  359. break;
  360. case "PointsSet_HaveCardPoints":
  361. model.Mcprs_Value = this.chkHaveCardPoints.Checked ? 1 : 0;
  362. break;
  363. case "PointsSet_NoCardPoints":
  364. model.Mcprs_Value = this.chkNoCardPoints.Checked ? 1 : 0;
  365. break;
  366. }
  367. model.Mcprs_UpdateDatetime = strTime;
  368. model.Mcprs_UpdateName = strUserID;
  369. clist.Add(mcprbll.GetUpdateCommandInfo(model));
  370. ilist.Add(model.ID);
  371. }
  372. }
  373. for (int i = 0; i < ilist.Count; i++)
  374. {
  375. for (int j = 0; j < mlist.Count; j++)
  376. {
  377. if (mlist[j].ID == ilist[i])
  378. { mlist.RemoveAt(j); }
  379. }
  380. }
  381. #endregion
  382. for (int i = 0; i < this.dgvData.Rows.Count; i++)
  383. {
  384. if (this.dgvData.Rows[i].Cells["Column4"].Value.ToString().Trim() != "")//ID是否存在
  385. {
  386. if (this.dgvData.Rows[i].Cells["Column4"].Tag != null)//数据是否修改过
  387. {
  388. for (int j = 0; j < mlist.Count; j++)
  389. {
  390. if (mlist[j].ID.ToString().Trim() == this.dgvData.Rows[i].Cells["Column4"].Value.ToString().Trim())
  391. {
  392. LYFZ.Model.Model_ErpMemberCardPointsRuleSet model = mlist[j];
  393. model.Mcprs_DateStart = Convert.ToDateTime(this.dgvData.Rows[i].Cells["Column1"].Value);
  394. model.Mcprs_DateEnd = Convert.ToDateTime(this.dgvData.Rows[i].Cells["Column2"].Value);
  395. model.Mcprs_Value = Convert.ToDecimal(this.dgvData.Rows[i].Cells["Column3"].Value);
  396. model.Mcprs_UpdateDatetime = strTime;
  397. model.Mcprs_UpdateName = strUserID;
  398. clist.Add(mcprbll.GetUpdateCommandInfo(model));
  399. break;
  400. }
  401. }
  402. }
  403. }
  404. else
  405. {
  406. LYFZ.Model.Model_ErpMemberCardPointsRuleSet model = new Model.Model_ErpMemberCardPointsRuleSet();
  407. model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  408. model.Mcprs_Type = "2";
  409. model.Mcprs_Code = "[" + this.dgvData.Rows[i].Cells["Column1"].Value + "]-[" + this.dgvData.Rows[i].Cells["Column2"].Value + "]";
  410. model.Mcprs_Name = "[" + Convert.ToDateTime(this.dgvData.Rows[i].Cells["Column1"].Value).ToString("MM-dd") + "]-[" + Convert.ToDateTime(this.dgvData.Rows[i].Cells["Column2"].Value).ToString("MM-dd") + "]";
  411. model.Mcprs_DateStart = Convert.ToDateTime(this.dgvData.Rows[i].Cells["Column1"].Value);
  412. model.Mcprs_DateEnd = Convert.ToDateTime(this.dgvData.Rows[i].Cells["Column2"].Value);
  413. model.Mcprs_Value = Convert.ToDecimal(this.dgvData.Rows[i].Cells["Column3"].Value);
  414. model.Mcprs_Remark = "特定日期[" + this.dgvData.Rows[i].Cells["Column1"].Value + "]-[" + this.dgvData.Rows[i].Cells["Column2"].Value + "]得" + this.dgvData.Rows[i].Cells["Column3"].Value + "积分";
  415. model.Mcprs_CreateDatetime = strTime;
  416. model.Mcprs_CreateName = "";
  417. clist.Add(mcprbll.GetAddCommandInfo(model));
  418. }
  419. }
  420. if (clist.Count > 0)
  421. {
  422. if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0)
  423. { MessageBoxCustom.Show("保存失败"); }
  424. LYFZ.BLL.BLL_ErpMemberCard.AgainGettblPointsRule();
  425. MessageBoxCustom.Show("保存成功");
  426. this.Close();
  427. }
  428. }
  429. /// <summary>
  430. /// 关闭
  431. /// </summary>
  432. /// <param name="sender"></param>
  433. /// <param name="e"></param>
  434. protected override void btnClose_Click(object sender, EventArgs e)
  435. { this.Close(); }
  436. /// <summary>
  437. /// 有卡积分
  438. /// </summary>
  439. /// <param name="sender"></param>
  440. /// <param name="e"></param>
  441. void chkHaveCardPoints_Click(object sender, EventArgs e)
  442. {
  443. if (!this.chkHaveCardPoints.Checked)
  444. { this.chkNoCardPoints.Checked = false; }
  445. }
  446. /// <summary>
  447. /// 无卡也积分
  448. /// </summary>
  449. /// <param name="sender"></param>
  450. /// <param name="e"></param>
  451. void chkNoCardPoints_Click(object sender, EventArgs e)
  452. {
  453. if (!this.chkHaveCardPoints.Checked)
  454. { this.chkHaveCardPoints.Checked = true; }
  455. }
  456. /// <summary>
  457. /// 删除特定日期
  458. /// </summary>
  459. /// <param name="sender"></param>
  460. /// <param name="e"></param>
  461. protected override void btnDelete_Click(object sender, EventArgs e)
  462. {
  463. if (this.dgvData.Rows.Count > 0)
  464. {
  465. if (this.dgvData.CurrentCell.ColumnIndex >= 0 && this.dgvData.CurrentRow.Index >= 0)
  466. {
  467. if (MessageBoxCustom.Show("删除后则不能恢复,你确定要删除吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  468. { return; }
  469. this.dgvData.Rows.RemoveAt(this.dgvData.CurrentRow.Index);
  470. }
  471. }
  472. }
  473. /// <summary>
  474. /// 添加特定日期
  475. /// </summary>
  476. /// <param name="sender"></param>
  477. /// <param name="e"></param>
  478. protected override void btnAddDate_Click(object sender, EventArgs e)
  479. {
  480. LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm.ParticularDateSetSetSuperSmallForm frm = new ParticularDateSetSetSuperSmallForm();
  481. frm.mlist = this.mlist;
  482. frm.ShowDialog();
  483. if (frm.IsSaveed)
  484. {
  485. DataGridViewRow dgvr = new DataGridViewRow();
  486. DataGridViewCell cell = null;
  487. cell = new DataGridViewTextBoxCell();
  488. cell.Value = frm.strStartDate.Trim();
  489. dgvr.Cells.Add(cell);
  490. cell = new DataGridViewTextBoxCell();
  491. cell.Value = frm.strEndDate.Trim();
  492. dgvr.Cells.Add(cell);
  493. cell = new DataGridViewTextBoxCell();
  494. cell.Value = frm.strValue.Trim();
  495. dgvr.Cells.Add(cell);
  496. cell = new DataGridViewTextBoxCell();
  497. cell.Value = "";
  498. dgvr.Cells.Add(cell);
  499. this.dgvData.Rows.Add(dgvr);
  500. }
  501. }
  502. LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm.PointsRuleMultipleTestSuperSmallForm frm = null;
  503. /// <summary>
  504. /// 测试
  505. /// </summary>
  506. /// <param name="sender"></param>
  507. /// <param name="e"></param>
  508. protected override void btnTest_Click(object sender, EventArgs e)
  509. {
  510. if (frm != null)
  511. { frm.Close(); }
  512. frm = new PointsRuleMultipleTestSuperSmallForm();
  513. frm.Show();
  514. }
  515. /// <summary>
  516. /// 列表双击事件
  517. /// </summary>
  518. /// <param name="sender"></param>
  519. /// <param name="e"></param>
  520. protected override void dgvData_MouseDoubleClick(object sender, MouseEventArgs e)
  521. {
  522. if (this.dgvData.Rows.Count > 0)
  523. {
  524. if (this.dgvData.CurrentRow.Index >= 0 && this.dgvData.CurrentCell.ColumnIndex >= 0)
  525. {
  526. LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm.ParticularDateSetSetSuperSmallForm frm = new ParticularDateSetSetSuperSmallForm();
  527. frm.mlist = this.mlist;
  528. frm.strID = this.dgvData.CurrentRow.Cells["Column4"].Value.ToString().Trim();
  529. frm.strStartDate = this.dgvData.CurrentRow.Cells["Column1"].Value.ToString().Trim();
  530. frm.strEndDate = this.dgvData.CurrentRow.Cells["Column2"].Value.ToString().Trim();
  531. frm.strValue = this.dgvData.CurrentRow.Cells["Column3"].Value.ToString().Trim();
  532. frm.ShowDialog();
  533. if (frm.IsSaveed)
  534. {
  535. this.dgvData.CurrentRow.Cells["Column1"].Value = frm.strStartDate.Trim();
  536. this.dgvData.CurrentRow.Cells["Column2"].Value = frm.strEndDate.Trim();
  537. this.dgvData.CurrentRow.Cells["Column3"].Value = frm.strValue.Trim();
  538. this.dgvData.CurrentRow.Cells["Column4"].Tag = "1";
  539. }
  540. }
  541. }
  542. }
  543. /// <summary>
  544. /// 前期消费_积分限制输入
  545. /// </summary>
  546. /// <param name="sender"></param>
  547. /// <param name="e"></param>
  548. protected override void txtAgoPeriod_Points_KeyPress(object sender, KeyPressEventArgs e)
  549. {
  550. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  551. { e.Handled = true; }
  552. }
  553. /// <summary>
  554. /// 前期消费_人民币限制输入
  555. /// </summary>
  556. /// <param name="sender"></param>
  557. /// <param name="e"></param>
  558. protected override void txtAgoPeriod_RMB_KeyPress(object sender, KeyPressEventArgs e)
  559. {
  560. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  561. { e.Handled = true; }
  562. }
  563. /// <summary>
  564. /// 生日_当天限制输入
  565. /// </summary>
  566. /// <param name="sender"></param>
  567. /// <param name="e"></param>
  568. protected override void txtBirthday_Day_KeyPress(object sender, KeyPressEventArgs e)
  569. {
  570. if (Convert.ToString(e.KeyChar) == ".")
  571. {
  572. if (this.txtBirthday_Day.Text.Trim().IndexOf('.') != -1)
  573. { e.Handled = true; }
  574. }
  575. else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  576. { e.Handled = true; }
  577. }
  578. /// <summary>
  579. /// 生日_当月限制输入
  580. /// </summary>
  581. /// <param name="sender"></param>
  582. /// <param name="e"></param>
  583. protected override void txtBirthday_Month_KeyPress(object sender, KeyPressEventArgs e)
  584. {
  585. if (Convert.ToString(e.KeyChar) == ".")
  586. {
  587. if (this.txtBirthday_Month.Text.Trim().IndexOf('.') != -1)
  588. { e.Handled = true; }
  589. }
  590. else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  591. { e.Handled = true; }
  592. }
  593. /// <summary>
  594. /// 店庆_当天限制输入
  595. /// </summary>
  596. /// <param name="sender"></param>
  597. /// <param name="e"></param>
  598. protected override void txtDianqing_Day_KeyPress(object sender, KeyPressEventArgs e)
  599. {
  600. if (Convert.ToString(e.KeyChar) == ".")
  601. {
  602. if (this.txtDianqing_Day.Text.Trim().IndexOf('.') != -1)
  603. { e.Handled = true; }
  604. }
  605. else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  606. { e.Handled = true; }
  607. }
  608. /// <summary>
  609. /// 店庆_当月限制输入
  610. /// </summary>
  611. /// <param name="sender"></param>
  612. /// <param name="e"></param>
  613. protected override void txtDianqing_Month_KeyPress(object sender, KeyPressEventArgs e)
  614. {
  615. if (Convert.ToString(e.KeyChar) == ".")
  616. {
  617. if (this.txtDianqing_Month.Text.Trim().IndexOf('.') != -1)
  618. { e.Handled = true; }
  619. }
  620. else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  621. { e.Handled = true; }
  622. }
  623. /// <summary>
  624. /// 后期消费_积分限制输入
  625. /// </summary>
  626. /// <param name="sender"></param>
  627. /// <param name="e"></param>
  628. protected override void txtLatePeriod_Points_KeyPress(object sender, KeyPressEventArgs e)
  629. {
  630. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  631. { e.Handled = true; }
  632. }
  633. /// <summary>
  634. /// 后期消费_人民币限制输入
  635. /// </summary>
  636. /// <param name="sender"></param>
  637. /// <param name="e"></param>
  638. protected override void txtLatePeriod_RMB_KeyPress(object sender, KeyPressEventArgs e)
  639. {
  640. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  641. { e.Handled = true; }
  642. }
  643. /// <summary>
  644. /// 积分换人民币_积分限制输入
  645. /// </summary>
  646. /// <param name="sender"></param>
  647. /// <param name="e"></param>
  648. protected override void txtPointsToRMB_Points_KeyPress(object sender, KeyPressEventArgs e)
  649. {
  650. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  651. { e.Handled = true; }
  652. }
  653. /// <summary>
  654. /// 积分换人民币_人民币限制输入
  655. /// </summary>
  656. /// <param name="sender"></param>
  657. /// <param name="e"></param>
  658. protected override void txtPointsToRMB_RMB_KeyPress(object sender, KeyPressEventArgs e)
  659. {
  660. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  661. { e.Handled = true; }
  662. }
  663. /// <summary>
  664. /// 转介绍_积分限制输入
  665. /// </summary>
  666. /// <param name="sender"></param>
  667. /// <param name="e"></param>
  668. protected override void txtReferral_Points_KeyPress(object sender, KeyPressEventArgs e)
  669. {
  670. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  671. { e.Handled = true; }
  672. }
  673. /// <summary>
  674. /// 转介绍_人民币限制输入
  675. /// </summary>
  676. /// <param name="sender"></param>
  677. /// <param name="e"></param>
  678. protected override void txtReferral_RMB_KeyPress(object sender, KeyPressEventArgs e)
  679. {
  680. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  681. { e.Handled = true; }
  682. }
  683. /// <summary>
  684. /// 结婚纪念日当天限制输入
  685. /// </summary>
  686. /// <param name="sender"></param>
  687. /// <param name="e"></param>
  688. protected override void txtWeddingAnniversary_Day_KeyPress(object sender, KeyPressEventArgs e)
  689. {
  690. if (Convert.ToString(e.KeyChar) == ".")
  691. {
  692. if (this.txtWeddingAnniversary_Day.Text.Trim().IndexOf('.') != -1)
  693. { e.Handled = true; }
  694. }
  695. else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  696. { e.Handled = true; }
  697. }
  698. /// <summary>
  699. /// 结婚纪念日当月限制输入
  700. /// </summary>
  701. /// <param name="sender"></param>
  702. /// <param name="e"></param>
  703. protected override void txtWeddingAnniversary_Month_KeyPress(object sender, KeyPressEventArgs e)
  704. {
  705. if (Convert.ToString(e.KeyChar) == ".")
  706. {
  707. if (this.txtWeddingAnniversary_Month.Text.Trim().IndexOf('.') != -1)
  708. { e.Handled = true; }
  709. }
  710. else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  711. { e.Handled = true; }
  712. }
  713. }
  714. }