public Response SaveWaitPay(CoachStudentMoney obj, User currentUser)
        {
            Response rsp = new Response();
            //生成 待支付订单
            var vipUse = new VipUse();

            vipUse.Id         = Ext.NewId();
            vipUse.MasterType = MasterType.STUDENTPAYFORBOOTCAMP.Id;
            vipUse.MasterId   = obj.Id;
            vipUse.CityId     = obj.CityId;
            vipUse.VenueId    = "";
            vipUse.CostTypeId = CostType.COACHCOST.Id;

            vipUse.TotalAmount = obj.ThenMoney;
            vipUse.Discount    = 1;
            vipUse.Amount      = obj.ThenMoney * vipUse.Discount;
            vipUse.PayState    = PayState.PAY.Id;//待支付
            vipUse.IsOwnCreate = true;
            vipUse.Remark      = "购买了集训课";

            vipUse.UserId     = currentUser.Id;
            vipUse.CreatorId  = currentUser.Id;
            vipUse.CreateDate = DateTime.Now;
            rsp.Tag           = VipHelper.SaveVipUse(vipUse);
            rsp.IsSuccess     = true;

            return(rsp);
        }
        public Response Execute(User currentUser, string request)
        {
            var req    = JsonConvert.DeserializeObject <Request <VipUse> >(request);
            var vipUse = req.FirstEntity();

            if (string.IsNullOrEmpty(vipUse.CityId))
            {
                vipUse.CityId = "75";
            }

            Response rsp = ResultHelper.CreateResponse();

            //生成 待支付订单
            vipUse.Id          = Ext.NewId();
            vipUse.MasterType  = MasterType.YUEDOUPAY.Id;
            vipUse.MasterId    = "";
            vipUse.VenueId     = "";
            vipUse.CostTypeId  = CostType.YUEDOUCOST.Id;
            vipUse.Discount    = 1;
            vipUse.Amount      = vipUse.TotalAmount * vipUse.Discount;
            vipUse.PayState    = PayState.PAY.Id;//待支付
            vipUse.IsOwnCreate = true;
            vipUse.CreatorId   = currentUser.Id;
            vipUse.CreateDate  = DateTime.Now;
            rsp.Tag            = VipHelper.SaveVipUse(vipUse);
            rsp.IsSuccess      = true;
            return(rsp);
        }
Exemple #3
0
        public Response SaveWaitPay(CoachStudentMoneyNotPay obj, User currentUser)
        {
            Response rsp = new Response();
            //生成 待支付订单
            var vipUse = new VipUse();

            vipUse.Id         = Ext.NewId();
            vipUse.MasterType = MasterType.STUDENTPAY.Id;
            vipUse.MasterId   = obj.Id;
            vipUse.CityId     = obj.CityId;
            vipUse.VenueId    = "";
            vipUse.CostTypeId = CostType.COACHCOST.Id;

            vipUse.TotalAmount = obj.ThenMoney;
            vipUse.Discount    = 1;
            vipUse.Amount      = obj.ThenMoney * vipUse.Discount;
            vipUse.PayState    = PayState.PAY.Id;//待支付
            vipUse.IsOwnCreate = true;
            if (obj.CourseTypeId == CoachDic.BigCourse)
            {
                vipUse.Remark = "购买大课" + obj.Amount + "课时";
            }
            else if (obj.CourseTypeId == CoachDic.PrivateCourse)
            {
                vipUse.Remark = "购买私教" + obj.Amount + "课时";
            }

            vipUse.UserId     = currentUser.Id;
            vipUse.CreatorId  = currentUser.Id;
            vipUse.CreateDate = DateTime.Now;
            rsp.Tag           = VipHelper.SaveVipUse(vipUse);
            rsp.IsSuccess     = true;

            return(rsp);
        }
Exemple #4
0
        public Response GetYueDouBuyPayInfo(Request <GetVipRelatedFilter> req, VipPayInfo obj, User currentUser)
        {
            Response rsp = new Response();

            //获取我的余额
            var myBalance = VipHelper.GetVipAccount(currentUser.Id).FirstEntity <VipAccount>();

            if (myBalance != null)
            {
                obj.MyBalance = myBalance.Balance;
            }
            //折扣信息
            obj.Discount = 1;
            //支付状态
            if (req.Filter.PayType == "Use")
            {
                obj.PayState = GetVipUsePayState(req.Filter.PayId, req.Filter.PayType);
            }
            else
            {
                obj.PayState = GetVipBuyPayState(req.Filter.PayId, req.Filter.PayType);
            }
            //获取详细支付信息
            rsp = VipHelper.GetVipUseInfo(req.Filter.PayId, true);
            if (rsp.IsSuccess && rsp.Entities.Count > 0)
            {
                obj.VipUseInfo = rsp.FirstEntity <VipUse>();
            }

            return(rsp);
        }
