コード例 #1
0
        public JsonResult EditActive(FightGroupActiveModel model)
        {
            var result = new Result {
                success = false, msg = "未知错误", status = -1
            };
            FightGroupActiveModel data = FightGroupApplication.GetActive(model.Id);

            if (data == null)
            {
                throw new MallException("错误的活动编号");
            }
            if (model.EndTime < DateTime.Now)
            {
                throw new MallException("错误的结束时间");
            }
            if (model.EndTime < model.StartTime)
            {
                throw new MallException("错误的结束时间");
            }
            var market = MarketApplication.GetMarketService(CurrentSellerManager.ShopId, MarketType.FightGroup);

            if (market != null)
            {
                var endtime = MarketApplication.GetServiceEndTime(market.Id);
                var newEnd  = DateTime.Parse(endtime.ToString("yyyy-MM-dd") + " 23:59:59");
                if (newEnd < model.EndTime.Date)
                {
                    throw new MallException(string.Format("活动结束时间不得超过服务到期时间,<br/>您的服务到期时间为{0}", newEnd.ToString("yyyy-MM-dd HH:mm:ss")));
                }
            }
            else
            {
                throw new MallException("您没有订购此服务");
            }
            if (ModelState.IsValid)
            {
                TryUpdateModelAsync(data);

                model = data;
                //数据有效性验证
                model.CheckValidation();

                data.IconUrl = SaveActiveIcon(data.IconUrl);


                FightGroupApplication.UpdateActive(data);
                ProductManagerApplication.SaveCaculateMinPrice(model.ProductId, CurrentShop.Id);
                result = new Result {
                    success = true, msg = "操作成功", status = 1
                };
            }
            else
            {
                result = new Result {
                    success = false, msg = "数据异常,请检查数据有效性", status = -1
                };
            }
            return(Json(result));
        }
コード例 #2
0
        public object EditActive(FightGroupActiveModel model)
        {
            var result = new Result {
                success = false, msg = "未知错误", status = -1
            };
            FightGroupActiveModel data = FightGroupApplication.GetActive(model.Id);

            if (data == null)
            {
                throw new HimallException("错误的活动编号");
            }
            if (model.EndTime < DateTime.Now)
            {
                throw new HimallException("错误的结束时间");
            }
            if (model.EndTime < model.StartTime)
            {
                throw new HimallException("错误的结束时间");
            }
            try
            {
                //数据有效性验证
                //model.CheckValidation();
                data.ProductName             = model.ProductName;
                data.ProductShortDescription = model.ProductShortDescription;
                data.ProductDefaultImage     = model.ProductDefaultImage;
                data.ProductImages           = model.ProductImages;
                data.ShowMobileDescription   = model.ShowMobileDescription;
                data.ActiveItems             = model.ActiveItems;
                data.OpenGroupReward         = model.OpenGroupReward;
                data.InvitationReward        = model.InvitationReward;
                data.LimitQuantity           = model.LimitQuantity;
                data.LimitedNumber           = model.LimitedNumber;
                data.MiniSalePrice           = model.MiniSalePrice;
                data.StartTime   = model.StartTime;
                data.EndTime     = model.EndTime;
                data.IsCombo     = model.IsCombo;
                data.Seconds     = model.Seconds;
                data.LimitedHour = model.LimitedHour;
                data.GroupNotice = model.GroupNotice;
                data.IconUrl     = model.ProductDefaultImage;
                //订单有效日期,使用时间是什么鬼
                data.OrderDate   = model.OrderDate;
                data.UseDate     = model.UseDate;
                data.PayCode     = model.PayCode;
                data.ReturnMoney = model.ReturnMoney;
                FightGroupApplication.UpdateActive(data);
                result = new Result {
                    success = true, msg = "操作成功", status = 1
                };
            }
            catch (Exception ex)
            {
                result = new Result {
                    success = false, msg = ex.Message, status = -1
                };
            }
            return(Json(result));
        }
コード例 #3
0
        public JsonResult EndActive(long id)
        {
            Result result = new Result();
            var    data   = FightGroupApplication.GetActive(id, false, false);

            data.EndTime = DateTime.Now.AddMinutes(-1);
            FightGroupApplication.UpdateActive(data);
            ProductManagerApplication.SaveCaculateMinPrice(data.ProductId, CurrentShop.Id);
            result.success = true;
            result.msg     = "操作成功";
            return(Json(result));
        }
コード例 #4
0
        public JsonResult EditActive(FightGroupActiveModel model)
        {
            var result = new Result {
                success = false, msg = "未知错误", status = -1
            };
            FightGroupActiveModel data = FightGroupApplication.GetActive(model.Id);

            if (data == null)
            {
                throw new HimallException("错误的活动编号");
            }
            if (model.EndTime < DateTime.Now)
            {
                throw new HimallException("错误的结束时间");
            }
            if (model.EndTime < model.StartTime)
            {
                throw new HimallException("错误的结束时间");
            }

            if (ModelState.IsValid)
            {
                UpdateModel(data);

                model = data;
                //数据有效性验证
                model.CheckValidation();

                data.IconUrl = SaveActiveIcon(data.IconUrl);


                FightGroupApplication.UpdateActive(data);
                result = new Result {
                    success = true, msg = "操作成功", status = 1
                };
            }
            else
            {
                result = new Result {
                    success = false, msg = "数据异常,请检查数据有效性", status = -1
                };
            }
            return(Json(result));
        }