コード例 #1
0
ファイル: CategoryController.cs プロジェクト: thfthf2/NStore
        public ActionResult EditAttributeGroup(AttributeGroupModel model, int attrGroupId = -1)
        {
            AttributeGroupInfo attributeGroupInfo = AdminCategories.GetAttributeGroupById(attrGroupId);

            if (attributeGroupInfo == null)
            {
                return(PromptView("属性分组不存在"));
            }

            int attrGroupId2 = AdminCategories.GetAttributeGroupIdByName(model.AttributeGroupName);

            if (attrGroupId2 > 0 && attrGroupId2 != attrGroupId)
            {
                ModelState.AddModelError("AttributeGroupName", "名称已经存在");
            }

            if (ModelState.IsValid)
            {
                attributeGroupInfo.Name         = model.AttributeGroupName;
                attributeGroupInfo.DisplayOrder = model.DisplayOrder;

                AdminCategories.UpdateAttributeGroup(attributeGroupInfo);
                AddMallAdminLog("修改属性分组", "修改属性分组,属性分组ID为:" + attrGroupId);
                return(PromptView("属性分组修改成功"));
            }

            //CategoryInfo categoryInfo = AdminCategories.GetCategoryById(attributeGroupInfo.CateId);
            //ViewData["cateId"] = categoryInfo.CateId;
            //ViewData["categoryName"] = categoryInfo.Name;
            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
コード例 #2
0
        public ActionResult Add()
        {
            BannedIPModel model = new BannedIPModel();

            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
コード例 #3
0
ファイル: StoreController.cs プロジェクト: freemsly/BrnShop
        public ActionResult AddStoreShipTemplate()
        {
            AddStoreShipTemplateModel model = new AddStoreShipTemplateModel();

            ViewData["referer"] = MallUtils.GetStoreAdminRefererCookie();
            return(View(model));
        }
コード例 #4
0
ファイル: StoreController.cs プロジェクト: xiaoshihr/CMall
        private void LoadStoreShipFee(int regionId)
        {
            RegionInfo regionInfo = Regions.GetRegionById(regionId);

            if (regionInfo != null)
            {
                if (regionInfo.Layer == 1)
                {
                    ViewData["provinceId"] = regionInfo.ProvinceId;
                    ViewData["cityId"]     = 0;
                }
                else
                {
                    RegionInfo parentRegionInfo = Regions.GetRegionById(regionInfo.ParentId);
                    ViewData["provinceId"] = parentRegionInfo.ProvinceId;
                    ViewData["cityId"]     = regionInfo.RegionId;
                }
            }
            else
            {
                ViewData["provinceId"] = 0;
                ViewData["cityId"]     = 0;
            }

            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
        }
コード例 #5
0
ファイル: NewsController.cs プロジェクト: thfthf2/NStore
        public ActionResult AddNewsType()
        {
            NewsTypeModel model = new NewsTypeModel();

            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
コード例 #6
0
        public ActionResult AddAdvertPosition()
        {
            AdvertPositionModel model = new AdvertPositionModel();

            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
コード例 #7
0
        private void LoadCouponType()
        {
            List <SelectListItem> userRankList = new List <SelectListItem>();

            foreach (UserRankInfo userRankInfo in AdminUserRanks.GetCustomerUserRankList())
            {
                userRankList.Add(new SelectListItem()
                {
                    Text = userRankInfo.Title, Value = userRankInfo.UserRid.ToString()
                });
            }
            ViewData["userRankList"] = userRankList;

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

            storeClassList.Add(new SelectListItem()
            {
                Text = "无限制", Value = "0"
            });
            foreach (StoreClassInfo storeClassInfo in AdminStores.GetStoreClassList(WorkContext.StoreId))
            {
                storeClassList.Add(new SelectListItem()
                {
                    Text = storeClassInfo.Name, Value = storeClassInfo.StoreCid.ToString()
                });
            }
            ViewData["storeClassList"] = storeClassList;

            ViewData["referer"] = MallUtils.GetStoreAdminRefererCookie();
        }
コード例 #8
0
        public ActionResult Edit(ShipCompanyModel model, int shipCoId = -1)
        {
            ShipCompanyInfo shipCompanyInfo = AdminShipCompanies.GetShipCompanyById(shipCoId);

            if (shipCompanyInfo == null)
            {
                return(PromptView("配送公司不存在"));
            }

            int shipCoId2 = AdminShipCompanies.GetShipCoIdByName(model.CompanyName);

            if (shipCoId2 > 0 && shipCoId2 != shipCoId)
            {
                ModelState.AddModelError("CompanyName", "名称已经存在");
            }

            if (ModelState.IsValid)
            {
                shipCompanyInfo.DisplayOrder = model.DisplayOrder;
                shipCompanyInfo.Name         = model.CompanyName;

                AdminShipCompanies.UpdateShipCompany(shipCompanyInfo);
                AddMallAdminLog("修改配送公司", "修改配送公司,配送公司ID为:" + shipCoId);
                return(PromptView("配送公司修改成功"));
            }

            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
コード例 #9
0
        /// <summary>
        /// 品牌列表
        /// </summary>
        /// <param name="brandName">品牌名称</param>
        /// <param name="sortColumn">排序列</param>
        /// <param name="sortDirection">排序方向</param>
        /// <param name="pageSize">每页数</param>
        /// <param name="pageNumber">当前页数</param>
        /// <returns></returns>
        public ActionResult List(string brandName, string sortColumn, string sortDirection, int pageSize = 15, int pageNumber = 1)
        {
            string condition = AdminBrands.AdminGetBrandListCondition(brandName);
            string sort      = AdminBrands.AdminGetBrandListSort(sortColumn, sortDirection);

            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminBrands.AdminGetBrandCount(condition));

            BrandListModel model = new BrandListModel()
            {
                BrandList     = AdminBrands.AdminGetBrandList(pageModel.PageSize, pageModel.PageNumber, condition, sort),
                PageModel     = pageModel,
                SortColumn    = sortColumn,
                SortDirection = sortDirection,
                BrandName     = brandName
            };

            MallUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&sortColumn={3}&sortDirection={4}&brandName={5}",
                                                          Url.Action("list"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          sortColumn,
                                                          sortDirection,
                                                          brandName));
            return(View(model));
        }
コード例 #10
0
ファイル: CategoryController.cs プロジェクト: thfthf2/NStore
        public ActionResult EditAttributeValue(AttributeValueModel model, int attrValueId = 0)
        {
            AttributeValueInfo attributeValueInfo = AdminCategories.GetAttributeValueById(attrValueId);

            if (attributeValueInfo == null)
            {
                return(PromptView("属性值不存在"));
            }
            //if (attributeValueInfo.IsInput == 1)
            //    return PromptView("输入型属性值不能修改");

            int attrValueId2 = AdminCategories.GetAttributeValueIdByAttrIdAndValue(attributeValueInfo.AttrId, model.AttrValue);

            if (attrValueId2 > 0 && attrValueId2 != attrValueId)
            {
                ModelState.AddModelError("AttrValue", "值已经存在");
            }

            if (ModelState.IsValid)
            {
                attributeValueInfo.AttrValue             = model.AttrValue;
                attributeValueInfo.AttrValueDisplayOrder = model.DisplayOrder;
                AdminCategories.UpdateAttributeValue(attributeValueInfo);
                AddMallAdminLog("修改属性值", "修改属性值,属性值ID为:" + attrValueId);
                return(PromptView("属性值修改成功"));
            }

            AttributeInfo attributeInfo = Categories.GetAttributeById(attributeValueInfo.AttrId);

            ViewData["attrId"]        = attributeInfo.AttrId;
            ViewData["attributeName"] = attributeInfo.Name;
            ViewData["referer"]       = MallUtils.GetMallAdminRefererCookie();

            return(View(model));
        }
コード例 #11
0
        /// <summary>
        /// 验证图片
        /// </summary>
        /// <param name="width">图片宽度</param>
        /// <param name="height">图片高度</param>
        /// <returns></returns>
        public ImageResult VerifyImage(int width = 56, int height = 20)
        {
            //获得用户唯一标示符sid
            string sid = MallUtils.GetSidCookie();

            //当sid为空时
            if (sid == null)
            {
                //生成sid
                sid = Sessions.GenerateSid();
                //将sid保存到cookie中
                MallUtils.SetSidCookie(sid);
            }

            //生成验证值
            string verifyValue = Randoms.CreateRandomValue(4, false).ToLower();
            //生成验证图片
            RandomImage verifyImage = Randoms.CreateRandomImage(verifyValue, width, height, Color.White, Color.Blue, Color.DarkRed);

            //将验证值保存到session中
            Sessions.SetItem(sid, "verifyCode", verifyValue);

            //输出验证图片
            return(new ImageResult(verifyImage.Image, verifyImage.ContentType));
        }
コード例 #12
0
ファイル: CategoryController.cs プロジェクト: thfthf2/NStore
        public ActionResult EditAttributeValue(int attrValueId = -1)
        {
            AttributeValueInfo attributeValueInfo = AdminCategories.GetAttributeValueById(attrValueId);

            if (attributeValueInfo == null)
            {
                return(PromptView("属性值不存在"));
            }
            if (attributeValueInfo.IsInput == 1)
            {
                return(PromptView("输入型属性值不能修改"));
            }

            AttributeValueModel model = new AttributeValueModel();

            model.AttrValue    = attributeValueInfo.AttrValue;
            model.DisplayOrder = attributeValueInfo.AttrValueDisplayOrder;

            AttributeInfo attributeInfo = Categories.GetAttributeById(attributeValueInfo.AttrId);

            ViewData["attrId"]        = attributeInfo.AttrId;
            ViewData["attributeName"] = attributeInfo.Name;
            ViewData["referer"]       = MallUtils.GetMallAdminRefererCookie();

            return(View(model));
        }
コード例 #13
0
ファイル: CategoryController.cs プロジェクト: thfthf2/NStore
        public ActionResult EditAttribute(int attrId = -1)
        {
            AttributeInfo attributeInfo = AdminCategories.GetAttributeById(attrId);

            if (attributeInfo == null)
            {
                return(PromptView("属性不存在"));
            }

            AttributeModel model = new AttributeModel();

            model.AttributName = attributeInfo.Name;
            model.AttrGroupId  = attributeInfo.AttrGroupId;
            model.ShowType     = attributeInfo.ShowType;
            //model.IsFilter = attributeInfo.IsFilter;
            model.DisplayOrder = attributeInfo.DisplayOrder;

            //CategoryInfo categoryInfo = AdminCategories.GetCategoryById(attributeInfo.CateId);
            //ViewData["cateId"] = categoryInfo.CateId;
            //ViewData["categoryName"] = categoryInfo.Name;
            //ViewData["attributeGroupList"] = GetAttributeGroupSelectList();
            AttributeGroupInfo attributeGroupInfo = AdminCategories.GetAttributeGroupById(attributeInfo.AttrGroupId);

            ViewData["attributeGroupName"] = attributeGroupInfo.Name;
            ViewData["referer"]            = MallUtils.GetMallAdminRefererCookie();

            return(View(model));
        }
コード例 #14
0
ファイル: CategoryController.cs プロジェクト: thfthf2/NStore
        public ActionResult AddAttribute(AttributeModel model)
        {
            if (AdminCategories.GetAttrIdByName(model.AttributName) > 0)
            {
                ModelState.AddModelError("AttributName", "名称已经存在");
            }

            //AttributeGroupInfo attributeGroupInfo = AdminCategories.GetAttributeGroupById(model.AttrGroupId);
            //if (attributeGroupInfo == null || attributeGroupInfo.CateId != cateId)
            //    ModelState.AddModelError("AttrGroupId", "属性组不存在");

            if (ModelState.IsValid)
            {
                AttributeInfo attributeInfo = new AttributeInfo();
                attributeInfo.Name = model.AttributName;
                //attributeInfo.CateId = cateId;
                attributeInfo.AttrGroupId = model.AttrGroupId;
                attributeInfo.ShowType    = model.ShowType;
                //attributeInfo.IsFilter = model.IsFilter;
                attributeInfo.DisplayOrder = model.DisplayOrder;

                AdminCategories.CreateAttribute(attributeInfo, null);
                AddMallAdminLog("添加属性", "添加属性,属性为:" + model.AttributName);
                return(PromptView("属性添加成功"));
            }
            //ViewData["cateId"] = categoryInfo.CateId;
            //ViewData["categoryName"] = categoryInfo.Name;
            //ViewData["attributeGroupList"] = GetAttributeGroupSelectList(cateId);
            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
コード例 #15
0
        /// <summary>
        /// 商品评价列表
        /// </summary>
        public ActionResult ProductReviewList(string storeName, string message, string rateStartTime, string rateEndTime, string sortColumn, string sortDirection, int storeId = -1, int pid = 0, int pageNumber = 1, int pageSize = 15)
        {
            string condition = AdminProductReviews.AdminGetProductReviewListCondition(storeId, pid, message, rateStartTime, rateEndTime);
            string sort      = AdminProductReviews.AdminGetProductReviewListSort(sortColumn, sortDirection);

            PageModel pageModel          = new PageModel(pageSize, pageNumber, AdminProductReviews.AdminGetProductReviewCount(condition));
            ProductReviewListModel model = new ProductReviewListModel()
            {
                PageModel         = pageModel,
                SortColumn        = sortColumn,
                SortDirection     = sortDirection,
                ProductReviewList = AdminProductReviews.AdminGetProductReviewList(pageModel.PageSize, pageModel.PageNumber, condition, sort),
                StoreId           = storeId,
                StoreName         = string.IsNullOrWhiteSpace(storeName) ? "全部店铺" : storeName,
                Pid       = pid,
                Message   = message,
                StartTime = rateStartTime,
                EndTime   = rateEndTime
            };

            MallUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&sortColumn={3}&sortDirection={4}&storeId={5}&storeName={6}&pid={7}&message={8}&startTime={9}&endTime={10}",
                                                          Url.Action("productreviewlist"),
                                                          pageModel.PageNumber, pageModel.PageSize,
                                                          sortColumn, sortDirection,
                                                          storeId, storeName, pid,
                                                          message, rateStartTime, rateEndTime));
            return(View(model));
        }
コード例 #16
0
        public ActionResult Add()
        {
            StoreIndustryModel model = new StoreIndustryModel();

            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
コード例 #17
0
        /// <summary>
        /// 广告列表
        /// </summary>
        public ActionResult AdvertList(int adPosId = 0, int pageSize = 15, int pageNumber = 1)
        {
            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminAdverts.AdminGetAdvertCount(adPosId));

            AdvertListModel model = new AdvertListModel()
            {
                PageModel  = pageModel,
                AdPosId    = adPosId,
                AdvertList = AdminAdverts.AdminGetAdvertList(pageModel.PageSize, pageModel.PageNumber, adPosId)
            };

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

            itemList.Add(new SelectListItem()
            {
                Text = "全部广告位置", Value = "0"
            });
            foreach (AdvertPositionInfo advertPositionInfo in AdminAdverts.GetAllAdvertPosition())
            {
                itemList.Add(new SelectListItem()
                {
                    Text = advertPositionInfo.Title, Value = advertPositionInfo.AdPosId.ToString()
                });
            }
            ViewData["advertPositionList"] = itemList;

            MallUtils.SetAdminRefererCookie(string.Format("{0}?adPosId={1}&pageNumber={2}&pageSize={3}", Url.Action("advertlist"), adPosId, pageModel.PageNumber, pageModel.PageSize));
            return(View(model));
        }
コード例 #18
0
        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));
        }
