Esempio n. 1
0
 public void AddClubCard(Model.VO.ClubCardVO clubCard)
 {
     ClubCardData clubCardData = new ClubCardData();
     clubCard.ClubCardNo = SerialNoGenerator.GenClubCardNo();
     clubCard.ClubCardPwd = PwdHelper.MD5Encrypt(clubCard.ClubCardPwd);
     clubCardData.AddClubCard(Mapper.Map<ClubCardVO, ClubCardPO>(clubCard));
 }
Esempio n. 2
0
        public void RechargeCash(Model.VO.RechargeVO entity)
        {
            CustClubCardModule.ClubCardMgm clubCardMgm = new CustClubCardModule.ClubCardMgm();
            int clubCardID = clubCardMgm.GetCardStatusByClubCardID(entity.ClubCardID);
            if(clubCardID != Convert.ToInt32(ClubCardStatus.OpenCard))
            {
                throw new Exception("非有效会员卡,请联系后台管理员");
            }

            RechargeLogData rechargeLogData = new RechargeLogData();
            ClubCardData clubCardData = new ClubCardData();
            ClubCardPO clubCardPO = clubCardData.GetClubCardByID(entity.ClubCardID);
            clubCardPO.Balance += entity.PlatformRechargeAmount;

            SqlConnection conn = new SqlConnection(PubConstant.ConnectionString);
            conn.Open();
            SqlTransaction tx = conn.BeginTransaction();

            try
            {
                //entity.RechargeSerialNo = SerialNoGenerator.GenRechargeSerialNo(entity.RechargeStore);
                rechargeLogData.AddRechargeLog(Mapper.Map<RechargeVO, RechargeLogPO>(entity));
                clubCardData.UpdateClubCard(clubCardPO);
                tx.Commit();
            }
            catch
            {
                tx.Rollback();
                throw new Exception("现金充值失败");
            }
        }
Esempio n. 3
0
        public List<Model.VO.ClubCardPkgVO> GetAvailablePkgs(int clubCardID)
        {
            ClubCardData clubCardData = new ClubCardData();

            List<ClubCardPkgVO> clubCardPkgVOList = new List<ClubCardPkgVO>();

            DataSet ds = clubCardData.GetAvailablePkgs(clubCardID);
            List<ClubCardPackagePO> clubCardPkgPOList = ds.GetEntity<List<ClubCardPackagePO>>();
            if(clubCardPkgPOList!=null&&clubCardPkgPOList.Count>0)
            {
                clubCardPkgPOList.ForEach(i =>
                {
                    clubCardPkgVOList.Add(Mapper.Map<ClubCardPackagePO, ClubCardPkgVO>(i));
                });
            }

            return clubCardPkgVOList;
        }
Esempio n. 4
0
        public string ConsumeCash(List<Model.VO.ConsumeVO> list)
        {
            string strBatchNo = "";
            CustClubCardModule.ClubCardMgm clubCardMgm = new CustClubCardModule.ClubCardMgm();
            int clubCardStat = clubCardMgm.GetCardStatusByClubCardID(list[0].ClubCardID);
            if (clubCardStat != Convert.ToInt32(ClubCardStatus.OpenCard))
            {
                throw new Exception("非有效会员卡,请联系后台管理员");
            }

            ConsumeLogData consumeLogData = new ConsumeLogData();
            ClubCardData clubCardData = new ClubCardData();
            ClubCardPO clubCardPO = clubCardData.GetClubCardByID(list[0].ClubCardID);

            SqlConnection conn = new SqlConnection(PubConstant.ConnectionString);
            conn.Open();
            SqlTransaction tx = conn.BeginTransaction();
            int storeId = Convert.ToInt32(list.FirstOrDefault().Reserved1);
            list.ForEach(itm => itm.Reserved1 = null);
            try
            {
                decimal dConsumeAmount = 0.0M;
                strBatchNo = SerialNoGenerator.GenConsumeBatchNo(storeId);
                foreach (var item in list)
                {
                    dConsumeAmount += item.OriginalPrice;
                    item.ConsumeBatchNo = strBatchNo;
                    consumeLogData.AddConsumeLog(Mapper.Map<ConsumeVO, ConsumeLogPO>(item));
                }
                clubCardPO.Balance = clubCardPO.Balance - dConsumeAmount;
                clubCardData.UpdateClubCard(clubCardPO);
                tx.Commit();
            }
            catch
            {
                tx.Rollback();
                throw new Exception("会员现金消费失败");
            }
            return strBatchNo;
        }
