Exemplo n.º 1
0
        public ClubCardTypeVO GetCardTypeByID(int cardTypeID)
        {
            ClubCardTypeData cardTypeData = new ClubCardTypeData();
            ClubCardTypeVO cardTypeVO = new ClubCardTypeVO();
            ClubCardTypePO cardTypePO = cardTypeData.GetCardTypeByID(cardTypeID);
            cardTypeVO = Mapper.Map<ClubCardTypePO, ClubCardTypeVO>(cardTypePO);

            return cardTypeVO;
        }
Exemplo n.º 2
0
        public void TestMethod1()
        {
            //VO to PO
            Mapper.CreateMap<ClubCardTypeVO, ClubCardTypePO>();
            ClubCardTypeMgm clubMgm = new ClubCardTypeMgm();
            ClubCardTypeVO clubCardTypeVO = new ClubCardTypeVO();
            clubCardTypeVO.CardTypeName = "Gold";
            clubCardTypeVO.ClubCardTypeID = 1;
            clubCardTypeVO.CreatedDate = DateTime.Now;
            clubCardTypeVO.CreatorID = "001";
            clubCardTypeVO.LastModifiedDate = DateTime.Now;
            clubCardTypeVO.LastModifierID = "002";
            clubCardTypeVO.LogicalStatus = 1;
            clubCardTypeVO.Operation = "add";
            clubCardTypeVO.PackageDiscount = 0.5M;
            clubCardTypeVO.PayDiscount = 0.5M;

            clubMgm.AddCardType(clubCardTypeVO);
        }