コード例 #19
0
ファイル: AccountController.cs プロジェクト: hzl091/BrnShop
        /// <summary>
        /// 验证找回密码手机
        /// </summary>
        public ActionResult VerifyFindPwdMobile()
        {
            int    uid        = WebHelper.GetQueryInt("uid");
            string mobileCode = WebHelper.GetFormString("mobileCode");

            PartUserInfo partUserInfo = Users.GetPartUserById(uid);

            if (partUserInfo == null)
            {
                return(AjaxResult("nouser", "用户不存在"));
            }
            if (partUserInfo.Mobile.Length == 0)
            {
                return(AjaxResult("nocanfind", "由于您没有设置手机,所以不能通过手机找回此账号的密码"));
            }

            //检查手机码
            if (string.IsNullOrWhiteSpace(mobileCode))
            {
                return(AjaxResult("emptymobilecode", "手机验证码不能为空"));
            }
            else if (Sessions.GetValueString(WorkContext.Sid, "findPwdMoibleCode") != mobileCode)
            {
                return(AjaxResult("wrongmobilecode", "手机验证码不正确"));
            }

            string v   = MallUtils.AESEncrypt(string.Format("{0},{1},{2}", partUserInfo.Uid, DateTime.Now, Randoms.CreateRandomValue(6)));
            string url = string.Format("http://{0}{1}", Request.Url.Authority, Url.Action("resetpwd", new RouteValueDictionary {
                { "v", v }
            }));

            return(AjaxResult("success", url));
        }
