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();
///
/// 会员编号
///
public string StrNumber;
///
/// 会员卡号
///
public string StrCradNumber;
///
/// 持卡人
///
public string StrCradName;
public bool IsSaveed = false;
///
/// 窗体加载事件
///
///
///
protected override void OpenViceCardSuperSmallForm_Load(object sender, EventArgs e)
{
this.txtMainCardNumber.Text = this.StrCradNumber;
this.txtCardName.Text = this.StrCradName;
}
///
/// 确定
///
///
///
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 clist = new List();
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("主卡号不存在或已注销,不能发放副卡"); }
}
///
/// 取消
///
///
///
protected override void btnCancel_Click(object sender, EventArgs e)
{ this.Close(); }
}
}