Esempio n. 1
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));
        }
Esempio n. 2
0
        public void TestMethod2()
        {
            ClubCardTypeVO clubCardTypeVO = new ClubCardTypeVO();

            clubCardTypeVO.CardTypeName     = "Gold111111117777";
            clubCardTypeVO.ClubCardTypeID   = 3;
            clubCardTypeVO.CreatedDate      = DateTime.Now;
            clubCardTypeVO.CreatorID        = "001";
            clubCardTypeVO.LastModifiedDate = DateTime.Now;
            clubCardTypeVO.LastModifierID   = "002";
            clubCardTypeVO.LogicalStatus    = 1;
            clubCardTypeVO.Operation        = "add";
            clubCardTypeVO.PackageDiscount  = 0.8M;
            clubCardTypeVO.PayDiscount      = 0.2M;

            //VO to PO
            Mapper.CreateMap <ClubCardTypeVO, ClubCardTypePO>();

            ClubCardTypeMgm clubMgm = new ClubCardTypeMgm();

            clubMgm.EditCardType(clubCardTypeVO);
        }