MemberPublicClass.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Linq;
  5. using System.Text;
  6. namespace LYFZ.Software.MainBusiness.MembershipManage
  7. {
  8. public class MemberPublicClass
  9. {
  10. static LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  11. static LYFZ.BLL.BLL_ErpCustomer ctbll = new BLL.BLL_ErpCustomer();
  12. static LYFZ.BLL.BLL_ErpMemberCard mcbll = new BLL.BLL_ErpMemberCard();
  13. static LYFZ.BLL.BLL_SMSTemplates smsTemplates = new BLL.BLL_SMSTemplates();
  14. static LYFZ.BLL.BLL_ErpCustomerGroup ctgpbll = new BLL.BLL_ErpCustomerGroup();
  15. static LYFZ.BLL.BLL_ErpMemberCardPoints mcpsbll = new BLL.BLL_ErpMemberCardPoints();
  16. static LYFZ.BLL.BLL_ErpMemberCardViceCard mcvbll = new BLL.BLL_ErpMemberCardViceCard();
  17. static LYFZ.BLL.BLL_ErpMemberCardPointsLOG mcpslogbll = new BLL.BLL_ErpMemberCardPointsLOG();
  18. static LYFZ.BLL.BLL_ErpMemberCardOperateLOG mcopLogbll = new BLL.BLL_ErpMemberCardOperateLOG();
  19. static string StrUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  20. /// <summary>
  21. /// 本地分店ID
  22. /// </summary>
  23. static string strInfoID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  24. #region 使用积分副卡给主卡积分
  25. /// <summary>
  26. /// 副卡使用绑定主卡客户到订单去做转介绍
  27. /// </summary>
  28. /// <param name="StrMcvNumber">副卡编号</param>
  29. /// <param name="StrOrdNumber">订单号</param>
  30. /// <param name="strTime">使用时间</param>
  31. /// <returns></returns>
  32. public static List<LYFZ.Helper.CommandInfo> ViceCardUse_MainCardPoints(string StrMcvNumber, ref Model.SMSParameters sparameters, string StrOrdNumber, DateTime strTime)
  33. {
  34. List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
  35. LYFZ.Model.Model_ErpMemberCardViceCard modelMcv = mcvbll.GetModel("Mvc_ViceNumber", StrMcvNumber);
  36. modelMcv.Mvc_Status = "2";
  37. modelMcv.Mvc_UpdateDateTime = strTime;
  38. modelMcv.Mvc_UpdateName = StrUserID;
  39. clist.Add(mcvbll.GetUpdateCommandInfo(modelMcv));
  40. LYFZ.Model.Model_ErpMemberCard modelMc = mcbll.GetModel("Mc_Number", modelMcv.Mvc_Number);
  41. LYFZ.Model.Model_ErpMemberCardOperateLOG modelOPLog = new Model.Model_ErpMemberCardOperateLOG();
  42. modelOPLog.mcol_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  43. modelOPLog.mcol_Number = modelMcv.Mvc_Number;
  44. modelOPLog.mcol_Type = "4";
  45. modelOPLog.mcol_Remark = "副卡消费订单" + StrOrdNumber;
  46. modelOPLog.mcol_CreateDatetime = strTime;
  47. modelOPLog.mcol_CreateName = StrUserID;
  48. clist.Add(mcopLogbll.GetAddCommandInfo(modelOPLog));
  49. LYFZ.Model.Model_ErpOrder modelOrder = orbll.GetModel("Ord_Number", StrOrdNumber);
  50. modelOrder.Ord_CustomerSource = "朋友介绍";
  51. modelOrder.Ord_UpdateDateTime = strTime;
  52. modelOrder.Ord_UpdateName = StrUserID;
  53. clist.Add(orbll.GetUpdateCommandInfo(modelOrder));
  54. LYFZ.Model.Model_ErpCustomerGroup modelGroup = ctgpbll.GetModel("GP_OrderNumber", StrOrdNumber);
  55. modelGroup.GP_CustomerSource = "朋友介绍";
  56. modelGroup.GP_IntroducerCustomerID = modelMc.Mc_CustomerNumber;
  57. modelGroup.GP_UpdateDatetime = strTime;
  58. modelGroup.GP_UpdateName = StrUserID;
  59. clist.Add(ctgpbll.GetUpdateCommandInfo(modelGroup));
  60. //LYFZ.Model.Model_ErpCustomer modelClient = ctbll.GetModel("Cus_CustomerNumber",modelMc.Mc_CustomerNumber);// modelGroup.GP_IntroducerCustomerID);
  61. LYFZ.Model.Model_ErpMemberCardPointsLOG modelPointsIntrLOG = new Model.Model_ErpMemberCardPointsLOG();
  62. int IntPointsIntr = LYFZ.BLL.BLL_ErpMemberCard.GetPoints_AgoPeriod(LYFZ.EnumPublic.MemberPointsType.txtReferral_RMB, modelOrder.Ord_SeriesPrice, strInfoID, modelGroup.GP_IntroducerCustomerID);
  63. LYFZ.Model.Model_ErpMemberCardPoints modelPoints2 = mcpsbll.GetModel("Mcps_Number", modelMc.Mc_Number);
  64. modelPointsIntrLOG.MPlg_OriginalPoints = modelPoints2.Mcps_AvailablePoints;
  65. modelPoints2.Mcps_TotalPoints = modelPoints2.Mcps_TotalPoints + IntPointsIntr;
  66. modelPoints2.Mcps_AvailablePoints = modelPoints2.Mcps_AvailablePoints + IntPointsIntr;
  67. modelPoints2.Mcps_UpdateDateTime = strTime;
  68. modelPoints2.Mcps_UpdateName = StrUserID;
  69. clist.Add(mcpsbll.GetUpdateCommandInfo(modelPoints2));
  70. string StrCusName = "";
  71. DataTable dt = orbll.GetView_Custom("tb_ErpCustomer inner join tb_ErpMemberCard on Mc_CustomerNumber = Cus_CustomerNumber Left Join tb_ErpCustomerGroupMembers on GM_CustomerID = Cus_CustomerNumber Left Join tb_ErpCustomerGroup on GP_CustomerGroupID = GM_CustomerGroupID", StrWhere: "GP_OrderNumber = '" + StrOrdNumber + "'", ShowColumnName: "Cus_Name,Mc_CustomerNumber,Mc_CradNumber").Tables[0];
  72. if (dt.Rows.Count > 0)
  73. { StrCusName = dt.Rows[0]["Cus_Name"].ToString().Trim(); }
  74. modelPointsIntrLOG.MPlg_DividedShop = LYFZ.BLL.OrderPayment_Member.StrInfoID;
  75. modelPointsIntrLOG.MPlg_Number = modelPoints2.Mcps_Number;
  76. modelPointsIntrLOG.MPlg_Type = "3";
  77. modelPointsIntrLOG.MPlg_ExistingPoints = modelPoints2.Mcps_AvailablePoints;
  78. modelPointsIntrLOG.MPlg_UsePoints = IntPointsIntr;
  79. modelPointsIntrLOG.MPlg_RedeemArticle = "";
  80. modelPointsIntrLOG.MPlg_RedeemAmount = 0;
  81. modelPointsIntrLOG.MPlg_OrderNumber = modelOrder.Ord_SinceOrderNumber.Trim() != "" ? modelOrder.Ord_SinceOrderNumber.Trim() : modelOrder.Ord_Number;
  82. modelPointsIntrLOG.MPlg_ViceCardNumber = "";
  83. modelPointsIntrLOG.MPlg_Remark = "你介绍" + StrCusName + "来订单,您朋友使用副卡消费,副卡号" + modelMcv.Mvc_ViceCardNumber + ",订单号:" + modelPointsIntrLOG.MPlg_OrderNumber + "付款,获得积分:" + IntPointsIntr;
  84. modelPointsIntrLOG.MPlg_CreateDatetime = strTime;
  85. modelPointsIntrLOG.MPlg_CreateName = StrUserID;
  86. clist.Add(mcpslogbll.GetAddCommandInfo(modelPointsIntrLOG));
  87. if (IntPointsIntr > 0)
  88. {
  89. sparameters.CurrentSpendingMemberID = dt.Rows[0]["Mc_CustomerNumber"].ToString().Trim();
  90. sparameters.CardNumber = dt.Rows[0]["Mc_CradNumber"].ToString().Trim();
  91. sparameters.XXT = strTime;
  92. sparameters.TEXT = "您朋友持积分副卡" + modelMcv.Mvc_ViceCardNumber + "来订单,获得" + IntPointsIntr + "积分";
  93. sparameters.ReferralsBonusPoints = IntPointsIntr;
  94. sparameters.AvailablePoints = modelPoints2.Mcps_AvailablePoints;
  95. //激活积分有效期
  96. clist.AddRange(LYFZ.BLL.OrderPayment_Member.PointsChangeAutoValidity(modelMc.Mc_Number, modelMc.Mc_CradNumber));
  97. }
  98. return clist;
  99. }
  100. #endregion
  101. }
  102. }