123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731 |
- using System;
- using System.Collections;
- 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.SuperSmallForm
- {
- public partial class PointsSetSuperSmallForm : LYFZ.Software.UI.MembershipManage.SuperSmallForm.PointsSetSuperSmallForm
- {
- public PointsSetSuperSmallForm()
- {
- this.chkHaveCardPoints.Click += chkHaveCardPoints_Click;
- this.chkNoCardPoints.Click += chkNoCardPoints_Click;
- }
- LYFZ.BLL.BLL_ErpSystemConfigure bll = new BLL.BLL_ErpSystemConfigure();
- LYFZ.BLL.BLL_ErpMemberCardPointsRuleSet mcprbll = new BLL.BLL_ErpMemberCardPointsRuleSet();
- string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- List<LYFZ.Model.Model_ErpMemberCardPointsRuleSet> mlist = new List<Model.Model_ErpMemberCardPointsRuleSet>();
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void PointsSetSuperSmallForm_Shown(object sender, EventArgs e)
- {
- //DataTable tbl = bll.GetList("Sconfig_Code = 'PointToRMB'").Tables[0];
- //if (tbl.Rows.Count > 0)
- //{ this.txtPointsToRMB_Points.Text = tbl.Rows[0]["Sconfig_Value"].ToString().Trim(); }
- mlist = mcprbll.GetModelList("");
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void PointsSetSuperSmallForm_Load(object sender, EventArgs e)
- {
- DateTime strTime = SDateTime.Now;
- List<Helper.CommandInfo> clist = null;
- LYFZ.Model.Model_ErpMemberCardPointsRuleSet model = null;
- bool IsWhile = true;
- while (IsWhile)
- {
- clist = new List<Helper.CommandInfo>();
- IsWhile = false;
- DataTable tblPointsRule = mcprbll.GetAllList().Tables[0];
- tblPointsRule.PrimaryKey = new DataColumn[] { tblPointsRule.Columns["Mcprs_Code"] };
- DataRow dtRow = tblPointsRule.Rows.Find("PointToRMB_Point");//积分多少=人民币1元
- if (dtRow != null)
- {
- this.txtPointsToRMB_Points.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow["Mcprs_Value"].ToString().Trim());
- if (dtRow["Mcprs_Type"].ToString().Trim() == "0")
- {
- model = mcprbll.GetModel(Convert.ToInt32(dtRow["ID"]));
- model.Mcprs_Type = "3";
- model.Mcprs_UpdateDatetime = strTime;
- model.Mcprs_UpdateName = strUserID;
- model.Mcprs_CreateDatetime = strTime;
- model.Mcprs_CreateName = strUserID;
- clist.Add(mcprbll.GetUpdateCommandInfo(model));
- IsWhile = true;
- }
- }
- else
- {
- model = new Model.Model_ErpMemberCardPointsRuleSet();
- model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Mcprs_Type = "3";
- model.Mcprs_Code = "PointToRMB_Point";
- model.Mcprs_Name = "积分兑换人民币";
- model.Mcprs_Value = 1;
- model.Mcprs_Remark = "积分多少=人民币1元";
- model.Mcprs_CreateDatetime = strTime;
- model.Mcprs_CreateName = strUserID;
- clist.Add(mcprbll.GetAddCommandInfo(model));
- IsWhile = true;
- }
- DataRow dtRow1 = tblPointsRule.Rows.Find("AgoPeriod_RMB");//前期消费多少元得1积分
- if (dtRow1 != null)
- { this.txtAgoPeriod_RMB.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow1["Mcprs_Value"].ToString().Trim()); }
- else
- {
- model = new Model.Model_ErpMemberCardPointsRuleSet();
- model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Mcprs_Type = "0";
- model.Mcprs_Code = "AgoPeriod_RMB";
- model.Mcprs_Name = "前期消费";
- model.Mcprs_Value = 1;
- model.Mcprs_Remark = "前期消费多少元得1积分";
- model.Mcprs_CreateDatetime = strTime;
- model.Mcprs_CreateName = strUserID;
- clist.Add(mcprbll.GetAddCommandInfo(model));
- IsWhile = true;
- }
- DataRow dtRow2 = tblPointsRule.Rows.Find("LatePeriod_RMB");//后期消费多少元得1积分
- if (dtRow2 != null)
- { this.txtLatePeriod_RMB.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow2["Mcprs_Value"].ToString().Trim()); }
- else
- {
- model = new Model.Model_ErpMemberCardPointsRuleSet();
- model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Mcprs_Type = "0";
- model.Mcprs_Code = "LatePeriod_RMB";
- model.Mcprs_Name = "后期消费";
- model.Mcprs_Value = 1;
- model.Mcprs_Remark = "后期消费多少元得1积分";
- model.Mcprs_CreateDatetime = strTime;
- model.Mcprs_CreateName = strUserID;
- clist.Add(mcprbll.GetAddCommandInfo(model));
- IsWhile = true;
- }
- DataRow dtRow3 = tblPointsRule.Rows.Find("txtReferral_RMB");//转介绍前期消费多少元得1积分
- if (dtRow3 != null)
- { this.txtReferral_RMB.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow3["Mcprs_Value"].ToString().Trim()); }
- else
- {
- model = new Model.Model_ErpMemberCardPointsRuleSet();
- model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Mcprs_Type = "0";
- model.Mcprs_Code = "txtReferral_RMB";
- model.Mcprs_Name = "转介绍前期消费";
- model.Mcprs_Value = 1;
- model.Mcprs_Remark = "转介绍前期消费多少元得1积分";
- model.Mcprs_CreateDatetime = strTime;
- model.Mcprs_CreateName = strUserID;
- clist.Add(mcprbll.GetAddCommandInfo(model));
- IsWhile = true;
- }
- DataRow dtRow4 = tblPointsRule.Rows.Find("Dianqing_Day");//店庆当天
- if (dtRow4 != null)
- { this.txtDianqing_Day.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow4["Mcprs_Value"].ToString().Trim()); }
- else
- {
- model = new Model.Model_ErpMemberCardPointsRuleSet();
- model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Mcprs_Type = "1";
- model.Mcprs_Code = "Dianqing_Day";
- model.Mcprs_Name = "店庆当天";
- model.Mcprs_Value = 0;
- model.Mcprs_Remark = "店庆当天";
- model.Mcprs_CreateDatetime = strTime;
- model.Mcprs_CreateName = strUserID;
- clist.Add(mcprbll.GetAddCommandInfo(model));
- IsWhile = true;
- }
- DataRow dtRow5 = tblPointsRule.Rows.Find("Dianqing_Month");//店庆当月
- if (dtRow5 != null)
- { this.txtDianqing_Month.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow5["Mcprs_Value"].ToString().Trim()); }
- else
- {
- model = new Model.Model_ErpMemberCardPointsRuleSet();
- model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Mcprs_Type = "1";
- model.Mcprs_Code = "Dianqing_Month";
- model.Mcprs_Name = "店庆当月";
- model.Mcprs_Value = 0;
- model.Mcprs_Remark = "店庆当月";
- model.Mcprs_CreateDatetime = strTime;
- model.Mcprs_CreateName = strUserID;
- clist.Add(mcprbll.GetAddCommandInfo(model));
- IsWhile = true;
- }
- DataRow dtRow6 = tblPointsRule.Rows.Find("Birthday_Day");//生日当天
- if (dtRow6 != null)
- { this.txtBirthday_Day.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow6["Mcprs_Value"].ToString().Trim()); }
- else
- {
- model = new Model.Model_ErpMemberCardPointsRuleSet();
- model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Mcprs_Type = "1";
- model.Mcprs_Code = "Birthday_Day";
- model.Mcprs_Name = "生日当天";
- model.Mcprs_Value = 0;
- model.Mcprs_Remark = "生日当天";
- model.Mcprs_CreateDatetime = strTime;
- model.Mcprs_CreateName = strUserID;
- clist.Add(mcprbll.GetAddCommandInfo(model));
- IsWhile = true;
- }
- DataRow dtRow7 = tblPointsRule.Rows.Find("Birthday_Month");//生日当月
- if (dtRow7 != null)
- { this.txtBirthday_Month.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow7["Mcprs_Value"].ToString().Trim()); }
- else
- {
- model = new Model.Model_ErpMemberCardPointsRuleSet();
- model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Mcprs_Type = "1";
- model.Mcprs_Code = "Birthday_Month";
- model.Mcprs_Name = "生日当月";
- model.Mcprs_Value = 0;
- model.Mcprs_Remark = "生日当月";
- model.Mcprs_CreateDatetime = strTime;
- model.Mcprs_CreateName = strUserID;
- clist.Add(mcprbll.GetAddCommandInfo(model));
- IsWhile = true;
- }
- DataRow dtRow8 = tblPointsRule.Rows.Find("WeddingAnniversary_Day");//结婚纪念日当天
- if (dtRow8 != null)
- { this.txtWeddingAnniversary_Day.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow8["Mcprs_Value"].ToString().Trim()); }
- else
- {
- model = new Model.Model_ErpMemberCardPointsRuleSet();
- model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Mcprs_Type = "1";
- model.Mcprs_Code = "WeddingAnniversary_Day";
- model.Mcprs_Name = "结婚纪念日当天";
- model.Mcprs_Value = 0;
- model.Mcprs_Remark = "结婚纪念日当天";
- model.Mcprs_CreateDatetime = strTime;
- model.Mcprs_CreateName = strUserID;
- clist.Add(mcprbll.GetAddCommandInfo(model));
- IsWhile = true;
- }
- DataRow dtRow9 = tblPointsRule.Rows.Find("WeddingAnniversary_Month");//结婚纪念日当月
- if (dtRow9 != null)
- { this.txtWeddingAnniversary_Month.Text = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow9["Mcprs_Value"].ToString().Trim()); }
- else
- {
- model = new Model.Model_ErpMemberCardPointsRuleSet();
- model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Mcprs_Type = "1";
- model.Mcprs_Code = "WeddingAnniversary_Month";
- model.Mcprs_Name = "结婚纪念日当月";
- model.Mcprs_Value = 0;
- model.Mcprs_Remark = "结婚纪念日当月";
- model.Mcprs_CreateDatetime = strTime;
- model.Mcprs_CreateName = strUserID;
- clist.Add(mcprbll.GetAddCommandInfo(model));
- IsWhile = true;
- }
- DataRow dtRow10 = tblPointsRule.Rows.Find("PointsSet_HaveCardPoints");//有卡积分
- if (dtRow10 != null)
- { this.chkHaveCardPoints.Checked = Convert.ToInt32(dtRow10["Mcprs_Value"]) > 0 ? true : false; }
- else
- {
- model = new Model.Model_ErpMemberCardPointsRuleSet();
- model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Mcprs_Type = "4";
- model.Mcprs_Code = "PointsSet_HaveCardPoints";
- model.Mcprs_Name = "有卡积分";
- model.Mcprs_Value = 0;
- model.Mcprs_Remark = "积分设置有卡积分 0:为false不积分;1:为true积分";
- model.Mcprs_CreateDatetime = strTime;
- model.Mcprs_CreateName = strUserID;
- clist.Add(mcprbll.GetAddCommandInfo(model));
- IsWhile = true;
- }
- DataRow dtRow11 = tblPointsRule.Rows.Find("PointsSet_NoCardPoints");//无卡也积分
- if (dtRow11 != null)
- { this.chkNoCardPoints.Checked = Convert.ToInt32(dtRow11["Mcprs_Value"]) > 0 ? true : false; }
- else
- {
- model = new Model.Model_ErpMemberCardPointsRuleSet();
- model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Mcprs_Type = "4";
- model.Mcprs_Code = "PointsSet_NoCardPoints";
- model.Mcprs_Name = "无卡也积分";
- model.Mcprs_Value = 0;
- model.Mcprs_Remark = "积分设置无卡也积分 0:为false不积分;1:为true积分";
- model.Mcprs_CreateDatetime = strTime;
- model.Mcprs_CreateName = strUserID;
- clist.Add(mcprbll.GetAddCommandInfo(model));
- IsWhile = true;
- }
- DataRow[] dtRow12 = tblPointsRule.Select("Mcprs_Type = '2'");//特定日期
- for (int j = 0; j < dtRow12.Length; j++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewCell cell = null;
- cell = new DataGridViewTextBoxCell();
- cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dtRow12[j]["Mcprs_DateStart"].ToString().Trim());
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dtRow12[j]["Mcprs_DateEnd"].ToString().Trim());
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = LYFZ.Command.Command_Validate.RemoveLastExcessZero(dtRow12[j]["Mcprs_Value"].ToString().Trim());
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dtRow12[j]["ID"].ToString().Trim();
- dgvr.Cells.Add(cell);
- this.dgvData.Rows.Add(dgvr);
- }
- if (clist.Count > 0)
- { LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist); }
- }
- }
- /// <summary>
- /// 确定
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnOK_Click(object sender, EventArgs e)
- {
- DateTime strTime = SDateTime.Now;
- List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
- if (string.IsNullOrEmpty(this.txtPointsToRMB_Points.Text.Trim()))
- { MessageBoxCustom.Show("积分换人民币,不能为空!"); return; }
- if (string.IsNullOrEmpty(this.txtAgoPeriod_RMB.Text.Trim()))
- { MessageBoxCustom.Show("前期消费获得积分,不能为空!"); return; }
- if (string.IsNullOrEmpty(this.txtLatePeriod_RMB.Text.Trim()))
- { MessageBoxCustom.Show("后期消费获得积分,不能为空!"); return; }
- if (string.IsNullOrEmpty(this.txtReferral_RMB.Text.Trim()))
- { MessageBoxCustom.Show("转介绍前期消费获得积分,不能为空!"); return; }
- if (string.IsNullOrEmpty(this.txtDianqing_Day.Text.Trim()))
- { MessageBoxCustom.Show("婚庆当天倍数,不能为空!"); return; }
- if (string.IsNullOrEmpty(this.txtDianqing_Month.Text.Trim()))
- { MessageBoxCustom.Show("婚庆当月倍数,不能为空!"); return; }
- if (string.IsNullOrEmpty(this.txtBirthday_Day.Text.Trim()))
- { MessageBoxCustom.Show("生日当天倍数,不能为空!"); return; }
- if (string.IsNullOrEmpty(this.txtBirthday_Month.Text.Trim()))
- { MessageBoxCustom.Show("生日当月倍数,不能为空!"); return; }
- if (string.IsNullOrEmpty(this.txtWeddingAnniversary_Day.Text.Trim()))
- { MessageBoxCustom.Show("结婚纪念日当天倍数,不能为空!"); return; }
- if (string.IsNullOrEmpty(this.txtWeddingAnniversary_Month.Text.Trim()))
- { MessageBoxCustom.Show("结婚纪念日日当月倍数,不能为空!"); return; }
- #region 消费积分设置、节日积分设置
- List<int> ilist = new List<int>();
- for (int i = 0; i < mlist.Count; i++)
- {
- LYFZ.Model.Model_ErpMemberCardPointsRuleSet model = mlist[i];
- if (model.Mcprs_Type.Trim() != "2")
- {
- switch (model.Mcprs_Code.Trim())
- {
- case "PointToRMB_Point":
- model.Mcprs_Value = Convert.ToDecimal(this.txtPointsToRMB_Points.Text);
- break;
- case "AgoPeriod_RMB":
- model.Mcprs_Value = Convert.ToDecimal(this.txtAgoPeriod_RMB.Text);
- break;
- case "LatePeriod_RMB":
- model.Mcprs_Value = Convert.ToDecimal(this.txtLatePeriod_RMB.Text);
- break;
- case "txtReferral_RMB":
- model.Mcprs_Value = Convert.ToDecimal(this.txtReferral_RMB.Text);
- break;
- case "Dianqing_Day":
- model.Mcprs_Value = Convert.ToDecimal(this.txtDianqing_Day.Text);
- break;
- case "Dianqing_Month":
- model.Mcprs_Value = Convert.ToDecimal(this.txtDianqing_Month.Text);
- break;
- case "Birthday_Day":
- model.Mcprs_Value = Convert.ToDecimal(this.txtBirthday_Day.Text);
- break;
- case "Birthday_Month":
- model.Mcprs_Value = Convert.ToDecimal(this.txtBirthday_Month.Text);
- break;
- case "WeddingAnniversary_Day":
- model.Mcprs_Value = Convert.ToDecimal(this.txtWeddingAnniversary_Day.Text);
- break;
- case "WeddingAnniversary_Month":
- model.Mcprs_Value = Convert.ToDecimal(this.txtWeddingAnniversary_Month.Text);
- break;
- case "PointsSet_HaveCardPoints":
- model.Mcprs_Value = this.chkHaveCardPoints.Checked ? 1 : 0;
- break;
- case "PointsSet_NoCardPoints":
- model.Mcprs_Value = this.chkNoCardPoints.Checked ? 1 : 0;
- break;
- }
- model.Mcprs_UpdateDatetime = strTime;
- model.Mcprs_UpdateName = strUserID;
- clist.Add(mcprbll.GetUpdateCommandInfo(model));
- ilist.Add(model.ID);
- }
- }
- for (int i = 0; i < ilist.Count; i++)
- {
- for (int j = 0; j < mlist.Count; j++)
- {
- if (mlist[j].ID == ilist[i])
- { mlist.RemoveAt(j); }
- }
- }
- #endregion
- for (int i = 0; i < this.dgvData.Rows.Count; i++)
- {
- if (this.dgvData.Rows[i].Cells["Column4"].Value.ToString().Trim() != "")//ID是否存在
- {
- if (this.dgvData.Rows[i].Cells["Column4"].Tag != null)//数据是否修改过
- {
- for (int j = 0; j < mlist.Count; j++)
- {
- if (mlist[j].ID.ToString().Trim() == this.dgvData.Rows[i].Cells["Column4"].Value.ToString().Trim())
- {
- LYFZ.Model.Model_ErpMemberCardPointsRuleSet model = mlist[j];
- model.Mcprs_DateStart = Convert.ToDateTime(this.dgvData.Rows[i].Cells["Column1"].Value);
- model.Mcprs_DateEnd = Convert.ToDateTime(this.dgvData.Rows[i].Cells["Column2"].Value);
- model.Mcprs_Value = Convert.ToDecimal(this.dgvData.Rows[i].Cells["Column3"].Value);
- model.Mcprs_UpdateDatetime = strTime;
- model.Mcprs_UpdateName = strUserID;
- clist.Add(mcprbll.GetUpdateCommandInfo(model));
- break;
- }
- }
- }
- }
- else
- {
- LYFZ.Model.Model_ErpMemberCardPointsRuleSet model = new Model.Model_ErpMemberCardPointsRuleSet();
- model.Mcprs_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Mcprs_Type = "2";
- model.Mcprs_Code = "[" + this.dgvData.Rows[i].Cells["Column1"].Value + "]-[" + this.dgvData.Rows[i].Cells["Column2"].Value + "]";
- 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") + "]";
- model.Mcprs_DateStart = Convert.ToDateTime(this.dgvData.Rows[i].Cells["Column1"].Value);
- model.Mcprs_DateEnd = Convert.ToDateTime(this.dgvData.Rows[i].Cells["Column2"].Value);
- model.Mcprs_Value = Convert.ToDecimal(this.dgvData.Rows[i].Cells["Column3"].Value);
- model.Mcprs_Remark = "特定日期[" + this.dgvData.Rows[i].Cells["Column1"].Value + "]-[" + this.dgvData.Rows[i].Cells["Column2"].Value + "]得" + this.dgvData.Rows[i].Cells["Column3"].Value + "积分";
- model.Mcprs_CreateDatetime = strTime;
- model.Mcprs_CreateName = "";
- clist.Add(mcprbll.GetAddCommandInfo(model));
- }
- }
- if (clist.Count > 0)
- {
- if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0)
- { MessageBoxCustom.Show("保存失败"); }
- LYFZ.BLL.BLL_ErpMemberCard.AgainGettblPointsRule();
- MessageBoxCustom.Show("保存成功");
- this.Close();
- }
- }
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnClose_Click(object sender, EventArgs e)
- { this.Close(); }
- /// <summary>
- /// 有卡积分
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkHaveCardPoints_Click(object sender, EventArgs e)
- {
- if (!this.chkHaveCardPoints.Checked)
- { this.chkNoCardPoints.Checked = false; }
- }
- /// <summary>
- /// 无卡也积分
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkNoCardPoints_Click(object sender, EventArgs e)
- {
- if (!this.chkHaveCardPoints.Checked)
- { this.chkHaveCardPoints.Checked = true; }
- }
- /// <summary>
- /// 删除特定日期
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnDelete_Click(object sender, EventArgs e)
- {
- if (this.dgvData.Rows.Count > 0)
- {
- if (this.dgvData.CurrentCell.ColumnIndex >= 0 && this.dgvData.CurrentRow.Index >= 0)
- {
- if (MessageBoxCustom.Show("删除后则不能恢复,你确定要删除吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- { return; }
- this.dgvData.Rows.RemoveAt(this.dgvData.CurrentRow.Index);
- }
- }
- }
- /// <summary>
- /// 添加特定日期
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnAddDate_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm.ParticularDateSetSetSuperSmallForm frm = new ParticularDateSetSetSuperSmallForm();
- frm.mlist = this.mlist;
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewCell cell = null;
- cell = new DataGridViewTextBoxCell();
- cell.Value = frm.strStartDate.Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = frm.strEndDate.Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = frm.strValue.Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = "";
- dgvr.Cells.Add(cell);
- this.dgvData.Rows.Add(dgvr);
- }
- }
- LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm.PointsRuleMultipleTestSuperSmallForm frm = null;
- /// <summary>
- /// 测试
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnTest_Click(object sender, EventArgs e)
- {
- if (frm != null)
- { frm.Close(); }
- frm = new PointsRuleMultipleTestSuperSmallForm();
- frm.Show();
- }
- /// <summary>
- /// 列表双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void dgvData_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- if (this.dgvData.Rows.Count > 0)
- {
- if (this.dgvData.CurrentRow.Index >= 0 && this.dgvData.CurrentCell.ColumnIndex >= 0)
- {
- LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm.ParticularDateSetSetSuperSmallForm frm = new ParticularDateSetSetSuperSmallForm();
- frm.mlist = this.mlist;
- frm.strID = this.dgvData.CurrentRow.Cells["Column4"].Value.ToString().Trim();
- frm.strStartDate = this.dgvData.CurrentRow.Cells["Column1"].Value.ToString().Trim();
- frm.strEndDate = this.dgvData.CurrentRow.Cells["Column2"].Value.ToString().Trim();
- frm.strValue = this.dgvData.CurrentRow.Cells["Column3"].Value.ToString().Trim();
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- this.dgvData.CurrentRow.Cells["Column1"].Value = frm.strStartDate.Trim();
- this.dgvData.CurrentRow.Cells["Column2"].Value = frm.strEndDate.Trim();
- this.dgvData.CurrentRow.Cells["Column3"].Value = frm.strValue.Trim();
- this.dgvData.CurrentRow.Cells["Column4"].Tag = "1";
- }
- }
- }
- }
- /// <summary>
- /// 前期消费_积分限制输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtAgoPeriod_Points_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- /// <summary>
- /// 前期消费_人民币限制输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtAgoPeriod_RMB_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- /// <summary>
- /// 生日_当天限制输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtBirthday_Day_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (Convert.ToString(e.KeyChar) == ".")
- {
- if (this.txtBirthday_Day.Text.Trim().IndexOf('.') != -1)
- { e.Handled = true; }
- }
- else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- /// <summary>
- /// 生日_当月限制输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtBirthday_Month_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (Convert.ToString(e.KeyChar) == ".")
- {
- if (this.txtBirthday_Month.Text.Trim().IndexOf('.') != -1)
- { e.Handled = true; }
- }
- else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- /// <summary>
- /// 店庆_当天限制输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtDianqing_Day_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (Convert.ToString(e.KeyChar) == ".")
- {
- if (this.txtDianqing_Day.Text.Trim().IndexOf('.') != -1)
- { e.Handled = true; }
- }
- else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- /// <summary>
- /// 店庆_当月限制输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtDianqing_Month_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (Convert.ToString(e.KeyChar) == ".")
- {
- if (this.txtDianqing_Month.Text.Trim().IndexOf('.') != -1)
- { e.Handled = true; }
- }
- else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- /// <summary>
- /// 后期消费_积分限制输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtLatePeriod_Points_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- /// <summary>
- /// 后期消费_人民币限制输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtLatePeriod_RMB_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- /// <summary>
- /// 积分换人民币_积分限制输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtPointsToRMB_Points_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- /// <summary>
- /// 积分换人民币_人民币限制输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtPointsToRMB_RMB_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- /// <summary>
- /// 转介绍_积分限制输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtReferral_Points_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- /// <summary>
- /// 转介绍_人民币限制输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtReferral_RMB_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- /// <summary>
- /// 结婚纪念日当天限制输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtWeddingAnniversary_Day_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (Convert.ToString(e.KeyChar) == ".")
- {
- if (this.txtWeddingAnniversary_Day.Text.Trim().IndexOf('.') != -1)
- { e.Handled = true; }
- }
- else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- /// <summary>
- /// 结婚纪念日当月限制输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtWeddingAnniversary_Month_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (Convert.ToString(e.KeyChar) == ".")
- {
- if (this.txtWeddingAnniversary_Month.Text.Trim().IndexOf('.') != -1)
- { e.Handled = true; }
- }
- else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- }
- }
|