Exemplo n.º 3
0
        public JsonResult AddClubCardTypeModel()
        {
            IClubCardTypeMgm ctmgm = new ClubCardTypeMgm();

            string ctypename = NullHelper.Convert<string>(Request["ctype"], null);
            decimal cdis = NullHelper.Convert<decimal>(Request["cdiscount"], 0M);
            decimal pdis = NullHelper.Convert<decimal>(Request["pkgdiscount"], 0M);

            ClubCardTypeVO cardtype = new ClubCardTypeVO()
            {
                CardTypeName=ctypename,
                PackageDiscount=pdis,
                PayDiscount=cdis,
                CreatedDate=DateTime.Now,
                CreatorID=Emp.UserName,
                LastModifierID=Emp.UserName,
                LastModifiedDate=DateTime.Now
            };
            var data = GetValidata(cardtype);
            if (data.Success)
            {
                try
                {
                    ctmgm.AddCardType(cardtype);
                    data.Success = true;
                    data.Message = "会员卡类型添加成功";
                }
                catch (Exception ex)
                {
                    data.Success = false;
                    data.Message = "会员卡类型添加失败";
                    data.Error = ex.ToString();
                }
            }

            return Json(data, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 4
0
        public JsonResult EditeClubCardTypeModel()
        {
            IClubCardTypeMgm ctmgm = new ClubCardTypeMgm();

            int ctid = NullHelper.Convert<int>(Request["id"],0);
            string ctypename = NullHelper.Convert<string>(Request["ctype"], null);
            decimal cdis = NullHelper.Convert<decimal>(Request["cdiscount"], 0M);
            decimal pdis = NullHelper.Convert<decimal>(Request["pkgdiscount"], 0M);
            var cardtype = new ClubCardTypeMgm().GetCardTypeByID(ctid);
            if (cardtype == null)
                cardtype = new ClubCardTypeVO();
            cardtype.CardTypeName = ctypename;
            cardtype.PackageDiscount = pdis;
            cardtype.PayDiscount = cdis;
            var data = GetValidata(cardtype);
            if(data.Success)
            {
                if(ctid>0)
                {
                    try
                    {
                        cardtype.LastModifiedDate = DateTime.Now;
                        cardtype.LastModifierID = Emp.UserName;
                        data.Success = ctmgm.EditCardType(cardtype);
                        if(data.Success)
                        {
                            data.Message = "会员卡类型更新成功";
                        }
                        else
                        {
                            data.Message = "会员卡类型更新失败";
                        }

                    }
                    catch (Exception ex)
                    {
                        data.Success = false;
                        data.Message = "会员卡类型更新失败";
                        data.Error = ex.ToString();
                    }
                }
                else
                {
                    data.Success = false;
                    data.Message = "当前会员卡类型不能修改";
                }

            }

            return Json(data, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 5
0
 public ReturnedData GetValidata(ClubCardTypeVO ctype)
 {
     ReturnedData data = new ReturnedData();
     if(string.IsNullOrEmpty(ctype.CardTypeName))
     {
         data.Success = false;
         data.Message = "请输入会员卡类型";
     }
     else if(ctype.PayDiscount<0||ctype.PayDiscount>=1)
     {
         data.Success = false;
         data.Message = "充值折扣输入错误";
     }
     else if(ctype.PackageDiscount<0||ctype.PackageDiscount>=1)
     {
         data.Success = false;
         data.Message = "套餐折扣输入错误";
     }
     else
     {
         data.Success = true;
     }
     return data;
 }
Exemplo n.º 6
0
        public List<ClubCardTypeVO> GetAllCardType()
        {
            List<ClubCardTypeVO> result = new List<ClubCardTypeVO>();

            #region Mock
            ClubCardTypeVO item1 = new ClubCardTypeVO()
            {
                ClubCardTypeID = 1,
                CardTypeName = "白金卡",
                PackageDiscount = 0.70M,
                PayDiscount = 0.70M
            };

            ClubCardTypeVO item2 = new ClubCardTypeVO()
            {
                ClubCardTypeID = 2,
                CardTypeName = "黄金卡",
                PackageDiscount = 0.65M,
                PayDiscount = 0.66M
            };

            ClubCardTypeVO item3 = new ClubCardTypeVO()
            {
                ClubCardTypeID = 3,
                CardTypeName = "钻石卡",
                PackageDiscount = 0.81M,
                PayDiscount = 0.56M
            };

            ClubCardTypeVO item4 = new ClubCardTypeVO()
            {
                ClubCardTypeID = 4,
                CardTypeName = "青铜卡",
                PackageDiscount = 0.45M,
                PayDiscount = 0.65M
            };

            ClubCardTypeVO item5 = new ClubCardTypeVO()
            {
                ClubCardTypeID = 5,
                CardTypeName = "白银卡",
                PackageDiscount = 0.78M,
                PayDiscount = 0.26M
            };

            ClubCardTypeVO item6 = new ClubCardTypeVO()
            {
                ClubCardTypeID = 6,
                CardTypeName = "自由行卡",
                PackageDiscount = 0.89M,
                PayDiscount = 0.76M
            };

            ClubCardTypeVO item7 = new ClubCardTypeVO()
            {
                ClubCardTypeID = 7,
                CardTypeName = "折扣卡",
                PackageDiscount = 0.23M,
                PayDiscount = 0.43M
            };

            ClubCardTypeVO item8 = new ClubCardTypeVO()
            {
                ClubCardTypeID = 8,
                CardTypeName = "优惠卡",
                PackageDiscount = 0.89M,
                PayDiscount = 0.45M
            };

            ClubCardTypeVO item9 = new ClubCardTypeVO()
            {
                ClubCardTypeID = 9,
                CardTypeName = "普通卡",
                PackageDiscount = 0.42M,
                PayDiscount = 0.84M
            };

            ClubCardTypeVO item10 = new ClubCardTypeVO()
            {
                ClubCardTypeID = 10,
                CardTypeName = "大众卡",
                PackageDiscount = 0.23M,
                PayDiscount = 0.46M
            };

            ClubCardTypeVO item11 = new ClubCardTypeVO()
            {
                ClubCardTypeID = 11,
                CardTypeName = "尊贵卡",
                PackageDiscount = 0.47M,
                PayDiscount = 0.47M
            };

            ClubCardTypeVO item12 = new ClubCardTypeVO()
            {
                ClubCardTypeID = 12,
                CardTypeName = "贵宾卡",
                PackageDiscount = 0.37M,
                PayDiscount = 0.37M
            };

            result.Add(item1);
            result.Add(item2);
            result.Add(item3);
            result.Add(item4);
            result.Add(item5);
            result.Add(item6);
            result.Add(item7);
            result.Add(item8);
            result.Add(item9);
            result.Add(item10);
            result.Add(item11);
            result.Add(item12);
            #endregion

            return result;
        }