コード例 #1
0
        /// <summary>
        /// 专题页的商品管理
        /// </summary>
        /// <returns></returns>
        public ActionResult ManageProduct(string topicNo, int pageindex = 1)
        {
            int    pageSize        = 10;
            string categoryNo      = Request["CategoryNo"];
            string brandNo         = Request["BrandNo"];
            string productNoOrName = Request["ProductNameOrNo"];

            if (!string.IsNullOrEmpty(productNoOrName) && productNoOrName.Equals("商品编号/商品名称"))
            {
                productNoOrName = "";
            }
            /////////////////////////分页保留查询数据用///////////////////////////////
            ViewBag.CategoryNo      = categoryNo ?? "";
            ViewBag.ProductNameOrNo = productNoOrName ?? "";
            ViewBag.BrandName       = Request.QueryString["BrandName"] ?? "";
            ViewBag.BrandNo         = brandNo ?? "";

            ///////////////////////////分页保留查询数据用/////////////////////////////

            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("brandNo", brandNo ?? "");
            dic.Add("productNoOrName", productNoOrName ?? "");
            dic.Add("gCategroyNo", categoryNo ?? "");
            dic.Add("topicId", topicNo ?? "");

            SWfsTopicService topicServ        = new SWfsTopicService();
            var productList                   = topicServ.GetProductListByTopicNo(dic, pageindex, pageSize);
            SWfsProductService productService = new SWfsProductService();
            ProductInventory   pin            = new ProductInventory();

            foreach (var product in productList.Items)
            {
                pin = productService.GetInventoryByProductNo(product.ProductNo);
                product.Quantity     = pin.SumQuantity;
                product.LockQuantity = pin.SumLockQuantity;
            }
            //所有的一级分类
            SWfsSubjectService subject = new SWfsSubjectService();

            ViewBag.AllFirstCategory = subject.SelectErpCategoryByParentNo("ROOT");
            ViewBag.TopicNo          = topicNo;

            SWfsTopics topicModel = topicServ.GetSWfsTopics(topicNo);

            ViewBag.TopicName = (null != topicModel) ? topicModel.TopicName : "";
            return(View(productList));
        }
コード例 #2
0
        public ActionResult UpdateGoods(int pageIndex = 1, int pageSize = 20)
        {
            string id    = Request.QueryString["GoodsId"].ToString();
            int    total = 0;
            IEnumerable <ProductInfo> list = productService.GetUpdateGoods(int.Parse(id));

            SWfsProductService service = new SWfsProductService();

            foreach (var item in list)
            {
                //商品下的Skulist
                var skuList = productService.GetSkuListByProductNo(item.ProductNo);
                if (skuList.Any())
                {
                    //价格,上下架状态
                    item.MarketPriceRegion    = skuList.Select(n => n.MarketPrice).Min().ToString() + "~" + skuList.Select(n => n.MarketPrice).Max().ToString();
                    item.StandardPriceRegion  = skuList.Select(n => n.StandardPrice).Min().ToString() + "~" + skuList.Select(n => n.StandardPrice).Max().ToString();
                    item.GoldPriceRegion      = skuList.Select(n => n.GoldPrice).Min().ToString() + "~" + skuList.Select(n => n.GoldPrice).Max().ToString();
                    item.PlatinumPriceRegion  = skuList.Select(n => n.PlatinumPrice).Min().ToString() + "~" + skuList.Select(n => n.PlatinumPrice).Max().ToString();
                    item.DiamondPriceRegion   = skuList.Select(n => n.DiamondPrice).Min().ToString() + "~" + skuList.Select(n => n.DiamondPrice).Max().ToString();
                    item.OutletPriceRegion    = skuList.Select(n => n.OutletPrice).Min().ToString() + "~" + skuList.Select(n => n.OutletPrice).Max().ToString();
                    item.PromotionPriceRegion = skuList.Select(n => n.PromotionPrice).Min().ToString() + "~" + skuList.Select(n => n.PromotionPrice).Max().ToString();
                    item.IsShelf       = skuList.Select(n => n.IsShelf = 2).FirstOrDefault();
                    item.PcShowState   = skuList.Select(n => n.PcShowState = 1).FirstOrDefault();
                    item.DisabledState = skuList.Select(n => n.DisabledState = 0).FirstOrDefault();
                }
                //库存
                ProductInventory inventory = service.GetInventoryByProductNo(item.ProductNo);
                item.Quantity     = inventory.SumQuantity;
                item.LockQuantity = inventory.SumLockQuantity;
            }

            ViewBag.totalCount = total;
            ViewBag.pageIndex  = pageIndex;
            ViewBag.pageSize   = pageSize;
            var list1 = list.OrderByDescending(e => e.sortvalue);

            return(View(list1));
        }
