123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- using LYFZ.Helper;
- 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 OpenViceCardSuperSmallForm : LYFZ.Software.UI.MembershipManage.SuperSmallForm.OpenViceCardSuperSmallForm
- {
- public OpenViceCardSuperSmallForm()
- {
- }
- LYFZ.BLL.BLL_ErpMemberCard mcbll = new BLL.BLL_ErpMemberCard();
- LYFZ.BLL.BLL_ErpMemberCardViceCard mcvcbll = new BLL.BLL_ErpMemberCardViceCard();
- /// <summary>
- /// 会员编号
- /// </summary>
- public string StrNumber;
- /// <summary>
- /// 会员卡号
- /// </summary>
- public string StrCradNumber;
- /// <summary>
- /// 持卡人
- /// </summary>
- public string StrCradName;
- public bool IsSaveed = false;
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void OpenViceCardSuperSmallForm_Load(object sender, EventArgs e)
- {
- this.txtMainCardNumber.Text = this.StrCradNumber;
- this.txtCardName.Text = this.StrCradName;
- }
- /// <summary>
- /// 确定
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnOK_Click(object sender, EventArgs e)
- {
- Hashtable htData = new Hashtable();
- int inputCount = 0;
- if (this.txtviceCardNumber1.Text.Trim().Length > 0)
- {
- htData[this.txtviceCardNumber1.Text.Trim()] = 1; ;
- inputCount++; }
- if (this.txtviceCardNumber2.Text.Trim().Length > 0)
- {
- htData[this.txtviceCardNumber2.Text.Trim()] = 1; ;
- inputCount++;
- }
- if (this.txtviceCardNumber3.Text.Trim().Length > 0)
- {
- htData[this.txtviceCardNumber3.Text.Trim()] = 1; ;
- inputCount++;
- }
- if (this.txtviceCardNumber4.Text.Trim().Length > 0)
- {
- htData[this.txtviceCardNumber4.Text.Trim()] = 1; ;
- inputCount++;
- }
- if (this.txtviceCardNumber5.Text.Trim().Length > 0)
- {
- htData[this.txtviceCardNumber5.Text.Trim()] = 1; ;
- inputCount++;
- }
- if (inputCount != htData.Count)
- { MessageBoxCustom.Show("输入的副卡中有重复一样的副卡卡号!"); return; }
- if (mcbll.GetMemberCard("Mc_Number", "Mc_Number = '" + this.StrNumber + "' and Mc_Status = '1'").Tables[0].Rows.Count > 0)
- {
- string StrCardType = "积分副卡";
- DateTime StrTime = SDateTime.Now;
- string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- string StrMcNumber =LYFZ.BLL.BLL_ErpMemberCard.GetViceCardLastViceNumber();
- DataTable tbl = mcvcbll.GetMemberViceCard("Mvc_ViceCardNumber", " Mvc_Status='1'").Tables[0];
- LYFZ.Model.Model_ErpMemberCardViceCard model = null;
- List<CommandInfo> clist = new List<CommandInfo>();
- int NumberCount = 1;
- if (this.txtviceCardNumber1.Text.Trim() != "")
- {
- model = new Model.Model_ErpMemberCardViceCard();
- model.Mvc_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Mvc_ViceNumber = LYFZ.BLL.BLL_ErpMemberCard.GetNewViceCardNumber(StrMcNumber, ref NumberCount);
- model.Mvc_Number = this.StrNumber;
- model.Mvc_ViceCardNumber = this.txtviceCardNumber1.Text.Trim();
- model.Mvc_ViceCardType = StrCardType;
- model.Mvc_ViceMoney = 0;
- model.Mvc_ViceTraderPassword = "";
- model.Mvc_Status = "1";
- model.Mvc_UsedNumber = "";
- model.Mvc_Remark = "";
- model.Mvc_CashBackGroup = -1;
- model.Mvc_CreateDatetime = StrTime;
- model.Mvc_CreateName = StrUserName;
- clist.Add(mcvcbll.GetAddCommandInfo(model));
- if (tbl.Select("Mvc_ViceCardNumber ='" + this.txtviceCardNumber1.Text.Trim() + "'").Length > 0)
- { MessageBoxCustom.Show("副卡号" + this.txtviceCardNumber1.Text.Trim() + "已被其他人占用,并正在使用!\r\n请换个卡号!"); return; }
- }
- if (this.txtviceCardNumber2.Text.Trim() != "")
- {
- model = new Model.Model_ErpMemberCardViceCard();
- model.Mvc_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Mvc_ViceNumber = LYFZ.BLL.BLL_ErpMemberCard.GetNewViceCardNumber(StrMcNumber, ref NumberCount);
- model.Mvc_Number = this.StrNumber;
- model.Mvc_ViceCardNumber = this.txtviceCardNumber2.Text.Trim();
- model.Mvc_ViceCardType = StrCardType;
- model.Mvc_ViceMoney = 0;
- model.Mvc_ViceTraderPassword = "";
- model.Mvc_Status = "1";
- model.Mvc_UsedNumber = "";
- model.Mvc_Remark = "";
- model.Mvc_CashBackGroup = -1;
- model.Mvc_CreateDatetime = StrTime;
- model.Mvc_CreateName = StrUserName;
- clist.Add(mcvcbll.GetAddCommandInfo(model));
- if (tbl.Select("Mvc_ViceCardNumber ='" + this.txtviceCardNumber2.Text.Trim() + "'").Length > 0)
- { MessageBoxCustom.Show("副卡号" + this.txtviceCardNumber2.Text.Trim() + "已被其他人占用,并正在使用!\r\n请换个卡号!"); return; }
- }
- if (this.txtviceCardNumber3.Text.Trim() != "")
- {
- model = new Model.Model_ErpMemberCardViceCard();
- model.Mvc_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Mvc_ViceNumber = LYFZ.BLL.BLL_ErpMemberCard.GetNewViceCardNumber(StrMcNumber, ref NumberCount);
- model.Mvc_Number = this.StrNumber;
- model.Mvc_ViceCardNumber = this.txtviceCardNumber3.Text.Trim();
- model.Mvc_ViceCardType = StrCardType;
- model.Mvc_ViceMoney = 0;
- model.Mvc_ViceTraderPassword = "";
- model.Mvc_Status = "1";
- model.Mvc_UsedNumber = "";
- model.Mvc_Remark = "";
- model.Mvc_CashBackGroup = -1;
- model.Mvc_CreateDatetime = StrTime;
- model.Mvc_CreateName = StrUserName;
- clist.Add(mcvcbll.GetAddCommandInfo(model));
- if (tbl.Select("Mvc_ViceCardNumber ='" + this.txtviceCardNumber3.Text.Trim() + "'").Length > 0)
- { MessageBoxCustom.Show("副卡号" + this.txtviceCardNumber3.Text.Trim() + "已被其他人占用,并正在使用!\r\n请换个卡号!"); return; }
- }
- if (this.txtviceCardNumber4.Text.Trim() != "")
- {
- model = new Model.Model_ErpMemberCardViceCard();
- model.Mvc_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Mvc_ViceNumber = LYFZ.BLL.BLL_ErpMemberCard.GetNewViceCardNumber(StrMcNumber, ref NumberCount);
- model.Mvc_Number = this.StrNumber;
- model.Mvc_ViceCardNumber = this.txtviceCardNumber4.Text.Trim();
- model.Mvc_ViceCardType = StrCardType;
- model.Mvc_ViceMoney = 0;
- model.Mvc_ViceTraderPassword = "";
- model.Mvc_Status = "1";
- model.Mvc_UsedNumber = "";
- model.Mvc_Remark = "";
- model.Mvc_CashBackGroup = -1;
- model.Mvc_CreateDatetime = StrTime;
- model.Mvc_CreateName = StrUserName;
- clist.Add(mcvcbll.GetAddCommandInfo(model));
- if (tbl.Select("Mvc_ViceCardNumber ='" + this.txtviceCardNumber4.Text.Trim() + "'").Length > 0)
- { MessageBoxCustom.Show("副卡号" + this.txtviceCardNumber4.Text.Trim() + "已被其他人占用,并正在使用!\r\n请换个卡号!"); return; }
- }
- if (this.txtviceCardNumber5.Text.Trim() != "")
- {
- model = new Model.Model_ErpMemberCardViceCard();
- model.Mvc_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Mvc_ViceNumber = LYFZ.BLL.BLL_ErpMemberCard.GetNewViceCardNumber(StrMcNumber, ref NumberCount);
- model.Mvc_Number = this.StrNumber;
- model.Mvc_ViceCardNumber = this.txtviceCardNumber5.Text.Trim();
- model.Mvc_ViceCardType = StrCardType;
- model.Mvc_ViceMoney = 0;
- model.Mvc_ViceTraderPassword = "";
- model.Mvc_Status = "1";
- model.Mvc_UsedNumber = "";
- model.Mvc_Remark = "";
- model.Mvc_CashBackGroup = -1;
- model.Mvc_CreateDatetime = StrTime;
- model.Mvc_CreateName = StrUserName;
- clist.Add(mcvcbll.GetAddCommandInfo(model));
- if (tbl.Select("Mvc_ViceCardNumber ='" + this.txtviceCardNumber5.Text.Trim() + "'").Length > 0)
- { MessageBoxCustom.Show("副卡号" + this.txtviceCardNumber5.Text.Trim() + "已被其他人占用,并正在使用!\r\n请换个卡号!"); return; }
- }
- if (clist.Count > 0)
- {
- if (MessageBoxCustom.Show("您确定要发放以上副卡吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
- {
- MessageBoxCustom.Show("发放副卡成功");
- IsSaveed = true;
- this.Close();
- }
- else
- { MessageBoxCustom.Show("发放副卡失败"); }
- }
- }
- }
- else
- { MessageBoxCustom.Show("主卡号不存在或已注销,不能发放副卡"); }
- }
- /// <summary>
- /// 取消
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnCancel_Click(object sender, EventArgs e)
- { this.Close(); }
- }
- }
|