Esempio n. 5
0
        public void UpdatePwd(int clubCardID, string newPwd)
        {
            ClubCardData clubCardData = new ClubCardData();
            ClubCardVO clubCardVO = GetClubCardByID(clubCardID);

            string encryptPwd = PwdHelper.MD5Encrypt(newPwd);
            clubCardVO.ClubCardPwd = encryptPwd;

            clubCardData.UpdateClubCard(Mapper.Map<ClubCardVO, ClubCardPO>(clubCardVO));
        }
Esempio n. 6
0
        public Model.VO.ClubCardPkgVO GetClubCardPkgByID(string id)
        {
            ClubCardData clubCardData = new ClubCardData();
            ClubCardPkgVO clubCardPkgVO = new ClubCardPkgVO();
            ClubCardPackagePO clubCardPkgPO = clubCardData.GetClubCardPkgByID(id);
            clubCardPkgVO = Mapper.Map<ClubCardPackagePO, ClubCardPkgVO>(clubCardPkgPO);

            return clubCardPkgVO;
        }
Esempio n. 7
0
        public string ConsumePkg(List<Model.VO.ConsumeVO> list)
        {
            if (list.Count < 1)
            {
                throw new Exception("请选择套餐消费项目");
            }

            string strBatchNo = "";
            CustClubCardModule.ClubCardMgm clubCardMgm = new CustClubCardModule.ClubCardMgm();
            int clubCardStat = clubCardMgm.GetCardStatusByClubCardID(list[0].ClubCardID);
            if (clubCardStat != Convert.ToInt32(ClubCardStatus.OpenCard))
            {
                throw new Exception("非有效会员卡,请联系后台管理员");
            }

            ConsumeLogData consumeLogData = new ConsumeLogData();
            ClubCardData clubCardData = new ClubCardData();
            DataSet ds = clubCardData.GetDetailByClubCardPkgID(list[0].ClubCardPackageID.ToString());
            List<ClubCardPackageDetailPO> clubCardPkgDetailPOList = ds.GetEntity<List<ClubCardPackageDetailPO>>();

            SqlConnection conn = new SqlConnection(PubConstant.ConnectionString);
            conn.Open();
            SqlTransaction tx = conn.BeginTransaction();
            int storeId = Convert.ToInt32(list.FirstOrDefault().Reserved1);
            list.ForEach(itm => itm.Reserved1 = null);
            try
            {
                strBatchNo = SerialNoGenerator.GenConsumeBatchNo(storeId);
                foreach (var item in list)
                {
                    ClubCardPackageDetailPO tmpPkgDetail = null;
                    foreach(var item1 in clubCardPkgDetailPOList)
                    {
                        if(item.PackageDetailID == item1.PackageDetailID)
                        {
                            item1.RemainCount -= item.ConsumeCount;
                            tmpPkgDetail = item1;
                            item.ItemID = item1.ItemID;
                            break;
                        }
                    }

                    if(tmpPkgDetail == null)
                    {
                        throw new Exception("消费项目套餐中不存在");
                    }

                    ClubCardPackageData clubCardPackageData = new ClubCardPackageData();
                    clubCardPackageData.EditClubCardPkgDetail(tmpPkgDetail);

                    item.ConsumeBatchNo = strBatchNo;
                    consumeLogData.AddConsumeLog(Mapper.Map<ConsumeVO, ConsumeLogPO>(item));

                }
                if (clubCardPkgDetailPOList.Any(i=>i.RemainCount==0))
                {
                    var cardPkg= new ClubCardPackageData();
                    var cardPkgData = cardPkg.GetClubCardPkgByID(list[0].ClubCardPackageID);
                    cardPkgData.PackageStatus = (int)CardSPackageStatus.Unavailable;
                    cardPkg.EditClubCardPkg(cardPkgData);
                }
                tx.Commit();
            }
            catch
            {
                tx.Rollback();
                throw new Exception("会员套餐消费失败");
            }
            return strBatchNo;
        }
