ServiceConsumeHomeSmallForm.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. using LYFZ.Software.MainBusiness.DoorCityProcess;
  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
  12. {
  13. public partial class ServiceConsumeHomeSmallForm : LYFZ.Software.UI.MembershipManage.ServiceConsumeHomeSmallForm
  14. {
  15. LYFZ.BLL.BLL_ErpMemberCard mcbll = new BLL.BLL_ErpMemberCard();
  16. LYFZ.BLL.BLL_ErpSMSRecord rbll = new LYFZ.BLL.BLL_ErpSMSRecord();
  17. LYFZ.BLL.BLL_ErpSystemConfigure sgbll = new BLL.BLL_ErpSystemConfigure();
  18. LYFZ.BLL.BLL_ErpMemberCardServiceContent mcscbll = new BLL.BLL_ErpMemberCardServiceContent();
  19. LYFZ.BLL.BLL_ErpMemberCardServiceContentUseLog mcsculog = new BLL.BLL_ErpMemberCardServiceContentUseLog();
  20. public ServiceConsumeHomeSmallForm()
  21. {
  22. }
  23. /// <summary>
  24. /// 当前的会员编号
  25. /// </summary>
  26. string StrNumber = "";
  27. /// <summary>
  28. /// 窗体加载事件
  29. /// </summary>
  30. /// <param name="sender"></param>
  31. /// <param name="e"></param>
  32. protected override void ServiceConsumeHomeSmallForm_Shown(object sender, EventArgs e)
  33. {
  34. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.HidePhoneControls(this.txtTelephone);
  35. if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.MemberManage, LYFZ.CustomAttributes.OperatingAuthority.Member_ServiceKoufei))
  36. { this.btnKoufei.Enabled = false; }
  37. if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.MemberManage, LYFZ.CustomAttributes.OperatingAuthority.Member_Recharge))
  38. { this.btnRecharge.Enabled = false; this.btnServiceToolbox.Enabled = false; }
  39. }
  40. /// <summary>
  41. /// 手机号码
  42. /// </summary>
  43. /// <param name="sender"></param>
  44. /// <param name="e"></param>
  45. protected override void txtTelephone_KeyDown(object sender, KeyEventArgs e)
  46. {
  47. if (e.KeyCode == Keys.Enter)
  48. {
  49. string strTelephone = PublicCodeClasses.MaskedTextBoxExGetText(this.txtTelephone);
  50. this.txtHolder.Text = "";
  51. this.txtDiscount.Text = "";
  52. this.txtMemberCardNumber.Text = "";
  53. this.StrNumber = "";
  54. this.dgvData.Rows.Clear();
  55. if (strTelephone != "")
  56. {
  57. DataTable tbl = mcbll.GetView_Custom("BView_MemberMain_GoldMember", StrWhere: " 电话 = '" + strTelephone + "' and Mc_Status = '1'", ShowColumnName: "Mc_Number,会员卡号,姓名,电话,金额,折扣").Tables[0];
  58. if (tbl.Rows.Count > 0)
  59. {
  60. DataRow dtRow = null;
  61. if (tbl.Rows.Count > 1)
  62. {
  63. LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm.SelectMemberCardSuperSmallForm frm = new SuperSmallForm.SelectMemberCardSuperSmallForm();
  64. frm.dtDataTable = tbl;
  65. frm.ShowDialog();
  66. if (frm.IsSaveed)
  67. { dtRow = frm.dtRow; }
  68. else
  69. { return; }
  70. }
  71. else
  72. { dtRow = tbl.Rows[0]; }
  73. this.txtMemberCardNumber.Text = dtRow["会员卡号"].ToString().Trim();
  74. this.txtHolder.Text = dtRow["姓名"].ToString().Trim();
  75. this.txtTelephone.Text = dtRow["电话"].ToString().Trim();
  76. this.txtAmount.Text = dtRow["金额"].ToString().Trim();
  77. this.txtDiscount.Text = dtRow["折扣"].ToString().Trim();
  78. this.StrNumber = dtRow["Mc_Number"].ToString().Trim();
  79. tbl = mcscbll.GetServiceContent_Left_ServiceContentSet("Mcse_Number = '" + dtRow["Mc_Number"].ToString().Trim() + "'").Tables[0];
  80. for (int i = 0; i < tbl.Rows.Count; i++)
  81. {
  82. DataGridViewRow dgvr = new DataGridViewRow();
  83. DataGridViewCell cell = null;
  84. cell = new DataGridViewCheckBoxCell();
  85. cell.Value = false;
  86. dgvr.Cells.Add(cell);
  87. cell = new DataGridViewTextBoxCell();
  88. cell.Value = tbl.Rows[i]["ID"].ToString().Trim();
  89. dgvr.Cells.Add(cell);
  90. cell = new DataGridViewTextBoxCell();
  91. cell.Value = tbl.Rows[i]["Mcse_MemberServiceNumber"].ToString().Trim();
  92. dgvr.Cells.Add(cell);
  93. cell = new DataGridViewTextBoxCell();
  94. cell.Value = tbl.Rows[i]["Mcse_ServiceContent"].ToString().Trim();
  95. dgvr.Cells.Add(cell);
  96. cell = new DataGridViewTextBoxCell();
  97. cell.Value = tbl.Rows[i]["Mcse_ServiceCount"].ToString().Trim();
  98. dgvr.Cells.Add(cell);
  99. cell = new DataGridViewTextBoxCell();
  100. cell.Value = string.IsNullOrEmpty(tbl.Rows[i]["Msc_MemberServiceNumber"].ToString_s()) ? "该服务已移除" : "";
  101. dgvr.Cells.Add(cell);
  102. this.dgvData.Rows.Add(dgvr);
  103. }
  104. }
  105. }
  106. }
  107. }
  108. /// <summary>
  109. /// 会员卡
  110. /// </summary>
  111. /// <param name="sender"></param>
  112. /// <param name="e"></param>
  113. protected override void txtMemberCardNumber_KeyDown(object sender, KeyEventArgs e)
  114. {
  115. if (e.KeyCode == Keys.Enter)
  116. {
  117. if (txtMemberCardNumber.Text.Trim() != "")
  118. {
  119. DataTable tbl = mcbll.GetView_Custom("BView_MemberMain_GoldMember", StrWhere: " 会员卡号 = '" + txtMemberCardNumber.Text.Trim() + "' and Mc_Status = '1'", ShowColumnName: "Mc_Number,会员卡号,姓名,电话,金额,折扣").Tables[0];
  120. this.txtHolder.Text = "";
  121. this.txtTelephone.Text = "";
  122. this.txtDiscount.Text = "";
  123. this.StrNumber = "";
  124. this.dgvData.Rows.Clear();
  125. if (tbl.Rows.Count > 0)
  126. {
  127. this.txtMemberCardNumber.Text = tbl.Rows[0]["会员卡号"].ToString().Trim();
  128. this.txtHolder.Text = tbl.Rows[0]["姓名"].ToString().Trim();
  129. this.txtTelephone.Text = tbl.Rows[0]["电话"].ToString().Trim();
  130. this.txtAmount.Text = tbl.Rows[0]["金额"].ToString().Trim();
  131. this.txtDiscount.Text = tbl.Rows[0]["折扣"].ToString().Trim();
  132. this.StrNumber = tbl.Rows[0]["Mc_Number"].ToString().Trim();
  133. tbl = mcscbll.GetServiceContent_Left_ServiceContentSet("Mcse_Number = '" + tbl.Rows[0]["Mc_Number"].ToString().Trim() + "'").Tables[0];
  134. for (int i = 0; i < tbl.Rows.Count; i++)
  135. {
  136. DataGridViewRow dgvr = new DataGridViewRow();
  137. DataGridViewCell cell = null;
  138. cell = new DataGridViewCheckBoxCell();
  139. cell.Value = false;
  140. dgvr.Cells.Add(cell);
  141. cell = new DataGridViewTextBoxCell();
  142. cell.Value = tbl.Rows[i]["ID"].ToString().Trim();
  143. dgvr.Cells.Add(cell);
  144. cell = new DataGridViewTextBoxCell();
  145. cell.Value = tbl.Rows[i]["Mcse_MemberServiceNumber"].ToString().Trim();
  146. dgvr.Cells.Add(cell);
  147. cell = new DataGridViewTextBoxCell();
  148. cell.Value = tbl.Rows[i]["Mcse_ServiceContent"].ToString().Trim();
  149. dgvr.Cells.Add(cell);
  150. cell = new DataGridViewTextBoxCell();
  151. cell.Value = tbl.Rows[i]["Mcse_ServiceCount"].ToString().Trim();
  152. dgvr.Cells.Add(cell);
  153. cell = new DataGridViewTextBoxCell();
  154. cell.Value = string.IsNullOrEmpty(tbl.Rows[i]["Msc_MemberServiceNumber"].ToString_s())?"该服务已移除":"";
  155. dgvr.Cells.Add(cell);
  156. this.dgvData.Rows.Add(dgvr);
  157. }
  158. }
  159. }
  160. }
  161. }
  162. /// <summary>
  163. /// 列表点击事件
  164. /// </summary>
  165. /// <param name="sender"></param>
  166. /// <param name="e"></param>
  167. protected override void dgvData_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
  168. {
  169. if (this.dgvData.Rows.Count > 0)
  170. {
  171. if (e.RowIndex >= 0)
  172. {
  173. if (Convert.ToBoolean(this.dgvData.CurrentRow.Cells["Column6"].Value) == true)
  174. { this.dgvData.CurrentRow.Cells["Column6"].Value = false; }
  175. else
  176. { this.dgvData.CurrentRow.Cells["Column6"].Value = true; }
  177. }
  178. }
  179. }
  180. /// <summary>
  181. /// 扣费
  182. /// </summary>
  183. /// <param name="sender"></param>
  184. /// <param name="e"></param>
  185. protected override void btnKoufei_Click(object sender, EventArgs e)
  186. {
  187. if (this.dgvData.Rows.Count > 0)
  188. {
  189. if (!LYFZ.BLL.OrderPayment_Member.VerifiedValidity(this.StrNumber, LYFZ.EnumPublic.MemberFunctionAttribute.服务))
  190. { MessageBoxCustom.Show("对不起!您的会员卡服务有效期已过期,无法使用!"); return; }
  191. string msgText = "";
  192. ArrayList Servicelist = new ArrayList();
  193. for (int i = 0; i < this.dgvData.Rows.Count; i++)
  194. {
  195. if (this.dgvData.Rows[i].Cells["Column4"].Value.ToString().Trim() == "")
  196. { this.dgvData.Rows[i].Cells["Column6"].Value = false; }
  197. if (Convert.ToInt32(this.dgvData.Rows[i].Cells["Column4"].Value) <= 0)
  198. { this.dgvData.Rows[i].Cells["Column6"].Value = false; }
  199. if (Convert.ToBoolean(this.dgvData.Rows[i].Cells["Column6"].Value))
  200. {
  201. if(this.dgvData.Rows[i].Cells["Column5"].Value.ToString().Trim()== "该服务已移除")
  202. {
  203. //MessageBoxCustom.Show("当前服务已被移除,无法进行扣费!");
  204. if(!string.IsNullOrEmpty(msgText))
  205. {
  206. msgText += "\r\n";
  207. }
  208. msgText += this.dgvData.Rows[i].Cells["Column3"].Value.ToString().Trim() + " 当前服务已移除,无法进行扣费!";
  209. continue;
  210. }
  211. Hashtable htData = new Hashtable();
  212. htData["MemberNumber"] = this.StrNumber;
  213. htData["MemberCardNumber"] = this.txtMemberCardNumber.Text.Trim();
  214. htData["ServiceID"] = this.dgvData.Rows[i].Cells["Column1"].Value.ToString().Trim();
  215. htData["ServiceNumber"] = this.dgvData.Rows[i].Cells["Column2"].Value.ToString().Trim();
  216. htData["ServiceName"] = this.dgvData.Rows[i].Cells["Column3"].Value.ToString().Trim();
  217. htData["ServiceCount"] = this.dgvData.Rows[i].Cells["Column4"].Value.ToString().Trim();
  218. htData["strTelephone"] = PublicCodeClasses.MaskedTextBoxExGetText(this.txtTelephone);
  219. Servicelist.Add(htData);
  220. }
  221. }
  222. if(!string.IsNullOrEmpty(msgText))
  223. {
  224. MessageBoxCustom.Show(msgText);
  225. return;
  226. }
  227. if (Servicelist.Count <= 0)
  228. { MessageBoxCustom.Show("没有可使用次数"); return; }
  229. DataTable tbl = mcbll.GetList(" Mc_Number = '" + this.StrNumber + "'").Tables[0];
  230. if (tbl.Rows[0]["Mc_TraderPassword"].ToString().Trim() != "")
  231. {
  232. LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm.EnterPasswordSuperSmallForm Efrm = new SuperSmallForm.EnterPasswordSuperSmallForm();
  233. Efrm.Text = "请输入密码";
  234. Efrm.ShowDialog();
  235. if (Efrm.Pwd != "")
  236. {
  237. if (tbl.Rows[0]["Mc_TraderPassword"].ToString().Trim() != LYFZ.Command.Command_MD5.md5(Efrm.Pwd).Trim())
  238. { MessageBoxCustom.Show("密码错误"); return; }
  239. }
  240. else
  241. { return; }
  242. }
  243. #region 判断是否有欠款
  244. DataTable dt = LYFZ.BLL.BLL_ErpOrderView.GetData_MemberMainServiceArrears("欠款", StrQueryCondition: " Where Mcpo_Number = '" + this.StrNumber + "'", StrQueryCondition2: " Where 欠款 > 0");
  245. if (dt.Rows.Count > 0)
  246. { MessageBoxCustom.Show("此会员客户有欠款!请选择交完款后再消费,谢谢合作!"); return; }
  247. #endregion
  248. if (Servicelist.Count > 1)
  249. {
  250. LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm.ServiceKoufeiSuperSmallForm frm = new SuperSmallForm.ServiceKoufeiSuperSmallForm();
  251. frm.Servicelist = Servicelist;
  252. frm.ShowDialog();
  253. if (frm.IsSaveed)
  254. { GetData(); }
  255. }
  256. else
  257. {
  258. Hashtable htDatas = (Hashtable)Servicelist[0];
  259. DateTime strTime = SDateTime.Now;
  260. string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  261. LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.GetTextSuperSmallForm frm = new CameraControlBook.SuperSmallForm.GetTextSuperSmallForm();
  262. frm.Text = "请输入本次消费次数(消费项:" + htDatas["ServiceCount"].ToString().Trim() + ")";
  263. frm.ShowDialog();
  264. if (frm.IsOK)
  265. {
  266. int test = 0;
  267. try { test = Convert.ToInt32(frm.StrValue); }
  268. catch { MessageBoxCustom.Show("消费次数只能输入整数"); return; }
  269. if (Convert.ToInt32(htDatas["ServiceCount"]) < test)
  270. { MessageBoxCustom.Show("本次消费次数大于可消费次数,请重新输入"); return; }
  271. List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
  272. LYFZ.Model.Model_ErpMemberCardServiceContent model = mcscbll.GetModel("ID", htDatas["ServiceID"].ToString().Trim());
  273. model.Mcse_ServiceCount = model.Mcse_ServiceCount - test;
  274. model.Mcse_UpdateDateTime = strTime;
  275. model.Mcse_UpdateName = strUserID;
  276. clist.Add(mcscbll.GetUpdateCommandInfo(model));
  277. LYFZ.Model.Model_ErpMemberCardServiceContentUseLog modelLog = new Model.Model_ErpMemberCardServiceContentUseLog();
  278. modelLog.Mcsl_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  279. modelLog.Mcsl_Number = this.StrNumber;
  280. modelLog.Mcsl_MemberServiceNumber = htDatas["ServiceNumber"].ToString().Trim();
  281. modelLog.Mcsl_ServiceContent = htDatas["ServiceName"].ToString().Trim();
  282. modelLog.Mcsl_ServiceUesNumber = test;
  283. modelLog.Mcsl_ServiceUesAfterNumber = model.Mcse_ServiceCount;
  284. modelLog.Mcsl_UpdateDateTime = strTime;
  285. modelLog.Mcsl_UpdateName = strUserID;
  286. clist.Add(mcsculog.GetAddCommandInfo(modelLog));
  287. string StrContentText = modelLog.Mcsl_ServiceContent + "(使用" + modelLog.Mcsl_ServiceUesNumber + "次,剩余" + model.Mcse_ServiceCount + "次)。";
  288. tbl = sgbll.GetSystemConfigureCustom("Sconfig_IsEnabled", "Sconfig_Code = 'SMSCashSpending'").Tables[0];
  289. if (tbl.Rows.Count > 0)
  290. {
  291. if (Convert.ToBoolean(tbl.Rows[0]["Sconfig_IsEnabled"]))
  292. {
  293. Model.Model_ErpSMSRecord modelsms = new Model.Model_ErpSMSRecord();
  294. modelsms.Smsr_RecipientNumber = PublicCodeClasses.MaskedTextBoxExGetText(this.txtTelephone);
  295. modelsms.Smsr_Content = "您会员卡" + this.txtMemberCardNumber.Text.Trim() + "于日期" + strTime.ToString("MM-dd HH:mm") + "消费:使用" + htDatas["ServiceName"].ToString().Trim() + test + "次,剩余可使用次数" + model.Mcse_ServiceCount + "次。";
  296. modelsms.Smsr_SendCreateDatetime = strTime;
  297. modelsms.Smsr_Status = "暂未发送";
  298. modelsms.Smsr_SendPeople = strUserID;
  299. modelsms.Smsr_CreateDatetime = strTime;
  300. clist.Add(rbll.GetAddCommandInfo(modelsms));
  301. }
  302. }
  303. if (clist.Count > 0)
  304. {
  305. if (MessageBoxCustom.Show("确定要消费吗", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  306. { return; }
  307. if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0)
  308. { MessageBoxCustom.Show("消费扣除次数失败"); return; }
  309. LYFZ.Model.Model_ErpMemberCard modelMc = mcbll.GetModel("Mc_Number", this.StrNumber);
  310. LYFZ.BLL.OrderPayment_Member.MemberServiceCardUse(modelMc.Mc_CustomerNumber, modelMc.Mc_CradNumber, StrContentText: StrContentText);
  311. this.dgvData.CurrentRow.Cells["Column4"].Value = Convert.ToInt32(htDatas["ServiceCount"]) - test;
  312. if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.MemberManage, LYFZ.CustomAttributes.OperatingAuthority.Print))
  313. {
  314. LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm.RechargePrintMessageSuperSmallForm frmMesg = new SuperSmallForm.RechargePrintMessageSuperSmallForm();
  315. frmMesg.lblNameTip = "本次消费" + test + "次数,扣除成功!";
  316. frmMesg.ShowDialog();
  317. if (frmMesg.IsSaveed)
  318. {
  319. List<Hashtable> hlist = new List<Hashtable>();
  320. Hashtable htData2 = new Hashtable();
  321. htData2["ItemName"] = modelLog.Mcsl_ServiceContent;
  322. htData2["UseCount"] = modelLog.Mcsl_ServiceUesNumber;
  323. htData2["UseAfterCount"] = modelLog.Mcsl_ServiceUesAfterNumber;
  324. htData2["UseTime"] = modelLog.Mcsl_UpdateDateTime.ToString("yyyy-MM-dd HH:mm");
  325. htData2["JingShouRen"] = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name;
  326. hlist.Add(htData2);
  327. Hashtable htDataX = new Hashtable();
  328. htDataX["hlist"] = hlist;
  329. htDataX["strNumber"] = this.StrNumber;
  330. LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(LYFZ.EnumPublic.PrintTypeEnum.会员服务消费, htDataX);
  331. }
  332. }
  333. }
  334. }
  335. }
  336. }
  337. }
  338. ///// <summary>
  339. ///// 打印票据
  340. ///// </summary>
  341. ///// <param name="PrintType"></param>
  342. //void PrintBills(LYFZ.EnumPublic.PrinterType PrintType)
  343. //{
  344. // try
  345. // {
  346. // if (this.dgvData.Rows.Count > 0)
  347. // {
  348. // if (this.dgvData.CurrentRow != null)
  349. // {
  350. // if (this.dgvData.CurrentRow.Index >= 0)
  351. // {
  352. // Hashtable htData = new Hashtable();
  353. // htData["McNumber"] = this.StrNumber;
  354. // htData["PaymentItem"] = this.dgvData.CurrentRow.Cells["Column1"].Value.ToString().Trim();
  355. // htData["PaymentMethod"] = this.dgvData.CurrentRow.Cells["Column5"].Value.ToString().Trim();
  356. // htData["PaymentAmount"] = this.dgvData.CurrentRow.Cells["Column2"].Value.ToString().Trim();
  357. // htData["PaymentPeople"] = this.dgvData.CurrentRow.Cells["Column7"].Value.ToString().Trim();
  358. // new LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat().PrintFixedFormat(LYFZ.EnumPublic.PrintTypeEnum.会员充值收款, htData, PrintType);
  359. // }
  360. // }
  361. // }
  362. // }
  363. // catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
  364. //}
  365. void GetData()
  366. {
  367. DataTable tbl = mcbll.GetView_Custom("BView_MemberMain_GoldMember", StrWhere: " 会员卡号 = '" + txtMemberCardNumber.Text.Trim() + "' and Mc_Status = '1'", ShowColumnName: "Mc_Number,会员卡号,姓名,电话,金额").Tables[0];
  368. if (tbl.Rows.Count > 0)
  369. {
  370. this.txtMemberCardNumber.Text = tbl.Rows[0]["会员卡号"].ToString().Trim();
  371. this.txtHolder.Text = tbl.Rows[0]["姓名"].ToString().Trim();
  372. this.txtTelephone.Text = tbl.Rows[0]["电话"].ToString().Trim();
  373. this.txtAmount.Text = tbl.Rows[0]["金额"].ToString().Trim();
  374. this.StrNumber = tbl.Rows[0]["Mc_Number"].ToString().Trim();
  375. }
  376. tbl = mcscbll.GetServiceContent_Left_ServiceContentSet("Mcse_Number = '" + this.StrNumber + "'").Tables[0];
  377. this.dgvData.Rows.Clear();
  378. for (int i = 0; i < tbl.Rows.Count; i++)
  379. {
  380. DataGridViewRow dgvr = new DataGridViewRow();
  381. DataGridViewCell cell = null;
  382. cell = new DataGridViewCheckBoxCell();
  383. cell.Value = false;
  384. dgvr.Cells.Add(cell);
  385. cell = new DataGridViewTextBoxCell();
  386. cell.Value = tbl.Rows[i]["ID"].ToString().Trim();
  387. dgvr.Cells.Add(cell);
  388. cell = new DataGridViewTextBoxCell();
  389. cell.Value = tbl.Rows[i]["Mcse_MemberServiceNumber"].ToString().Trim();
  390. dgvr.Cells.Add(cell);
  391. cell = new DataGridViewTextBoxCell();
  392. cell.Value = tbl.Rows[i]["Mcse_ServiceContent"].ToString().Trim();
  393. dgvr.Cells.Add(cell);
  394. cell = new DataGridViewTextBoxCell();
  395. cell.Value = tbl.Rows[i]["Mcse_ServiceCount"].ToString().Trim();
  396. dgvr.Cells.Add(cell);
  397. cell = new DataGridViewTextBoxCell();
  398. cell.Value = "";
  399. dgvr.Cells.Add(cell);
  400. this.dgvData.Rows.Add(dgvr);
  401. }
  402. }
  403. /// <summary>
  404. /// 充值
  405. /// </summary>
  406. /// <param name="sender"></param>
  407. /// <param name="e"></param>
  408. protected override void btnRecharge_Click(object sender, EventArgs e)
  409. {
  410. if (StrNumber != "")
  411. {
  412. string strNumber = "";
  413. string msgText = "";
  414. for (int i = 0; i < this.dgvData.Rows.Count; i++)
  415. {
  416. if (Convert.ToBoolean(this.dgvData.Rows[i].Cells["Column6"].Value))
  417. {
  418. if (this.dgvData.Rows[i].Cells["Column5"].Value.ToString().Trim() == "该服务已移除")
  419. {
  420. //MessageBoxCustom.Show("当前服务已被移除,无法进行扣费!");
  421. if (!string.IsNullOrEmpty(msgText))
  422. {
  423. msgText += "\r\n";
  424. }
  425. msgText += this.dgvData.Rows[i].Cells["Column3"].Value.ToString().Trim() + " 当前服务已移除,无法进行扣费!";
  426. continue;
  427. }
  428. if (strNumber == "")
  429. { strNumber += "'" + this.dgvData.Rows[i].Cells["Column2"].Value.ToString().Trim() + "'"; }
  430. else { strNumber += ",'" + this.dgvData.Rows[i].Cells["Column2"].Value.ToString().Trim() + "'"; }
  431. }
  432. }
  433. if (!string.IsNullOrEmpty(msgText))
  434. {
  435. MessageBoxCustom.Show(msgText);
  436. return;
  437. }
  438. if (strNumber.Trim() != "")
  439. {
  440. Hashtable htData = new Hashtable();
  441. htData["MemberCardNumber"] = this.txtMemberCardNumber.Text.Trim();
  442. htData["MemberCardHolder"] = this.txtHolder.Text.Trim();
  443. htData["MemberCardAmount"] = this.txtAmount.Text.Trim();
  444. htData["StrNumber"] = this.StrNumber;
  445. LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm.ServiceRechargeSuperSmallForm frm = new SuperSmallForm.ServiceRechargeSuperSmallForm();
  446. frm.IntRechargeNumber = strNumber.Trim();
  447. frm.htData = htData;
  448. frm.ShowDialog();
  449. if (frm.IsSaveed)
  450. { GetData(); }
  451. }
  452. }
  453. else { MessageBoxCustom.Show("请您先输入会员卡号"); }
  454. }
  455. /// <summary>
  456. /// 服务箱
  457. /// </summary>
  458. /// <param name="sender"></param>
  459. /// <param name="e"></param>
  460. protected override void btnServiceToolbox_Click(object sender, EventArgs e)
  461. {
  462. if (this.StrNumber != "")
  463. {
  464. LYFZ.Software.MainBusiness.MembershipManage.SetSmallForm.DataSetServiceBoxSetSmallForm frm = new SetSmallForm.DataSetServiceBoxSetSmallForm();
  465. frm.StrNumber = this.StrNumber;
  466. frm.ShowDialog();
  467. if (frm.IsSaveed)
  468. {
  469. DataTable tbl = mcscbll.GetServiceContent_Left_ServiceContentSet("Mcse_Number = '" + this.StrNumber + "'").Tables[0];
  470. this.dgvData.Rows.Clear();
  471. for (int i = 0; i < tbl.Rows.Count; i++)
  472. {
  473. DataGridViewRow dgvr = new DataGridViewRow();
  474. DataGridViewCell cell = null;
  475. cell = new DataGridViewCheckBoxCell();
  476. cell.Value = false;
  477. dgvr.Cells.Add(cell);
  478. cell = new DataGridViewTextBoxCell();
  479. cell.Value = tbl.Rows[i]["ID"].ToString().Trim();
  480. dgvr.Cells.Add(cell);
  481. cell = new DataGridViewTextBoxCell();
  482. cell.Value = tbl.Rows[i]["Mcse_MemberServiceNumber"].ToString().Trim();
  483. dgvr.Cells.Add(cell);
  484. cell = new DataGridViewTextBoxCell();
  485. cell.Value = tbl.Rows[i]["Mcse_ServiceContent"].ToString().Trim();
  486. dgvr.Cells.Add(cell);
  487. cell = new DataGridViewTextBoxCell();
  488. cell.Value = tbl.Rows[i]["Mcse_ServiceCount"].ToString().Trim();
  489. dgvr.Cells.Add(cell);
  490. cell = new DataGridViewTextBoxCell();
  491. cell.Value = "";
  492. dgvr.Cells.Add(cell);
  493. this.dgvData.Rows.Add(dgvr);
  494. }
  495. }
  496. }
  497. else { MessageBoxCustom.Show("请您先输入会员卡号"); }
  498. }
  499. }
  500. }