Esempio n. 1
0
        /// <summary>
        /// 保存商品类别
        /// </summary>
        /// <returns></returns>
        public JsonResult SaveProductCgty(SysUser user, ProductCatg productCgty, string imgMsg)
        {
            //获取状态
            StateCode state = ServiceIoc.Get <ProductCatgService>().Save(user, productCgty, imgMsg);

            return(Json(GetResult(state)));
        }
Esempio n. 2
0
 /// <summary>
 /// 保存商品分类
 /// </summary>
 /// <param name="user"></param>
 /// <param name="entity"></param>
 /// <param name="imgmsg"></param>
 /// <returns></returns>
 public IActionResult CategoryForm(SysUser user, ProductCatg entity = null, string imgmsg = null)
 {
     if (NHttpContext.Current.Request.IsAjaxRequest())
     {
         //获取状态
         StateCode state = ServiceIoc.Get <ProductCatgService>().Save(user, entity, imgmsg);
         return(Json(GetResult(state)));
     }
     else
     {
         //所属分类
         List <ProductCatg> Parents = ServiceIoc.Get <ProductCatgService>().GetTrees("", HttpUtility.HtmlDecode("&nbsp;&nbsp;"));
         Parents.Insert(0, new ProductCatg()
         {
             name = "根", id = 0
         });
         ViewBag.Parents = Parents;
         //当前商品分类
         entity = ServiceIoc.Get <ProductCatgService>().GetById(bid);
         if (entity != null)
         {
             ViewBag.entity = JsonConvert.SerializeObject(entity);
         }
     }
     return(View());
 }
Esempio n. 3
0
        /// <summary>
        /// 编辑商品基本信息
        /// </summary>
        /// <param name="user"></param>
        /// <param name="cid"></param>
        /// <returns></returns>
        public IActionResult ProductForm(SysUser user, long cid)
        {
            //导购分类
            List <GuideProductCatg> guideProductCatgs = ServiceIoc.Get <GuideProductCatgService>().GetTrees("", HttpUtility.HtmlDecode("&nbsp;&nbsp;"));

            guideProductCatgs.Insert(0, new GuideProductCatg()
            {
                name = "——导购分类——", id = 0
            });
            ViewBag.GuideProductCatgs = guideProductCatgs;

            //商品类型集合
            List <ProductType> productTypes = ServiceIoc.Get <ProductTypeService>().GetAll();

            productTypes.Insert(0, new ProductType()
            {
                name = "——商品类型——", id = 0
            });
            ViewBag.ProductTypes = productTypes;

            //品牌
            List <ProductBrand> brands = ServiceIoc.Get <ProductBrandService>().GetAll();

            brands.Insert(0, new ProductBrand()
            {
                name = "——商品品牌——", id = 0
            });
            ViewBag.Brands = brands;

            //加密ID
            ViewBag.CoverTicket   = StringHelper.GetEncryption(ImgType.Product_Cover + "#" + bid);
            ViewBag.DetailsTicket = StringHelper.GetEncryption(ImgType.Product_Details + "#" + bid);

            //商品信息
            Product entity = ServiceIoc.Get <ProductService>().GetById(bid);

            if (entity != null)
            {
                //当前商品信息
                ViewBag.entity = JsonConvert.SerializeObject(entity);
                //商品对应分类
                ViewBag.ProductCgty = ServiceIoc.Get <ProductCatgService>().GetById(entity.catg_id);
            }

            if (cid != 0)
            {
                //不存在商品类别
                ProductCatg productCgty = ServiceIoc.Get <ProductCatgService>().GetById(cid);
                if (productCgty != null)
                {
                    ViewBag.ProductCgty = productCgty;
                    ViewBag.No          = ViewBag.ProductCgty.serial_no + StringHelper.GetRandomCode(4) + ServiceIoc.Get <ProductService>().GetMaxID();
                }
                else
                {
                    ViewBag.No = ServiceIoc.Get <ProductService>().GetMaxID();
                }
            }

            return(View());
        }