コード例 #1
0
        //保存商品的title
        public int SaveProductTitle(string productNo, string productTitle)
        {
            //判断是否存在编辑过的商品
            SWfsProductRef productObj = GetProductRefByProductNO(productNo);

            if (productObj == null)
            {
                productObj.ProductNO         = productNo;
                productObj.TemplateNO        = "";
                productObj.CreateDate        = DateTime.Parse("1900-01-01 00:00:00");
                productObj.EditeDate         = DateTime.Parse("1900-01-01 00:00:00");
                productObj.HTMLCode          = "";
                productObj.PublishHTML       = "";
                productObj.ProductTitle      = productTitle;
                productObj.PublishTime       = DateTime.Parse("1900-01-01 00:00:00");
                productObj.PublishPeople     = "";
                productObj.EditePeople       = "";
                productObj.HTMLCodeMobile    = "";
                productObj.PublishHTMLMobile = "";
                return(DapperUtil.Insert <SWfsProductRef>(productObj));
            }
            else
            {
                return(DapperUtil.UpdatePartialColumns <SWfsProductRef>(new
                {
                    RefID = productObj.RefID,
                    ProductTitle = productTitle
                })?1:0);
            }
            return(DapperUtil.Execute("ComBeziWfs_SWfsProductRef_SaveProductTitle", new
            {
                ProductTitle = productTitle,
                ProductNO = productNo
            }));
        }
コード例 #2
0
        //添加商品编辑块内容
        public int AddProductRefContent(SWfsProductRef obj)
        {
            if (obj.ProductNO == null)
            {
                return(0);
            }
            obj.CreateDate = DateTime.Now;
            obj.EditeDate  = DateTime.Now;
            Passport passport = PresentationHelper.GetPassport();

            obj.PublishTime   = DateTime.Now;
            obj.EditePeople   = (passport != null ? passport.UserName : "");
            obj.PublishPeople = "";
            obj.ProductTitle  = "";
            obj.TemplateNO    = "";
            obj.PublishHTML   = "";
            if (obj.HTMLCode == null)
            {
                obj.HTMLCode = "";
            }
            if (obj.HTMLCodeMobile == null)
            {
                obj.HTMLCodeMobile = "";
            }
            return(DapperUtil.Insert <SWfsProductRef>(obj, true));
        }
コード例 #3
0
 public ActionResult ProductRefContent(SWfsProductRef obj)
 {
     if (productService.EditeProductRefContent(obj) > 0)
     {
         ViewData["tip"] = new HtmlString("<script>alert('保存成功')</script>");
     }
     else
     {
         ViewData["tip"] = new HtmlString("<script>alert('保存失败')</script>");
     }
     return(View(obj));
 }
コード例 #4
0
        //加载商品编辑块
        public ActionResult ProductRefContent(string productNO = "000000")
        {
            SWfsProductRef obj = productService.GetProductRefByProductNO(productNO);

            if (obj == null)
            {
                productService.AddProductRefContent(new SWfsProductRef
                {
                    ProductNO = productNO
                });
                obj = productService.GetProductRefByProductNO(productNO);
            }
            return(View(obj));
        }
コード例 #5
0
        //编辑商品推荐内容
        public int EditeProductRefContent(SWfsProductRef obj)
        {
            if (obj.TemplateNO == null)
            {
                obj.TemplateNO = "";
            }
            Passport passport = PresentationHelper.GetPassport();

            return(DapperUtil.UpdatePartialColumns <SWfsProductRef>(new
            {
                RefID = obj.RefID,
                EditeDate = DateTime.Now,
                EditePeople = (passport == null?"":passport.UserName),
                HTMLCode = obj.HTMLCode,
                HTMLCodeMobile = obj.HTMLCodeMobile,
            }) ? 1 : 0);
        }
コード例 #6
0
        public JsonResult SaveStructContent(string structName, IEnumerable <SWfsProductRefTemplate> childStructList, string productNo, int structId)
        {
            if (string.IsNullOrEmpty(productNo))
            {
                return(Json(new { satatus = 0, msg = "商品编号不存在" }, JsonRequestBehavior.AllowGet));
            }
            if (structId != 0)                                                     //修改
            {
                productService.EditeStructParent(structId, structName, productNo); //修改父类
                productService.EditeStructChild(childStructList);                  //根据父类 修改子类
            }
            else//增加
            {
                int parentId = productService.SaveStructParent(structName, productNo, 1); //添加父类
                productService.SaveStructChild(childStructList, parentId);                //根据父类 添加子类
            }
            //重置Html代码
            StringBuilder sball       = new StringBuilder();
            StringBuilder sballMobile = new StringBuilder();

            for (int i = 0; i < childStructList.Count(); i++)
            {
                sball.Append(childStructList.ElementAt(i).TemplateHtmlCode.Trim());
                sballMobile.Append(childStructList.ElementAt(i).TemplateHtmlCodeMobile.Trim());
            }
            SWfsProductRef productObj = productService.GetProductRefByProductNO(productNo);

            if (productObj == null)
            {
                productObj                = new SWfsProductRef();
                productObj.ProductNO      = productNo;
                productObj.HTMLCode       = sball.ToString();
                productObj.HTMLCodeMobile = sballMobile.ToString();
                productService.AddProductRefContent(productObj);
            }
            else
            {
                productObj.HTMLCode       = sball.ToString();
                productObj.HTMLCodeMobile = sballMobile.ToString();
                productService.EditeProductRefContent(productObj);
            }
            return(Json(new { satatus = 0, msg = "操作成功" }, JsonRequestBehavior.AllowGet));
        }