コード例 #3
0
        public ActionResult AddGoods(int pageIndex = 1, int pageSize = 20)
        {
            if (Request.QueryString["GoodsId"] != null)
            {
                ViewBag.GoodsId = Request.QueryString["GoodsId"];
            }

            int total = 0;

            if (Request.QueryString["keyWord"] != null)
            {
                ViewBag.keyWord = Request.QueryString["keyWord"];
            }
            if (Request.QueryString["CategoryNo"] != null)
            {
                ViewBag.category = Request.QueryString["CategoryNo"];
            }
            if (Request.QueryString["Gender"] != null)
            {
                ViewBag.Gender = Request.QueryString["Gender"];
            }
            if (Request.QueryString["brandNO"] != null)
            {
                ViewBag.BrandNO = Request.QueryString["brandNO"];
            }
            if (Request.QueryString["starttime"] != null && Request.QueryString["starttime"] != "")
            {
                ViewBag.StartDateShelf = Request.QueryString["starttime"];
            }
            if (Request.QueryString["endtime"] != null && Request.QueryString["endtime"] != "")
            {
                ViewBag.EndDateShelf = Request.QueryString["endtime"];
            }

            ViewBag.produclist = Request.Cookies["MyCook"] == null ? "" : Request.Cookies["MyCook"].Value + "";

            IEnumerable <ProductInfo> list    = productService.GetSWfsProductList(ViewBag.Gender, ViewBag.BrandNO, ViewBag.category, ViewBag.keyWord, ViewBag.StartDateShelf, ViewBag.EndDateShelf, pageIndex, pageSize, out total);
            SWfsProductService        service = new SWfsProductService();

            foreach (var item in list)
            {
                //商品下的Skulist
                IEnumerable <SpfSkuExtendInfo> skuList = productService.GetSkuListByProductNo(item.ProductNo);
                if (skuList.Any())
                {
                    //价格,上下架状态
                    item.MarketPriceRegion    = skuList.Select(n => n.MarketPrice).Min().ToString() + "~" + skuList.Select(n => n.MarketPrice).Max().ToString();
                    item.StandardPriceRegion  = skuList.Select(n => n.StandardPrice).Min().ToString() + "~" + skuList.Select(n => n.StandardPrice).Max().ToString();
                    item.GoldPriceRegion      = skuList.Select(n => n.GoldPrice).Min().ToString() + "~" + skuList.Select(n => n.GoldPrice).Max().ToString();
                    item.PlatinumPriceRegion  = skuList.Select(n => n.PlatinumPrice).Min().ToString() + "~" + skuList.Select(n => n.PlatinumPrice).Max().ToString();
                    item.DiamondPriceRegion   = skuList.Select(n => n.DiamondPrice).Min().ToString() + "~" + skuList.Select(n => n.DiamondPrice).Max().ToString();
                    item.OutletPriceRegion    = skuList.Select(n => n.OutletPrice).Min().ToString() + "~" + skuList.Select(n => n.OutletPrice).Max().ToString();
                    item.PromotionPriceRegion = skuList.Select(n => n.PromotionPrice).Min().ToString() + "~" + skuList.Select(n => n.PromotionPrice).Max().ToString();
                    item.IsShelf       = skuList.Select(n => n.IsShelf = 2).FirstOrDefault();
                    item.PcShowState   = skuList.Select(n => n.PcShowState = 1).FirstOrDefault();
                    item.DisabledState = skuList.Select(n => n.DisabledState = 0).FirstOrDefault();
                }
                ProductInventory inventory = service.GetInventoryByProductNo(item.ProductNo);
                item.Quantity     = inventory.SumQuantity;
                item.LockQuantity = inventory.SumLockQuantity;
            }

            ViewBag.totalCount = total;
            ViewBag.pageIndex  = pageIndex;
            ViewBag.pageSize   = pageSize;

            return(View(list));
        }