Exemple #5
0
        /// <summary>
        /// 保存消费记录
        /// </summary>
        /// <param name="request">实体VipUse</param>
        /// <returns></returns>
        public Response Execute(string request)
        {
            var req = JsonConvert.DeserializeObject <Request <VipUse> >(request);

            var result = ResultHelper.Success();

            result.Tag = VipHelper.SaveVipUse(req.Entities.FirstOrDefault());; //返回主键,供下一步使用。

            return(result);
        }
Exemple #6
0
        /// <summary>
        /// 获取充值购买记录
        /// </summary>
        /// <param name="request">过滤器VipBuy</param>
        /// <returns>VipBuy</returns>
        public Response Execute(string request)
        {
            var req = JsonConvert.DeserializeObject <Request <VipBuy> >(request);
            var obj = VipHelper.GetVipBuy(req.Filter.Id);

            if (obj == null)
            {
                return(ResultHelper.Fail("记录不存在。可能已被删除。"));
            }
            return(ResultHelper.Success(new List <EntityBase> {
                obj
            }));
        }
Exemple #7
0
        public Response GetVenuePayInfo(Request <GetVipRelatedFilter> req, VipPayInfo obj, User currentUser)
        {
            Response rsp = new Response();
            //获取 Name, HeadUrl
            var sql = @"
SELECT HeadUrl,Name FROM dbo.Venue WHERE Id=@Id
";
            var cmd = CommandHelper.CreateText <Venue>(FetchType.Fetch, sql);

            cmd.Params.Add("@Id", req.Filter.MasterId);
            rsp = DbContext.GetInstance().Execute(cmd);
            if (rsp.Entities.Count > 0)
            {
                obj.HeadUrl = rsp.FirstEntity <Venue>().HeadUrl;
                obj.Name    = rsp.FirstEntity <Venue>().Name;
            }
            //获取我的余额
            var myBalance = VipHelper.GetVipAccount(currentUser.Id).FirstEntity <VipAccount>();

            if (myBalance != null)
            {
                obj.MyBalance = myBalance.Balance;
            }
            //折扣信息
            obj.Discount = 1;
            //支付状态
            if (req.Filter.PayType == "Use")
            {
                obj.PayState = GetVipUsePayState(req.Filter.PayId, req.Filter.PayType);
            }
            else
            {
                obj.PayState = GetVipBuyPayState(req.Filter.PayId, req.Filter.PayType);
            }

            obj.VipRechargeScaleList  = VipHelper.GetVipRechargeScaleList().Entities.ToList <EntityBase, VipRechargeScale>();
            obj.YueDouBalance         = PayHelper.Instance.GetYueDouBalance(currentUser.Id);
            obj.ConvertibleProportion = UserHelper.GetConfig().YueDouConvertibleProportion;

            return(rsp);
        }
Exemple #8
0
        /// <summary>
        /// 获取VIP账户
        /// </summary>
        /// <param name="request">过滤器VipAccount.Id</param>
        /// <returns>VipAccount</returns>
        public Response Execute(User currentUser, string request)
        {
            var req = JsonConvert.DeserializeObject <Request <VipAccount> >(request);

            return(VipHelper.GetVipAccount(req.Filter.Id));
        }
Exemple #9
0
        /// <summary>
        /// 获取消费记录
        /// </summary>
        /// <param name="request">过滤器VipUse</param>
        /// <returns>VipUse</returns>
        public Response Execute(string request)
        {
            var req = JsonConvert.DeserializeObject <Request <VipUse> >(request);

            return(VipHelper.GetVipUseInfo(req.Filter.Id, req.Filter.IsLiveUpdate));
        }
 /// <summary>
 /// 获取充值配送比率列表
 /// </summary>
 /// <param name="request">过滤器VipRechargeScale</param>
 /// <returns>VipRechargeScale</returns>
 public Response Execute(string request)
 {
     
     return VipHelper.GetVipRechargeScaleList();
 }