コード例 #20
0
        public ActionResult Edit(FilterWordModel model, int id = -1)
        {
            List <FilterWordInfo> filterWordList = AdminFilterWords.GetFilterWordList();
            FilterWordInfo        filterWordInfo = filterWordList.Find(x => x.Id == id);

            if (filterWordInfo == null)
            {
                return(PromptView("筛选词不存在"));
            }

            if (!string.IsNullOrWhiteSpace(model.Match))
            {
                FilterWordInfo filterWordInfo2 = filterWordList.Find(x => x.Match == model.Match.Trim());
                if (filterWordInfo2 != null && filterWordInfo2.Id != id)
                {
                    ModelState.AddModelError("Match", "筛选词已经存在");
                }
            }

            if (ModelState.IsValid)
            {
                filterWordInfo.Match   = model.Match.Trim();
                filterWordInfo.Replace = model.Replace.Trim();

                AdminFilterWords.UpdateFilterWord(filterWordInfo);
                AddMallAdminLog("修改筛选词", "修改筛选词,筛选词ID为:" + id);
                return(PromptView("筛选词修改成功"));
            }

            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
コード例 #21
0
        /// <summary>
        /// 优惠劵商品列表
        /// </summary>
        /// <param name="couponTypeId">优惠劵类型id</param>
        /// <returns></returns>
        public ActionResult CouponProductList(int couponTypeId = -1, int pid = -1, int pageSize = 15, int pageNumber = 1)
        {
            CouponTypeInfo couponTypeInfo = AdminCoupons.AdminGetCouponTypeById(couponTypeId);

            if (couponTypeInfo == null)
            {
                return(PromptView("优惠劵类型不存在"));
            }
            if (couponTypeInfo.LimitProduct == 0)
            {
                return(PromptView("此优惠劵类型没有限制商品"));
            }

            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminCoupons.AdminGetCouponProductCount(couponTypeId));

            CouponProductListModel model = new CouponProductListModel()
            {
                CouponProductList = AdminCoupons.AdminGetCouponProductList(pageSize, pageNumber, couponTypeId),
                PageModel         = pageModel,
                CouponTypeId      = couponTypeId,
                StoreId           = couponTypeInfo.StoreId
            };

            MallUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&couponTypeId={3}",
                                                          Url.Action("couponproductlist"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          couponTypeId));
            return(View(model));
        }
