Example #1
0
        private void LoadStore(int regionId)
        {
            List <SelectListItem> storeIndustryList = new List <SelectListItem>();

            storeIndustryList.Add(new SelectListItem()
            {
                Text = "选择店铺行业", Value = "-1"
            });
            foreach (StoreIndustryInfo storeIndustryInfo in AdminStoreIndustries.GetStoreIndustryList())
            {
                storeIndustryList.Add(new SelectListItem()
                {
                    Text = storeIndustryInfo.Title, Value = storeIndustryInfo.StoreIid.ToString()
                });
            }
            ViewData["storeIndustryList"] = storeIndustryList;

            List <SelectListItem> themeList = new List <SelectListItem>();
            DirectoryInfo         dir       = new DirectoryInfo(IOHelper.GetMapPath("/themes"));

            foreach (DirectoryInfo themeDir in dir.GetDirectories())
            {
                themeList.Add(new SelectListItem()
                {
                    Text = themeDir.Name, Value = themeDir.Name
                });
            }
            ViewData["themeList"] = themeList;

            RegionInfo regionInfo = Regions.GetRegionById(regionId);

            if (regionInfo != null)
            {
                ViewData["provinceId"] = regionInfo.ProvinceId;
                ViewData["cityId"]     = regionInfo.CityId;
                ViewData["countyId"]   = regionInfo.RegionId;
            }
            else
            {
                ViewData["provinceId"] = -1;
                ViewData["cityId"]     = -1;
                ViewData["countyId"]   = -1;
            }

            string allowImgType = string.Empty;

            string[] imgTypeList = StringHelper.SplitString(BMAConfig.MallConfig.UploadImgType, ",");
            foreach (string imgType in imgTypeList)
            {
                allowImgType += string.Format("{0},", imgType.ToLower());
            }
            allowImgType = allowImgType.Replace(".", "");
            allowImgType = allowImgType.TrimEnd(',');

            string[] sizeList = StringHelper.SplitString(WorkContext.MallConfig.StoreLogoThumbSize);

            ViewData["size"]         = sizeList[sizeList.Length / 2];
            ViewData["allowImgType"] = allowImgType;
            ViewData["maxImgSize"]   = BMAConfig.MallConfig.UploadImgSize;
        }
        public ActionResult Edit(StoreIndustryModel model, int storeIid = -1)
        {
            StoreIndustryInfo storeIndustryInfo = AdminStoreIndustries.GetStoreIndustryById(storeIid);

            if (storeIndustryInfo == null)
            {
                return(PromptView("店铺行业不存在"));
            }

            int storeIid2 = AdminStoreIndustries.GetStoreIidByTitle(model.IndustryTitle);

            if (storeIid2 > 0 && storeIid2 != storeIid)
            {
                ModelState.AddModelError("IndustryTitle", "行业标题已经存在");
            }

            if (ModelState.IsValid)
            {
                storeIndustryInfo.Title        = model.IndustryTitle;
                storeIndustryInfo.DisplayOrder = model.DisplayOrder;

                AdminStoreIndustries.UpdateStoreIndustry(storeIndustryInfo);
                AddMallAdminLog("修改店铺行业", "修改店铺行业,店铺行业ID为:" + storeIid);
                return(PromptView("店铺行业修改成功"));
            }

            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
        /// <summary>
        /// 店铺行业列表
        /// </summary>
        public ActionResult List()
        {
            StoreIndustryListModel model = new StoreIndustryListModel()
            {
                StoreIndustryList = AdminStoreIndustries.GetStoreIndustryList()
            };

            MallUtils.SetAdminRefererCookie(Url.Action("list"));
            return(View(model));
        }
        /// <summary>
        /// 删除店铺行业
        /// </summary>
        public ActionResult Del(int storeIid)
        {
            int result = AdminStoreIndustries.DeleteStoreIndustryById(storeIid);

            if (result == -1)
            {
                return(PromptView("删除失败请先转移或删除此店铺行业下的店铺"));
            }

            AddMallAdminLog("删除店铺行业", "删除店铺行业,店铺行业ID为:" + storeIid);
            return(PromptView("店铺行业删除成功"));
        }
Example #5
0
        private void LoadStore(int regionId)
        {
            List <SelectListItem> storeIndustryList = new List <SelectListItem>();

            storeIndustryList.Add(new SelectListItem()
            {
                Text = "选择店铺行业", Value = "-1"
            });
            foreach (StoreIndustryInfo storeIndustryInfo in AdminStoreIndustries.GetStoreIndustryList())
            {
                storeIndustryList.Add(new SelectListItem()
                {
                    Text = storeIndustryInfo.Title, Value = storeIndustryInfo.StoreIid.ToString()
                });
            }
            ViewData["storeIndustryList"] = storeIndustryList;

            List <SelectListItem> themeList = new List <SelectListItem>();
            DirectoryInfo         dir       = new DirectoryInfo(IOHelper.GetMapPath("/themes"));

            foreach (DirectoryInfo themeDir in dir.GetDirectories())
            {
                themeList.Add(new SelectListItem()
                {
                    Text = themeDir.Name, Value = themeDir.Name
                });
            }
            ViewData["themeList"] = themeList;

            RegionInfo regionInfo = Regions.GetRegionById(regionId);

            if (regionInfo != null)
            {
                ViewData["provinceId"] = regionInfo.ProvinceId;
                ViewData["cityId"]     = regionInfo.CityId;
                ViewData["countyId"]   = regionInfo.RegionId;
            }
            else
            {
                ViewData["provinceId"] = -1;
                ViewData["cityId"]     = -1;
                ViewData["countyId"]   = -1;
            }

            ViewData["allowImgType"] = BMAConfig.UploadConfig.UploadImgType.Replace(".", "");
            ViewData["maxImgSize"]   = BMAConfig.UploadConfig.UploadImgSize;
        }
        public ActionResult Edit(int storeIid = -1)
        {
            StoreIndustryInfo storeIndustryInfo = AdminStoreIndustries.GetStoreIndustryById(storeIid);

            if (storeIndustryInfo == null)
            {
                return(PromptView("店铺行业不存在"));
            }

            StoreIndustryModel model = new StoreIndustryModel();

            model.IndustryTitle = storeIndustryInfo.Title;
            model.DisplayOrder  = storeIndustryInfo.DisplayOrder;

            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
        public ActionResult Add(StoreIndustryModel model)
        {
            if (AdminStoreIndustries.GetStoreIidByTitle(model.IndustryTitle) > 0)
            {
                ModelState.AddModelError("IndustryTitle", "行业标题已经存在");
            }

            if (ModelState.IsValid)
            {
                StoreIndustryInfo storeIndustryInfo = new StoreIndustryInfo()
                {
                    Title        = model.IndustryTitle,
                    DisplayOrder = model.DisplayOrder
                };

                AdminStoreIndustries.CreateStoreIndustry(storeIndustryInfo);
                AddMallAdminLog("添加店铺行业", "添加店铺行业,店铺行业为:" + model.IndustryTitle);
                return(PromptView("店铺行业添加成功"));
            }
            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
Example #8
0
        /// <summary>
        /// 店铺列表
        /// </summary>
        public ActionResult StoreList(string storeName, int storeRid = 0, int storeIid = 0, int state = -1, int pageNumber = 1, int pageSize = 15)
        {
            string condition = AdminStores.AdminGetStoreListCondition(storeName, storeRid, storeIid, state);

            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminStores.AdminGetStoreCount(condition));

            List <SelectListItem> storeRankList = new List <SelectListItem>();

            storeRankList.Add(new SelectListItem()
            {
                Text = "全部等级", Value = "0"
            });
            foreach (StoreRankInfo storeRankInfo in AdminStoreRanks.GetStoreRankList())
            {
                storeRankList.Add(new SelectListItem()
                {
                    Text = storeRankInfo.Title, Value = storeRankInfo.StoreRid.ToString()
                });
            }

            List <SelectListItem> storeIndustryList = new List <SelectListItem>();

            storeIndustryList.Add(new SelectListItem()
            {
                Text = "全部行业", Value = "0"
            });
            foreach (StoreIndustryInfo storeIndustryInfo in AdminStoreIndustries.GetStoreIndustryList())
            {
                storeIndustryList.Add(new SelectListItem()
                {
                    Text = storeIndustryInfo.Title, Value = storeIndustryInfo.StoreIid.ToString()
                });
            }

            List <SelectListItem> storeStateList = new List <SelectListItem>();

            storeStateList.Add(new SelectListItem()
            {
                Text = "全部", Value = "-1"
            });
            storeStateList.Add(new SelectListItem()
            {
                Text = "营业", Value = ((int)StoreState.Open).ToString()
            });
            storeStateList.Add(new SelectListItem()
            {
                Text = "关闭", Value = ((int)StoreState.Close).ToString()
            });

            StoreListModel model = new StoreListModel()
            {
                PageModel         = pageModel,
                StoreList         = AdminStores.AdminGetStoreList(pageModel.PageSize, pageModel.PageNumber, condition),
                StoreName         = storeName,
                StoreRid          = storeRid,
                StoreRankList     = storeRankList,
                StoreIid          = storeIid,
                StoreIndustryList = storeIndustryList,
                State             = state,
                StoreStateList    = storeStateList
            };

            MallUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&storeName={3}&storeRid={4}&storeIid={5}&state={6}",
                                                          Url.Action("storelist"),
                                                          pageModel.PageNumber, pageModel.PageSize,
                                                          storeName, storeRid, storeIid, state));
            return(View(model));
        }