Esempio n. 1
0
        public ActionResult Operate(int id = 0)
        {
            ViewBag.gbId = id;
            //价格区间
            ViewBag.isPrice    = LoginUser.UserBasic.Enterprise.ISPrice;
            ViewBag.priceLower = LoginUser.UserBasic.Enterprise.PriceLower;
            ViewBag.priceUpper = LoginUser.UserBasic.Enterprise.PriceUpper;
            GoodsBasicBll bll   = new GoodsBasicBll();
            GoodsGroupBll ggBll = new GoodsGroupBll();
            GoodsBasic    list  = new GoodsBasic();

            ViewBag.gAttr  = new List <Hashtable>();
            ViewBag.pClass = 0;
            int gclassP;

            if (id != 0)
            {
                list           = bll.GetModelByGBid(id, out gclassP, LoginUser.UserBasic.EnterpriseID);
                ViewBag.pClass = gclassP;
                if (list != null)
                {
                    //商品属性
                    AttributesBll gavBll = new AttributesBll();
                    ViewBag.gAttr = gavBll.GetListByGBid(id);
                    ////商品销售卖点
                    //SellPointBll spBll = new SellPointBll();
                    //list.SellPointList = spBll.GetListByGBid(id);
                    //商品可视分组
                    list.GoodsGroupList = ggBll.GetListByGBid(id);
                }
                else
                {
                    Response.Redirect("/Login/Index");
                    return(Content("此商品不存在"));
                }
            }
            //有货状态
            SelectLists sList = new SelectLists();

            ViewBag.ISNormal = new SelectList(sList.GetGBISNormal(), "value", "text", list.ISNormal);
            //价格模式
            ViewBag.RType = new SelectList(sList.GetGBRType(), "value", "text", list.RType);
            //可视分组
            ViewBag.gGroupList = ggBll.GetGGList(LoginUser.UserBasic.EnterpriseID);
            //所属品牌
            BrandBll bBll = new BrandBll();

            ViewBag.BrandID = new SelectList(bBll.GetEBList(LoginUser.UserBasic.EnterpriseID), "ID", "BName", list.BrandID);
            return(View(list));
        }
Esempio n. 2
0
 public ActionResult Operate(int id = 0)
 {
     ViewBag.gbId = id;
     //价格区间
     ViewBag.isPrice = LoginUser.UserBasic.Enterprise.ISPrice;
     ViewBag.priceLower = LoginUser.UserBasic.Enterprise.PriceLower;
     ViewBag.priceUpper = LoginUser.UserBasic.Enterprise.PriceUpper;
     GoodsBasicBll bll = new GoodsBasicBll();
     GoodsGroupBll ggBll = new GoodsGroupBll();
     GoodsBasic list = new GoodsBasic();
     ViewBag.gAttr = new List<Hashtable>();
     ViewBag.pClass = 0;
     int gclassP;
     if (id != 0)
     {
         list = bll.GetModelByGBid(id, out gclassP, LoginUser.UserBasic.EnterpriseID);
         ViewBag.pClass = gclassP;
         if (list != null)
         {
             //商品属性
             AttributesBll gavBll = new AttributesBll();
             ViewBag.gAttr = gavBll.GetListByGBid(id);
             ////商品销售卖点
             //SellPointBll spBll = new SellPointBll();
             //list.SellPointList = spBll.GetListByGBid(id);
             //商品可视分组
             list.GoodsGroupList = ggBll.GetListByGBid(id);
         }
         else
         {
             Response.Redirect("/Login/Index");
             return Content("此商品不存在");
         }
     }
     //有货状态
     SelectLists sList = new SelectLists();
     ViewBag.ISNormal = new SelectList(sList.GetGBISNormal(), "value", "text", list.ISNormal);
     //价格模式
     ViewBag.RType = new SelectList(sList.GetGBRType(), "value", "text", list.RType);
     //可视分组
     ViewBag.gGroupList = ggBll.GetGGList(LoginUser.UserBasic.EnterpriseID);
     //所属品牌
     BrandBll bBll = new BrandBll();
     ViewBag.BrandID = new SelectList(bBll.GetEBList(LoginUser.UserBasic.EnterpriseID), "ID", "BName", list.BrandID);
     return View(list);
 }
Esempio n. 3
0
        public ActionResult OperateSave(Model.GoodsBasic model)
        {
            GESnapshotBll geBll = new GESnapshotBll();
            GESnapshot    ges   = geBll.GetGesModel(model.ID, model.GESnapshot.GName);

            if (ges == null)
            {
                string        isSale = "";
                GoodsBasicBll bll    = new GoodsBasicBll();
                //可视分组
                string hidGG = Request["hidGG"];
                //属性规格
                string  hidGAV = HttpUtility.HtmlDecode(Request["hidGAV"]);
                int     gcPid  = int.Parse(Request["gClassP"]);
                int     gcid   = int.Parse(Request["gClass"]);
                Decimal lowerP = Decimal.Parse(Request["txtPriceLower"]);
                Decimal upperP = Decimal.Parse(Request["txtPriceUpper"]);
                string  GEImg  = Request["hidGEImg"];
                model.GoodsClassID = gcid;
                if (model.RType == 2)
                {
                    model.MinPrice = 0;
                    model.MaxPrice = 0;
                }
                else
                {
                    model.MinPrice = lowerP;
                    model.MaxPrice = upperP;
                }
                model.BarCode    = (model.BarCode == null) ? "" : model.BarCode;
                model.GModel     = (model.GModel == null) ? "" : model.GModel;
                model.SaleNum    = (model.SaleNum == null) ? 0 : model.SaleNum;
                model.CommentNum = (model.CommentNum == null) ? 0 : model.CommentNum;
                List <Hashtable> strGAV = JsonConvert.DeserializeObject <List <Hashtable> >(hidGAV);
                if (model.ID == 0)
                {
                    isSale               = "1";
                    model.IsSale         = 1;
                    model.Status         = 0;
                    model.EnterpriseID   = LoginUser.UserBasic.EnterpriseID;
                    model.AddTime        = DateTime.Now;
                    model.GESnapshot.IMG = GEImg;
                    bll.AddGoods(model, gcPid, hidGG.Split(','), strGAV);
                }
                else
                {
                    int        gcp         = 0;
                    GoodsBasic updateModel = bll.GetModelByGBid(model.ID, out gcp, LoginUser.UserBasic.EnterpriseID);
                    isSale                        = updateModel.IsSale.ToString();
                    model.IsSale                  = updateModel.IsSale;
                    model.Status                  = updateModel.Status;
                    model.EnterpriseID            = updateModel.EnterpriseID;
                    model.AddTime                 = updateModel.AddTime;
                    model.Sorting                 = updateModel.Sorting;
                    model.GESnapshot.AddTime      = updateModel.GESnapshot.AddTime;
                    model.GESnapshot.Status       = updateModel.GESnapshot.Status;
                    model.GESnapshot.GoodsBasicID = updateModel.GESnapshot.GoodsBasicID;
                    model.GESnapshot.EnterpriseID = updateModel.GESnapshot.EnterpriseID;
                    model.GESnapshot.IMG          = GEImg;
                    isSale                        = model.IsSale.ToString();
                    bll.UpdateGoods(model, gcPid, hidGG.Split(','), strGAV);
                }
                return(Json(new ReturnData <string>()
                {
                    Status = true,
                    Data = isSale
                }));
            }
            else
            {
                return(Json(new ReturnData <string>()
                {
                    Status = false,
                    Message = "该商品名称已被占用"
                }));
            }
        }