コード例 #22
0
        /// <summary>
        /// 筛选词列表
        /// </summary>
        /// <param name="searchFilterWord">搜索筛选词</param>
        /// <param name="pageSize">每页数</param>
        /// <param name="pageNumber">当前页数</param>
        /// <returns></returns>
        public ActionResult List(string searchFilterWord, int pageSize = 15, int pageNumber = 1)
        {
            List <FilterWordInfo> filterWordList = AdminFilterWords.GetFilterWordList();

            if (!string.IsNullOrWhiteSpace(searchFilterWord))
            {
                filterWordList = filterWordList.FindAll(x => x.Match.Contains(searchFilterWord));
            }

            PageModel pageModel = new PageModel(pageSize, pageNumber, filterWordList.Count);

            FilterWordListModel model = new FilterWordListModel()
            {
                FilterWordList   = filterWordList,
                PageModel        = pageModel,
                SearchFilterWord = searchFilterWord
            };

            MallUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&searchFilterWord={3}",
                                                          Url.Action("list"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          searchFilterWord));
            return(View(model));
        }
コード例 #23
0
ファイル: NewsController.cs プロジェクト: thfthf2/NStore
        /// <summary>
        /// 新闻类型列表
        /// </summary>
        public ActionResult NewsTypeList()
        {
            List <NewsTypeInfo> newsTypeList = News.GetNewsTypeList();

            MallUtils.SetAdminRefererCookie(Url.Action("newstypelist"));
            return(View(newsTypeList));
        }
