public ActionResult SetConfig(FlashSaleConfigModel data)
        {
            _iLimitTimeBuyService.UpdateConfig(data);
            Result result = new Result {
                success = true
            };

            return(Json(result));
        }
Example #2
0
        public ActionResult SetConfig(FlashSaleConfigModel data)
        {
            _iLimitTimeBuyService.UpdateConfig(data);
            var isneedaudit = bool.Parse(Request.Form["isneedaudit"]);
            var setting     = SiteSettingApplication.SiteSettings;

            setting.LimitTimeBuyNeedAuditing = isneedaudit;
            SiteSettingApplication.SaveChanges();
            Result result = new Result {
                success = true
            };

            return(Json(result));
        }
Example #3
0
        public ActionResult Home(string catename = "")
        {
            Func <SelectListItem, bool> predicate = null;
            List <SelectListItem>       source    = new List <SelectListItem>();

            string[] serviceCategories = this._iLimitTimeBuyService.GetServiceCategories();
            foreach (string str in serviceCategories)
            {
                SelectListItem item = new SelectListItem
                {
                    Selected = false,
                    Text     = str,
                    Value    = str
                };
                source.Add(item);
            }
            if (!string.IsNullOrWhiteSpace(catename))
            {
                if (predicate == null)
                {
                    predicate = c => c.Text.Equals(catename);
                }
                SelectListItem item2 = source.FirstOrDefault <SelectListItem>(predicate);
                if (item2 != null)
                {
                    item2.Selected = true;
                }
            }
            FlashSaleConfigModel config = this._iLimitTimeBuyService.GetConfig();

            ((dynamic)base.ViewBag).Preheat = config.Preheat;
            ((dynamic)base.ViewBag).Cate    = source;
            FlashSaleQuery query = new FlashSaleQuery
            {
                CategoryName       = catename,
                OrderKey           = 5,
                IsPreheat          = true,
                PageNo             = 1,
                PageSize           = 10,
                AuditStatus        = FlashSaleInfo.FlashSaleStatus.Ongoing,
                CheckProductStatus = true
            };
            ObsoletePageModel <FlashSaleInfo> all = this._iLimitTimeBuyService.GetAll(query);

            return(base.View(all));
        }
Example #4
0
        /// <summary>
        /// 设置活动参数
        /// </summary>
        public void UpdateConfig(FlashSaleConfigModel data)
        {
            var model = DbFactory.Default.Get <FlashSaleConfigInfo>().FirstOrDefault();

            if (model == null)
            {
                model = new FlashSaleConfigInfo();
                model.IsNormalPurchase = data.IsNormalPurchase;
                model.Preheat          = data.Preheat;
                DbFactory.Default.Add(model);
            }
            else
            {
                model.IsNormalPurchase = data.IsNormalPurchase;
                model.Preheat          = data.Preheat;
                DbFactory.Default.Update(model);
            }
            string cacheKey = CacheKeyCollection.CACH_FLASHSALECONFIG;

            Cache.Remove(cacheKey);
        }
Example #5
0
        public FlashSaleConfigModel GetConfig()
        {
            string cacheKey = CacheKeyCollection.CACH_FLASHSALECONFIG;

            if (Cache.Exists(cacheKey))
            {
                return(Cache.Get <FlashSaleConfigModel>(cacheKey));
            }

            var model = DbFactory.Default.Get <FlashSaleConfigInfo>().FirstOrDefault();

            if (model == null)
            {
                model = new FlashSaleConfigInfo();
                model.IsNormalPurchase = true;
                model.Preheat          = 24;
                DbFactory.Default.Add(model);
            }
            var result = new FlashSaleConfigModel(model.Preheat, model.IsNormalPurchase);

            Cache.Insert <FlashSaleConfigModel>(cacheKey, result, 600);
            return(result);
        }