Example #1
0
        /// <summary>
        /// 获取门店美容类目树
        /// </summary>
        public static string SE_MDBeautyCategoryTreeJson(string opens = "", bool isDisable = false)
        {
            opens = opens ?? "";
            var opensArr   = opens?.Split(',');
            var ZTreeModel = SE_MDBeautyCategoryConfigBLL.SelectList()?.Select(m => new
            {
                id          = m.Id,
                pId         = m.ParentId,
                name        = m.CategoryName,
                open        = opensArr.Contains(m.Id.ToString().Trim()),
                @checked    = opensArr.Contains(m.Id.ToString().Trim()),
                chkDisabled = false,
                disabled    = m.IsDisable,
                isParent    = m.ParentId == 0,
                childs      = m.Childs,
                parents     = m.Parents
            });

            if (isDisable)
            {
                ZTreeModel = ZTreeModel.Where(m => m.disabled == false);
            }

            return(JsonConvert.SerializeObject(ZTreeModel));
        }
Example #2
0
        public ActionResult Edit(int id = 0, int parentId = 0)
        {
            SE_MDBeautyCategoryConfigModel model = new SE_MDBeautyCategoryConfigModel()
            {
                ParentId = parentId
            };

            if (id > 0)
            {
                model = SE_MDBeautyCategoryConfigBLL.Select(id) ?? new SE_MDBeautyCategoryConfigModel();
            }

            return(View(model));
        }
Example #3
0
        public ActionResult Save(SE_MDBeautyCategoryConfigModel model)
        {
            bool result = false;

            if (model != null)
            {
                // SE_MDBeautyCategoryConfigBLL.GetPidsFromMDBeautyCategoryProductConfigByCategoryIds(new);


                if (model.Id > 0)
                {
                    result = SE_MDBeautyCategoryConfigBLL.Update(model);
                }
                else
                {
                    result = SE_MDBeautyCategoryConfigBLL.Insert(model);
                }

                //刷新分类缓存
                try
                {
                    using (var client = new Tuhu.Service.Shop.CacheClient())
                    {
                        var clientResult = client.UpdateBeautyAvailableCategories();

                        if (clientResult.Result)
                        {
                            TempData["UpdateBeautyAvailableCategories"] = "刷新美容分类缓存成功!";
                        }
                        else
                        {
                            TempData["UpdateBeautyAvailableCategories"] = clientResult.ErrorMessage;
                        }
                    }
                }
                catch { }
            }
            return(RedirectToAction("Index"));
        }
Example #4
0
 public ActionResult Index()
 {
     ViewBag.Prod         = SE_MDBeautyCategoryConfigBLL.SelectList().Where(x => x.ParentId != 0).ToList();
     ViewBag.ProvinceList = MeiRongAcitivityConfigManager.GetRegion(0);
     return(View());
 }