コード例 #24
0
        public ActionResult Add()
        {
            FilterWordModel model = new FilterWordModel();

            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
コード例 #25
0
ファイル: NewsController.cs プロジェクト: thfthf2/NStore
        public ActionResult EditNewsType(NewsTypeModel model, int newsTypeId = -1)
        {
            NewsTypeInfo newsTypeInfo = AdminNews.GetNewsTypeById(newsTypeId);

            if (newsTypeInfo == null)
            {
                return(PromptView("新闻类型不存在"));
            }

            NewsTypeInfo newsTypeInfo2 = AdminNews.GetNewsTypeByName(model.NewsTypeName);

            if (newsTypeInfo2 != null && newsTypeInfo2.NewsTypeId != newsTypeId)
            {
                ModelState.AddModelError("NewsTypeName", "名称已经存在");
            }

            if (ModelState.IsValid)
            {
                newsTypeInfo.Name         = model.NewsTypeName;
                newsTypeInfo.DisplayOrder = model.DisplayOrder;

                AdminNews.UpdateNewsType(newsTypeInfo);
                AddMallAdminLog("修改新闻类型", "修改新闻类型,新闻类型ID为:" + newsTypeId);
                return(PromptView("新闻类型修改成功"));
            }

            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
コード例 #26
0
ファイル: HelpController.cs プロジェクト: thfthf2/NStore
        public ActionResult EditHelpCategory(HelpCategoryModel model, int id = -1)
        {
            HelpInfo helpInfo = AdminHelps.GetHelpById(id);

            if (helpInfo == null)
            {
                return(PromptView("帮助分类不存在"));
            }

            if (ModelState.IsValid)
            {
                helpInfo.Pid          = 0;
                helpInfo.Title        = model.HelpCategoryTitle;
                helpInfo.Url          = "";
                helpInfo.Description  = "";
                helpInfo.DisplayOrder = model.DisplayOrder;

                AdminHelps.UpdateHelp(helpInfo);
                AddMallAdminLog("修改帮助分类", "修改帮助分类,帮助分类ID为:" + id);
                return(PromptView("帮助分类修改成功"));
            }

            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
コード例 #27
0
        public ActionResult Add(BannedIPModel model)
        {
            string ip = "";

            if (string.IsNullOrWhiteSpace(model.IP4))
            {
                ip = string.Format("{0}.{1}.{2}", model.IP1, model.IP2, model.IP3);
            }
            else
            {
                ip = string.Format("{0}.{1}.{2}.{3}", model.IP1, model.IP2, model.IP3, model.IP4);
            }

            if (AdminBannedIPs.GetBannedIPIdByIP(ip) > 0)
            {
                ModelState.AddModelError("IP4", "IP已经存在");
            }

            if (ModelState.IsValid)
            {
                BannedIPInfo bannedIPInfo = new BannedIPInfo()
                {
                    IP          = ip,
                    LiftBanTime = model.LiftBanTime
                };

                AdminBannedIPs.AddBannedIP(bannedIPInfo);
                AddMallAdminLog("添加禁止IP", "添加禁止IP,禁止IP为:" + ip);
                return(PromptView("禁止IP添加成功"));
            }
            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
コード例 #28
0
ファイル: HelpController.cs プロジェクト: thfthf2/NStore
        public ActionResult AddHelpCategory()
        {
            HelpCategoryModel model = new HelpCategoryModel();

            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
コード例 #29
0
ファイル: StoreController.cs プロジェクト: freemsly/BrnShop
        public ActionResult EditStoreShipTemplate(EditStoreShipTemplateModel model, int storeSTid = -1)
        {
            StoreShipTemplateInfo storeShipTemplateInfo = AdminStores.GetStoreShipTemplateById(storeSTid);

            if (storeShipTemplateInfo == null)
            {
                return(PromptView("店铺配送模板不存在"));
            }
            if (storeShipTemplateInfo.StoreId != WorkContext.StoreId)
            {
                return(PromptView("不能操作其它店铺的配送模板"));
            }

            if (ModelState.IsValid)
            {
                storeShipTemplateInfo.Title = model.TemplateTitle;
                storeShipTemplateInfo.Free  = model.Free;
                storeShipTemplateInfo.Type  = model.Type;

                AdminStores.UpdateStoreShipTemplate(storeShipTemplateInfo);
                AddStoreAdminLog("修改店铺配送模板", "修改店铺配送模板,店铺配送模板ID为:" + storeSTid);
                return(PromptView("店铺配送模板修改成功"));
            }

            ViewData["referer"] = MallUtils.GetStoreAdminRefererCookie();
            return(View(model));
        }
コード例 #30
0
ファイル: CategoryController.cs プロジェクト: thfthf2/NStore
        public ActionResult AddAttributeGroup(AttributeGroupModel model)
        {
            //CategoryInfo categoryInfo = AdminCategories.GetCategoryById(cateId);
            //if (categoryInfo == null)
            //    return PromptView("分类不存在");

            if (AdminCategories.GetAttributeGroupIdByName(model.AttributeGroupName) > 0)
            {
                ModelState.AddModelError("AttributeGroupName", "名称已经存在");
            }

            if (ModelState.IsValid)
            {
                AttributeGroupInfo attributeGroupInfo = new AttributeGroupInfo()
                {
                    Name = model.AttributeGroupName,
                    //CateId = categoryInfo.CateId,
                    DisplayOrder = model.DisplayOrder
                };

                AdminCategories.CreateAttributeGroup(attributeGroupInfo);
                AddMallAdminLog("添加属性分组", "添加属性分组,属性分组为:" + model.AttributeGroupName);
                return(PromptView("属性分组添加成功"));
            }
            //ViewData["cateId"] = categoryInfo.CateId;
            //ViewData["categoryName"] = categoryInfo.Name;
            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }