123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.MembershipManage.StatisticsForm
- {
- public partial class MemberExpiresRemindSetForm : LYFZ.Software.UI.MembershipManage.StatisticsForm.MemberExpiresRemindSetForm
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpSystemConfigure sgbll = new BLL.BLL_ErpSystemConfigure();
- public MemberExpiresRemindSetForm()
- {
- this.Load += MemberExpiresRemindSetForm_Load;
- this.Shown += MemberExpiresRemindSetForm_Shown;
- this.btnSaveed.Click += btnSaveed_Click;
- this.btnCancel.Click += btnCancel_Click;
- }
- /// <summary>
- /// 是否保存
- /// </summary>
- public bool IsSaveed = false;
- /// <summary>
- /// 保存后的数据
- /// </summary>
- public string StrJosnData = "";
- DataRow dtRows;
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void MemberExpiresRemindSetForm_Load(object sender, EventArgs e)
- {
- DataTable tbl = sgbll.GetList("Sconfig_Code in ('MemberExpiresSet')").Tables[0];
- if (tbl.Rows.Count > 0)
- {
- dtRows = tbl.Rows[0];
- DataTable dt = new Json.JsontoDataTable().toObject(tbl.Rows[0]["Sconfig_Value"].ToString().Trim());
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- switch (dt.Rows[i]["StrName"].ToString().Trim())
- {
- case "Points":
- this.txtPoints.Text = dt.Rows[i]["StrValue"].ToString().Trim();
- this.chkPoints.Checked = Convert.ToBoolean(dt.Rows[i]["StrCheck"]);
- break;
- case "StoredValue":
- this.txtStoredValue.Text = dt.Rows[i]["StrValue"].ToString().Trim();
- this.chkStoredValue.Checked = Convert.ToBoolean(dt.Rows[i]["StrCheck"]);
- break;
- case "BackCash":
- this.txtBackCash.Text = dt.Rows[i]["StrValue"].ToString().Trim();
- this.chkBackCash.Checked = Convert.ToBoolean(dt.Rows[i]["StrCheck"]);
- break;
- case "Service":
- this.txtService.Text = dt.Rows[i]["StrValue"].ToString().Trim();
- this.chkService.Checked = Convert.ToBoolean(dt.Rows[i]["StrCheck"]);
- break;
- case "Photographer":
- this.txtPhotographer.Text = dt.Rows[i]["StrValue"].ToString().Trim();
- this.chkPhotographer.Checked = Convert.ToBoolean(dt.Rows[i]["StrCheck"]);
- break;
- }
- }
- }
- //else
- //{ this.txtServiceItemCount.Text = "0"; }
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void MemberExpiresRemindSetForm_Shown(object sender, EventArgs e)
- {
- }
- /// <summary>
- /// 保存
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSaveed_Click(object sender, EventArgs e)
- {
- if (this.txtPoints.Text.Trim().Length <= 0)
- { MessageBoxCustom.Show("积分提醒期限不能为空!"); return; }
- if (this.txtStoredValue.Text.Trim().Length <= 0)
- { MessageBoxCustom.Show("储值提醒期限不能为空!"); return; }
- if (this.txtBackCash.Text.Trim().Length <= 0)
- { MessageBoxCustom.Show("返现提醒期限不能为空!"); return; }
- if (this.txtService.Text.Trim().Length <= 0)
- { MessageBoxCustom.Show("服务提醒期限不能为空!"); return; }
- if (this.txtPhotographer.Text.Trim().Length <= 0)
- { MessageBoxCustom.Show("新摄会提醒期限不能为空!"); return; }
- DateTime strTime = SDateTime.Now;
- LYFZ.Model.Model_ErpSystemConfigure model = null;
- List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
- string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- DataTable newtable = new DataTable();
- newtable.Columns.Add("StrName", typeof(string));
- newtable.Columns.Add("StrValue", typeof(string));
- newtable.Columns.Add("StrCheck", typeof(string));
- DataRow dtNewRow = newtable.NewRow();
- dtNewRow["StrName"] = "Points";
- dtNewRow["StrValue"] = this.txtPoints.Text.Trim();
- dtNewRow["StrCheck"] = this.chkPoints.Checked.ToString().Trim();
- newtable.Rows.Add(dtNewRow);
- dtNewRow = newtable.NewRow();
- dtNewRow["StrName"] = "StoredValue";
- dtNewRow["StrValue"] = this.txtStoredValue.Text.Trim();
- dtNewRow["StrCheck"] = this.chkStoredValue.Checked.ToString().Trim();
- newtable.Rows.Add(dtNewRow);
- dtNewRow = newtable.NewRow();
- dtNewRow["StrName"] = "BackCash";
- dtNewRow["StrValue"] = this.txtBackCash.Text.Trim();
- dtNewRow["StrCheck"] = this.chkBackCash.Checked.ToString().Trim();
- newtable.Rows.Add(dtNewRow);
- dtNewRow = newtable.NewRow();
- dtNewRow["StrName"] = "Service";
- dtNewRow["StrValue"] = this.txtService.Text.Trim();
- dtNewRow["StrCheck"] = this.chkService.Checked.ToString().Trim();
- newtable.Rows.Add(dtNewRow);
- dtNewRow = newtable.NewRow();
- dtNewRow["StrName"] = "Photographer";
- dtNewRow["StrValue"] = this.txtPhotographer.Text.Trim();
- dtNewRow["StrCheck"] = this.chkPhotographer.Checked.ToString().Trim();
- newtable.Rows.Add(dtNewRow);
- string StrJosnData = new Json.JsontoDataTable().toJson(newtable);
- if (this.dtRows != null)
- {
- model = sgbll.GetModel("Sconfig_Code", "MemberExpiresSet");
- if (model.Sconfig_Value.Trim() != StrJosnData)
- {
- model.Sconfig_Name = "会员到期提醒设置";
- model.Sconfig_Value = StrJosnData;
- model.Sconfig_Remark = "服务项次数低于N次提醒";
- model.Sconfig_CreateDatetime = strTime;
- model.Sconfig_CreateName = strUserID;
- clist.Add(sgbll.GetUpdateCommandInfo(model));
- }
- }
- else
- {
- model = new Model.Model_ErpSystemConfigure();
- model.Sconfig_Code = "MemberExpiresSet";
- model.Sconfig_Name = "会员到期提醒设置";
- model.Sconfig_Value = StrJosnData;
- model.Sconfig_IsEnabled = true;
- model.Sconfig_Remark = "会员到期前N天提醒";
- model.Sconfig_Type = "";
- model.Sconfig_Order = 1;
- model.Sconfig_CreateDatetime = strTime;
- model.Sconfig_CreateName = strUserID;
- clist.Add(sgbll.GetAddCommandInfo(model));
- }
- if (clist.Count > 0)
- {
- if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0)
- { MessageBoxCustom.Show("保存失败"); return; }
- this.IsSaveed = true;
- this.StrJosnData = StrJosnData;
- MessageBoxCustom.Show("保存成功");
- this.Close();
- }
- else
- { MessageBoxCustom.Show("没做任何修改,无须保存!"); return; }
- }
- /// <summary>
- /// 取消
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnCancel_Click(object sender, EventArgs e)
- { this.Close(); }
- }
- }
|