예제 #1
0
        public void SetupConfigModel(PromotionFeedConfigModel model, string controller, string secondFileName = null, string[] extensions = null)
        {
            var storeService = _ctx.Resolve <IStoreService>();
            var stores       = storeService.GetAllStores().ToList();

            var urlHelper   = new UrlHelper(HttpContext.Current.Request.RequestContext);
            var routeValues = new { /*Namespaces = _namespace + ".Controllers",*/ area = _namespace };

            model.GenerateFeedUrl         = urlHelper.Action("GenerateFeed", controller, routeValues);
            model.GenerateFeedProgressUrl = urlHelper.Action("GenerateFeedProgress", controller, routeValues);
            model.DeleteFilesUrl          = urlHelper.Action("DeleteFiles", controller, routeValues);

            model.Helper          = this;
            model.AvailableStores = new List <SelectListItem>();
            model.AvailableStores.Add(new SelectListItem()
            {
                Text = GetResource("Admin.Common.All"), Value = "0"
            });
            model.AvailableStores.AddRange(stores.ToSelectListItems());

            model.AvailableLanguages = new List <SelectListItem>();
            model.AvailableLanguages.Add(new SelectListItem()
            {
                Text = GetResource("Admin.Common.Standard"), Value = "0"
            });

            foreach (var language in LanguageService.GetAllLanguages())
            {
                model.AvailableLanguages.Add(new SelectListItem()
                {
                    Text  = language.Name,
                    Value = language.Id.ToString()
                });
            }

            if (!model.IsRunning)
            {
                model.IsRunning = (ScheduleTask != null && ScheduleTask.IsRunning);
            }

            if (model.IsRunning)
            {
                model.ProcessInfo = GetProgressInfo();
            }
            else
            {
                if (extensions != null)
                {
                    foreach (var ext in extensions)
                    {
                        model.GeneratedFiles.AddRange(GetFeedFiles(stores, null, ext));
                    }
                }
                else
                {
                    model.GeneratedFiles = GetFeedFiles(stores, secondFileName);
                }
            }
        }
예제 #2
0
        public void SetupConfigModel(PromotionFeedConfigModel model, string controller, string secondFileName = null, string[] extensions = null)
        {
            var storeService = _ctx.Resolve<IStoreService>();
            var stores = storeService.GetAllStores().ToList();

            var urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext);
            var routeValues = new { /*Namespaces = _namespace + ".Controllers",*/ area = _namespace };

            model.GenerateFeedUrl = urlHelper.Action("GenerateFeed", controller, routeValues);
            model.GenerateFeedProgressUrl = urlHelper.Action("GenerateFeedProgress", controller, routeValues);
            model.DeleteFilesUrl = urlHelper.Action("DeleteFiles", controller, routeValues);

            model.Helper = this;
            model.AvailableStores = new List<SelectListItem>();
            model.AvailableStores.Add(new SelectListItem() { Text = GetResource("Admin.Common.All"), Value = "0" });
            model.AvailableStores.AddRange(stores.ToSelectListItems());

            model.AvailableLanguages = new List<SelectListItem>();
            model.AvailableLanguages.Add(new SelectListItem() { Text = GetResource("Admin.Common.Standard"), Value = "0" });

            foreach (var language in LanguageService.GetAllLanguages())
            {
                model.AvailableLanguages.Add(new SelectListItem()
                {
                    Text = language.Name,
                    Value = language.Id.ToString()
                });
            }

            if (!model.IsRunning)
                model.IsRunning = (ScheduleTask != null && ScheduleTask.IsRunning);

            if (model.IsRunning)
            {
                model.ProcessInfo = GetProgressInfo();
            }
            else
            {
                if (extensions != null)
                {
                    foreach (var ext in extensions)
                        model.GeneratedFiles.AddRange(GetFeedFiles(stores, null, ext));
                }
                else
                {
                    model.GeneratedFiles = GetFeedFiles(stores, secondFileName);
                }
            }
        }