Exemplo n.º 1
0
        public JsonResult RechargeCashSub()
        {
            ReturnedData data = new ReturnedData();

            try
            {
                string       cardno           = NullHelper.Convert <string>(Request["cno"], "");
                decimal      rechargeAmount   = NullHelper.Convert <decimal>(Request["rechargeAcc"], 0M);
                decimal      rechargeDiscount = NullHelper.Convert <decimal>(Request["discount"], 0M);
                IClubCardMgm cardMgm          = new ClubCardMgm();


                var        card     = cardMgm.GetClubCardByCardNo(cardno);
                RechargeVO recharge = new RechargeVO();
                recharge.ClubCardID           = card.ClubCardID;
                recharge.ClubCardNo           = card.ClubCardNo;
                recharge.ActualRechargeAmount = rechargeAmount;
                recharge.CustID       = card.CustomerID;
                recharge.CustName     = card.CustName;
                recharge.DiscountRate = rechargeDiscount;
                if (rechargeDiscount == 0)
                {
                    rechargeDiscount = 1;
                }
                recharge.PlatformRechargeAmount = Math.Round(rechargeAmount / rechargeDiscount, 2);
                recharge.RechargeDate           = DateTime.Now;
                recharge.RechargeStore          = Emp.StroeName;
                recharge.OriginalStore          = card.OpenCardStore;
                recharge.PayType           = (int)PayType.Cash;
                recharge.LastModifierID    = Emp.UserName;
                recharge.LastModifiedDate  = DateTime.Now;
                recharge.CreatedDate       = DateTime.Now;
                recharge.CreatorID         = Emp.UserName;
                recharge.DiscountInfo      = "会员现金折扣";
                recharge.ClubCardPackageID = "";
                recharge.RechargeType      = (int)RechargeType.ClubCash;
                recharge.RechargeSerialNo  = SerialNoGenerator.GenRechargeSerialNo(Emp.StoreId);
                recharge.SalesMan          = card.SalesMan;

                IRechargeMgm rechargeMgm = new RechargeMgm();
                rechargeMgm.RechargeCash(recharge);
                data.Success = true;
                Session.Add("recharge", recharge);
            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Error   = ex.ToString();
                data.Message = "充值失败";
            }

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public JsonResult RechargePkgSub()
        {
            ReturnedData data = new ReturnedData();

            try
            {
                string       cardNo     = NullHelper.Convert <string>(Request["cardNo"], null);
                int          pkgId      = NullHelper.Convert <int>(Request["pkgId"], -1);
                decimal      disCount   = NullHelper.Convert <decimal>(Request["disCount"], 0M);
                decimal      rechAmount = NullHelper.Convert <decimal>(Request["rechAmount"], 0M);
                decimal      pkgPrice   = NullHelper.Convert <decimal>(Request["pkgPrice"], 0M);
                IClubCardMgm cardMgm    = new ClubCardMgm();
                RechargeMgm  rechMgm    = new RechargeMgm();

                var        card     = cardMgm.GetClubCardByCardNo(cardNo);
                RechargeVO recharge = new RechargeVO();
                recharge.ClubCardID           = card.ClubCardID;
                recharge.ClubCardNo           = card.ClubCardNo;
                recharge.ActualRechargeAmount = rechAmount;
                recharge.CustID       = card.CustomerID;
                recharge.CustName     = card.CustName;
                recharge.DiscountRate = disCount;
                recharge.Reserved1    = card.ClubCardTypeName;

                recharge.PlatformRechargeAmount = pkgPrice;
                recharge.RechargeDate           = DateTime.Now;
                recharge.RechargeStore          = Emp.StroeName;
                recharge.OriginalStore          = card.OpenCardStore;
                recharge.PayType           = (int)PayType.Cash;
                recharge.LastModifierID    = Emp.UserName;
                recharge.LastModifiedDate  = DateTime.Now;
                recharge.CreatedDate       = DateTime.Now;
                recharge.CreatorID         = Emp.UserName;
                recharge.DiscountInfo      = "会员套餐折扣";
                recharge.ClubCardPackageID = pkgId.ToString();
                recharge.RechargeType      = (int)RechargeType.ClubPackage;
                recharge.RechargeSerialNo  = SerialNoGenerator.GenRechargeSerialNo(Emp.StoreId);
                recharge.SalesMan          = card.SalesMan;

                var reMes = rechMgm.RechargePkg(recharge);
                if (reMes == 1)
                {
                    Session.Add("rehPkg", recharge);
                    data.Success = true;
                    data.Message = "套餐购买成功";
                }
                else
                {
                    data.Success = false;
                    data.Message = "套餐购买失败";
                }
            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "系统错误,请联系维护人员";
                data.Error   = ex.ToString();
                LogHandler.Error(ex.Message.ToString());
            }
            return(Json(data, JsonRequestBehavior.AllowGet));
        }