Esempio n. 8
0
 public Model.VO.ClubCardVO GetClubCardByCustID(int id)
 {
     IClubCardData cardData = new ClubCardData();
     return Mapper.Map<ClubCardPO, ClubCardVO>(cardData.GetCardByID(id, 1));
 }
Esempio n. 9
0
        public Model.VO.ClubCardVO GetClubCardByID(int id)
        {
            ClubCardData clubCardData = new ClubCardData();
            ClubCardVO clubCardVO = new ClubCardVO();
            ClubCardPO clubCardPO = clubCardData.GetClubCardByID(id);
            clubCardVO = Mapper.Map<ClubCardPO, ClubCardVO>(clubCardPO);

            return clubCardVO;
        }
Esempio n. 10
0
        public Model.VO.ClubCardPkgDetailVO GetClubCardPkgDetailByID(int id)
        {
            ClubCardData clubCardData = new ClubCardData();
            ClubCardPkgDetailVO clubCardPkgDetailVO = new ClubCardPkgDetailVO();
            ClubCardPackageDetailPO clubCardPkgDetailPO = clubCardData.GetClubCardPkgDetailByID(id);
            clubCardPkgDetailVO = Mapper.Map<ClubCardPackageDetailPO, ClubCardPkgDetailVO>(clubCardPkgDetailPO);

            return clubCardPkgDetailVO;
        }
Esempio n. 11
0
 public Model.VO.ClubCardVO GetClubCardByCardNo(string cardNo)
 {
     IClubCardData cardData = new ClubCardData();
     return Mapper.Map<ClubCardPO, ClubCardVO>(cardData.GetCardByCardNo(cardNo));
 }
Esempio n. 12
0
 public string UpdatePwd(int clubCardID, string oldpwd, string newPwd)
 {
     IClubCardData carddal = new ClubCardData();
     string restr;
     var result = Mapper.Map<ClubCardPO, ClubCardVO>(carddal.GetCardByID(clubCardID, 0));
     if (result == null)
     {
         restr = "当前会员卡不存在";
     }
     else
     {
         if (result.ClubCardPwd == StringHelper.MD5Encrypt(oldpwd))
         {
             try
             {
                 result.ClubCardPwd = StringHelper.MD5Encrypt(newPwd);
                 carddal.UpdateClubCard(Mapper.Map<ClubCardVO, ClubCardPO>(result));
                 restr = null;
             }
             catch (Exception ex)
             {
                 LogHandler.Error(ex.ToString());
                 restr = "出现错误,密码重置失败";
             }
         }
         else
         {
             restr = "原始密码不正确";
         }
     }
     return restr;
 }
Esempio n. 13
0
 public int GetClubCardRecordCount(Model.Entity.ClubCardQueryEntity filter)
 {
     ClubCardData clubCarddal = new ClubCardData();
     return clubCarddal.GetClubCardRecordCount(filter);
 }
Esempio n. 14
0
        public void UpdateClubCardStatus(int clubCardID, int status)
        {
            ClubCardData clubCardData = new ClubCardData();
            ClubCardVO clubCardVO = GetClubCardByID(clubCardID);

            if ((status != Convert.ToInt32(ClubCardStatus.OpenCard)) && (status != Convert.ToInt32(ClubCardStatus.ReportLoss)) && (status != Convert.ToInt32(ClubCardStatus.Froze)) && (status != Convert.ToInt32(ClubCardStatus.LogOff)) && (status != Convert.ToInt32(ClubCardStatus.Expire)))
            {
                throw new Exception("ClubCard Status invalid");
            }

            clubCardVO.CardStatus = status;
            clubCardData.UpdateClubCard(Mapper.Map<ClubCardVO, ClubCardPO>(clubCardVO));
        }
