OpenViceCardSuperSmallForm.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. using LYFZ.Helper;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Windows.Forms;
  11. namespace LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm
  12. {
  13. public partial class OpenViceCardSuperSmallForm : LYFZ.Software.UI.MembershipManage.SuperSmallForm.OpenViceCardSuperSmallForm
  14. {
  15. public OpenViceCardSuperSmallForm()
  16. {
  17. }
  18. LYFZ.BLL.BLL_ErpMemberCard mcbll = new BLL.BLL_ErpMemberCard();
  19. LYFZ.BLL.BLL_ErpMemberCardViceCard mcvcbll = new BLL.BLL_ErpMemberCardViceCard();
  20. /// <summary>
  21. /// 会员编号
  22. /// </summary>
  23. public string StrNumber;
  24. /// <summary>
  25. /// 会员卡号
  26. /// </summary>
  27. public string StrCradNumber;
  28. /// <summary>
  29. /// 持卡人
  30. /// </summary>
  31. public string StrCradName;
  32. public bool IsSaveed = false;
  33. /// <summary>
  34. /// 窗体加载事件
  35. /// </summary>
  36. /// <param name="sender"></param>
  37. /// <param name="e"></param>
  38. protected override void OpenViceCardSuperSmallForm_Load(object sender, EventArgs e)
  39. {
  40. this.txtMainCardNumber.Text = this.StrCradNumber;
  41. this.txtCardName.Text = this.StrCradName;
  42. }
  43. /// <summary>
  44. /// 确定
  45. /// </summary>
  46. /// <param name="sender"></param>
  47. /// <param name="e"></param>
  48. protected override void btnOK_Click(object sender, EventArgs e)
  49. {
  50. Hashtable htData = new Hashtable();
  51. int inputCount = 0;
  52. if (this.txtviceCardNumber1.Text.Trim().Length > 0)
  53. {
  54. htData[this.txtviceCardNumber1.Text.Trim()] = 1; ;
  55. inputCount++; }
  56. if (this.txtviceCardNumber2.Text.Trim().Length > 0)
  57. {
  58. htData[this.txtviceCardNumber2.Text.Trim()] = 1; ;
  59. inputCount++;
  60. }
  61. if (this.txtviceCardNumber3.Text.Trim().Length > 0)
  62. {
  63. htData[this.txtviceCardNumber3.Text.Trim()] = 1; ;
  64. inputCount++;
  65. }
  66. if (this.txtviceCardNumber4.Text.Trim().Length > 0)
  67. {
  68. htData[this.txtviceCardNumber4.Text.Trim()] = 1; ;
  69. inputCount++;
  70. }
  71. if (this.txtviceCardNumber5.Text.Trim().Length > 0)
  72. {
  73. htData[this.txtviceCardNumber5.Text.Trim()] = 1; ;
  74. inputCount++;
  75. }
  76. if (inputCount != htData.Count)
  77. { MessageBoxCustom.Show("输入的副卡中有重复一样的副卡卡号!"); return; }
  78. if (mcbll.GetMemberCard("Mc_Number", "Mc_Number = '" + this.StrNumber + "' and Mc_Status = '1'").Tables[0].Rows.Count > 0)
  79. {
  80. string StrCardType = "积分副卡";
  81. DateTime StrTime = SDateTime.Now;
  82. string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  83. string StrMcNumber =LYFZ.BLL.BLL_ErpMemberCard.GetViceCardLastViceNumber();
  84. DataTable tbl = mcvcbll.GetMemberViceCard("Mvc_ViceCardNumber", " Mvc_Status='1'").Tables[0];
  85. LYFZ.Model.Model_ErpMemberCardViceCard model = null;
  86. List<CommandInfo> clist = new List<CommandInfo>();
  87. int NumberCount = 1;
  88. if (this.txtviceCardNumber1.Text.Trim() != "")
  89. {
  90. model = new Model.Model_ErpMemberCardViceCard();
  91. model.Mvc_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  92. model.Mvc_ViceNumber = LYFZ.BLL.BLL_ErpMemberCard.GetNewViceCardNumber(StrMcNumber, ref NumberCount);
  93. model.Mvc_Number = this.StrNumber;
  94. model.Mvc_ViceCardNumber = this.txtviceCardNumber1.Text.Trim();
  95. model.Mvc_ViceCardType = StrCardType;
  96. model.Mvc_ViceMoney = 0;
  97. model.Mvc_ViceTraderPassword = "";
  98. model.Mvc_Status = "1";
  99. model.Mvc_UsedNumber = "";
  100. model.Mvc_Remark = "";
  101. model.Mvc_CashBackGroup = -1;
  102. model.Mvc_CreateDatetime = StrTime;
  103. model.Mvc_CreateName = StrUserName;
  104. clist.Add(mcvcbll.GetAddCommandInfo(model));
  105. if (tbl.Select("Mvc_ViceCardNumber ='" + this.txtviceCardNumber1.Text.Trim() + "'").Length > 0)
  106. { MessageBoxCustom.Show("副卡号" + this.txtviceCardNumber1.Text.Trim() + "已被其他人占用,并正在使用!\r\n请换个卡号!"); return; }
  107. }
  108. if (this.txtviceCardNumber2.Text.Trim() != "")
  109. {
  110. model = new Model.Model_ErpMemberCardViceCard();
  111. model.Mvc_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  112. model.Mvc_ViceNumber = LYFZ.BLL.BLL_ErpMemberCard.GetNewViceCardNumber(StrMcNumber, ref NumberCount);
  113. model.Mvc_Number = this.StrNumber;
  114. model.Mvc_ViceCardNumber = this.txtviceCardNumber2.Text.Trim();
  115. model.Mvc_ViceCardType = StrCardType;
  116. model.Mvc_ViceMoney = 0;
  117. model.Mvc_ViceTraderPassword = "";
  118. model.Mvc_Status = "1";
  119. model.Mvc_UsedNumber = "";
  120. model.Mvc_Remark = "";
  121. model.Mvc_CashBackGroup = -1;
  122. model.Mvc_CreateDatetime = StrTime;
  123. model.Mvc_CreateName = StrUserName;
  124. clist.Add(mcvcbll.GetAddCommandInfo(model));
  125. if (tbl.Select("Mvc_ViceCardNumber ='" + this.txtviceCardNumber2.Text.Trim() + "'").Length > 0)
  126. { MessageBoxCustom.Show("副卡号" + this.txtviceCardNumber2.Text.Trim() + "已被其他人占用,并正在使用!\r\n请换个卡号!"); return; }
  127. }
  128. if (this.txtviceCardNumber3.Text.Trim() != "")
  129. {
  130. model = new Model.Model_ErpMemberCardViceCard();
  131. model.Mvc_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  132. model.Mvc_ViceNumber = LYFZ.BLL.BLL_ErpMemberCard.GetNewViceCardNumber(StrMcNumber, ref NumberCount);
  133. model.Mvc_Number = this.StrNumber;
  134. model.Mvc_ViceCardNumber = this.txtviceCardNumber3.Text.Trim();
  135. model.Mvc_ViceCardType = StrCardType;
  136. model.Mvc_ViceMoney = 0;
  137. model.Mvc_ViceTraderPassword = "";
  138. model.Mvc_Status = "1";
  139. model.Mvc_UsedNumber = "";
  140. model.Mvc_Remark = "";
  141. model.Mvc_CashBackGroup = -1;
  142. model.Mvc_CreateDatetime = StrTime;
  143. model.Mvc_CreateName = StrUserName;
  144. clist.Add(mcvcbll.GetAddCommandInfo(model));
  145. if (tbl.Select("Mvc_ViceCardNumber ='" + this.txtviceCardNumber3.Text.Trim() + "'").Length > 0)
  146. { MessageBoxCustom.Show("副卡号" + this.txtviceCardNumber3.Text.Trim() + "已被其他人占用,并正在使用!\r\n请换个卡号!"); return; }
  147. }
  148. if (this.txtviceCardNumber4.Text.Trim() != "")
  149. {
  150. model = new Model.Model_ErpMemberCardViceCard();
  151. model.Mvc_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  152. model.Mvc_ViceNumber = LYFZ.BLL.BLL_ErpMemberCard.GetNewViceCardNumber(StrMcNumber, ref NumberCount);
  153. model.Mvc_Number = this.StrNumber;
  154. model.Mvc_ViceCardNumber = this.txtviceCardNumber4.Text.Trim();
  155. model.Mvc_ViceCardType = StrCardType;
  156. model.Mvc_ViceMoney = 0;
  157. model.Mvc_ViceTraderPassword = "";
  158. model.Mvc_Status = "1";
  159. model.Mvc_UsedNumber = "";
  160. model.Mvc_Remark = "";
  161. model.Mvc_CashBackGroup = -1;
  162. model.Mvc_CreateDatetime = StrTime;
  163. model.Mvc_CreateName = StrUserName;
  164. clist.Add(mcvcbll.GetAddCommandInfo(model));
  165. if (tbl.Select("Mvc_ViceCardNumber ='" + this.txtviceCardNumber4.Text.Trim() + "'").Length > 0)
  166. { MessageBoxCustom.Show("副卡号" + this.txtviceCardNumber4.Text.Trim() + "已被其他人占用,并正在使用!\r\n请换个卡号!"); return; }
  167. }
  168. if (this.txtviceCardNumber5.Text.Trim() != "")
  169. {
  170. model = new Model.Model_ErpMemberCardViceCard();
  171. model.Mvc_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  172. model.Mvc_ViceNumber = LYFZ.BLL.BLL_ErpMemberCard.GetNewViceCardNumber(StrMcNumber, ref NumberCount);
  173. model.Mvc_Number = this.StrNumber;
  174. model.Mvc_ViceCardNumber = this.txtviceCardNumber5.Text.Trim();
  175. model.Mvc_ViceCardType = StrCardType;
  176. model.Mvc_ViceMoney = 0;
  177. model.Mvc_ViceTraderPassword = "";
  178. model.Mvc_Status = "1";
  179. model.Mvc_UsedNumber = "";
  180. model.Mvc_Remark = "";
  181. model.Mvc_CashBackGroup = -1;
  182. model.Mvc_CreateDatetime = StrTime;
  183. model.Mvc_CreateName = StrUserName;
  184. clist.Add(mcvcbll.GetAddCommandInfo(model));
  185. if (tbl.Select("Mvc_ViceCardNumber ='" + this.txtviceCardNumber5.Text.Trim() + "'").Length > 0)
  186. { MessageBoxCustom.Show("副卡号" + this.txtviceCardNumber5.Text.Trim() + "已被其他人占用,并正在使用!\r\n请换个卡号!"); return; }
  187. }
  188. if (clist.Count > 0)
  189. {
  190. if (MessageBoxCustom.Show("您确定要发放以上副卡吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  191. {
  192. if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
  193. {
  194. MessageBoxCustom.Show("发放副卡成功");
  195. IsSaveed = true;
  196. this.Close();
  197. }
  198. else
  199. { MessageBoxCustom.Show("发放副卡失败"); }
  200. }
  201. }
  202. }
  203. else
  204. { MessageBoxCustom.Show("主卡号不存在或已注销,不能发放副卡"); }
  205. }
  206. /// <summary>
  207. /// 取消
  208. /// </summary>
  209. /// <param name="sender"></param>
  210. /// <param name="e"></param>
  211. protected override void btnCancel_Click(object sender, EventArgs e)
  212. { this.Close(); }
  213. }
  214. }