Esempio n. 15
0
        public int RechargePkg(Model.VO.RechargeVO entity)
        {
            //尚需完善
            CustClubCardModule.ClubCardMgm clubCardMgm = new CustClubCardModule.ClubCardMgm();

            int clubCardState = clubCardMgm.GetCardStatusByClubCardID(entity.ClubCardID);
            if (clubCardState != Convert.ToInt32(ClubCardStatus.OpenCard))
            {
                throw new Exception("非有效会员卡,请联系后台管理员");
            }

            RechargeLogData rechargeLogData = new RechargeLogData();
            ClubCardPackagePO clubCardPkgPO = new ClubCardPackagePO();

            List<ClubCardPackageDetailPO> clubCardPkgDetailPOList = new List<ClubCardPackageDetailPO>();

            ClubCardPackageData clubCardPkgData = new ClubCardPackageData();

            MarktingPlanModule.PackageMgm pkgMgm = new MarktingPlanModule.PackageMgm();
            MarktingPlanModule.IPkgItemsMgm pkgItemsMgm = new MarktingPlanModule.PkgItemsMgm();

            //PackageData packageData = new PackageData();
            //PkgItemsData pkgItemsData = new PkgItemsData();

            PackageVO packageVO = pkgMgm.GetPackageByID(Convert.ToInt32(entity.ClubCardPackageID));//此处ClubCardPackageID即为PackageID
            PackagePO packagePO = Mapper.Map<PackageVO, PackagePO>(packageVO);
            List<PkgItemVO> pkgItemList = pkgItemsMgm.GetItemsByPkgID(packagePO.PackageID);

            clubCardPkgPO.PackageID = packagePO.PackageID;
            clubCardPkgPO.ClubCardID = entity.ClubCardID;
            clubCardPkgPO.PackageName = packagePO.PackageName;
            clubCardPkgPO.OriginalAmount = entity.PlatformRechargeAmount;
            clubCardPkgPO.ActualAmount = entity.ActualRechargeAmount;
            clubCardPkgPO.DiscountRate = entity.DiscountRate;
            clubCardPkgPO.DiscountInfo = entity.DiscountInfo;
            clubCardPkgPO.DiscountRate = Convert.ToDecimal(CardSPackageStatus.Available);
            clubCardPkgPO.Salesman = entity.SalesMan;
            clubCardPkgPO.SalesTime = DateTime.Now;
            clubCardPkgPO.SaleStore = entity.RechargeStore;//从login信息中获取
            clubCardPkgPO.CreatedDate = DateTime.Now;
            clubCardPkgPO.CreatorID = entity.CreatorID;
            clubCardPkgPO.LastModifiedDate = DateTime.Now;
            clubCardPkgPO.LastModifierID =entity.LastModifierID;
            clubCardPkgPO.ClubCardPackageID = SerialNoGenerator.GenClubCardPkgID();

            foreach (var item in pkgItemList)
            {
                ClubCardPackageDetailPO clubCardPkgDetailPO = new ClubCardPackageDetailPO();
                clubCardPkgDetailPO.ClubCardPackageID = clubCardPkgPO.ClubCardPackageID;
                clubCardPkgDetailPO.ItemID = item.ItemID;
                clubCardPkgDetailPO.ItemName = item.ItemName;
                clubCardPkgDetailPO.OriginalCount = item.ConsumeCount;//消费项目次数
                clubCardPkgDetailPO.RemainCount = item.ConsumeCount;
                clubCardPkgDetailPO.CreatedDate = DateTime.Now;
                clubCardPkgDetailPO.CreatorID = entity.CreatorID;
                clubCardPkgDetailPO.LastModifiedDate = DateTime.Now;
                clubCardPkgDetailPO.LastModifierID = entity.LastModifierID;

                clubCardPkgDetailPOList.Add(clubCardPkgDetailPO);
            }

            ClubCardData clubCardData = new ClubCardData();
            ClubCardPO clubCardPO = clubCardData.GetClubCardByID(entity.ClubCardID);
            clubCardPO.Balance = clubCardPO.Balance + entity.PlatformRechargeAmount;
            clubCardPO.LastModifiedDate = DateTime.Now;
            clubCardPO.LastModifierID = entity.LastModifierID;

            SqlConnection conn = new SqlConnection(PubConstant.ConnectionString);
            conn.Open();
            SqlTransaction tx = conn.BeginTransaction();

            try
            {
                clubCardPkgData.AddClubCardPkg(clubCardPkgPO);
                clubCardPkgData.AddClubCardPkgDetailList(clubCardPkgDetailPOList);

               // entity.RechargeSerialNo = SerialNoGenerator.GenRechargeSerialNo(entity.RechargeStore);
                rechargeLogData.AddRechargeLog(Mapper.Map<RechargeVO, RechargeLogPO>(entity));
                tx.Commit();
            }
            catch
            {
                tx.Rollback();
                throw new Exception("套餐充值失败");
            }
            return 1;
        }
Esempio n. 16
0
        public void UpdateClubCardNo(int clubCardID, string newClubCardNo)
        {
            ClubCardData clubCardData = new ClubCardData();
            ClubCardVO clubCardVO = GetClubCardByID(clubCardID);

            if (string.IsNullOrEmpty(newClubCardNo.Trim()))
            {
                throw new Exception("New ClubCardNo cannot empty ");
            }

            clubCardVO.ClubCardNo = newClubCardNo;
            clubCardVO.CardStatus = 0;
            clubCardData.UpdateClubCard(Mapper.Map<ClubCardVO, ClubCardPO>(clubCardVO));
        }
Esempio n. 17
0
 public void Update(ClubCardVO clubcard)
 {
     ClubCardData clubCarddal = new ClubCardData();
     clubCarddal.EditCard(Mapper.Map<ClubCardVO, ClubCardPO>(clubcard));
 }
Esempio n. 18
0
        public List<Model.VO.ClubCardPkgDetailVO> GetDetailByClubCardPkgID(string id)
        {
            ClubCardData clubCardData = new ClubCardData();

            List<ClubCardPkgDetailVO> clubCardPkgDetailVOList = new List<ClubCardPkgDetailVO>();

            DataSet ds = clubCardData.GetDetailByClubCardPkgID(id);
            List<ClubCardPackageDetailPO> clubCardPkgDetailPOList = ds.GetEntity<List<ClubCardPackageDetailPO>>();
            if (clubCardPkgDetailPOList != null && clubCardPkgDetailPOList.Count > 0)
            {
                clubCardPkgDetailPOList.ForEach(i =>
                {
                    clubCardPkgDetailVOList.Add(Mapper.Map<ClubCardPackageDetailPO, ClubCardPkgDetailVO>(i));
                });
            }
            return clubCardPkgDetailVOList;
        }
Esempio n. 19
0
        public List<Model.VO.ClubCardVO> GetClubCards(string key)
        {
            ClubCardData clubCardData = new ClubCardData();
            List<ClubCardVO> clubCardVOList = new List<ClubCardVO>();

            DataSet ds = clubCardData.GetClubCards(key);
            List<ClubCardPO> clubCardPOList = ds.GetEntity<List<ClubCardPO>>();

            clubCardPOList.ForEach(i =>
            {
                clubCardVOList.Add(Mapper.Map<ClubCardPO, ClubCardVO>(i));
            });

            return clubCardVOList;
        }
Esempio n. 20
0
        public List<Model.VO.ClubCardVO> GetClubCards(Model.Entity.ClubCardQueryEntity entity)
        {
            ClubCardData clubCardData = new ClubCardData();
            List<ClubCardVO> clubCardVOList = new List<ClubCardVO>();

            DataSet ds = clubCardData.GetClubCards(entity);
            List<ClubCardPO> clubCardPOList = ds.GetEntity<List<ClubCardPO>>();
            if(clubCardPOList==null)
            {
                clubCardPOList = new List<ClubCardPO>();
            }
            clubCardPOList.ForEach(i =>
            {
                clubCardVOList.Add(Mapper.Map<ClubCardPO, ClubCardVO>(i));
            });

            return clubCardVOList;
        }