示例#1
0
        /// <summary>
        /// 切换商品分类状态
        /// </summary>
        protected string ToggoleItemCategoryStatus()
        {
            // string res = "{success:false}";
            var    rsp      = new ResponseData();
            string checkRes = "";

            var bll    = new ItemCategoryService(this.CurrentUserInfo);
            var id     = this.Request("id");
            var status = this.Request("status");
            var bat_id = this.Request("bat_id");

            if (!string.IsNullOrWhiteSpace(id))
            {
                var bllItem = new ItemService(this.CurrentUserInfo);
                if (bllItem.GetItemCountByCategory(id, bat_id) > 0)
                {
                    rsp.success = false;
                    rsp.msg     = "该" + bat_id == "1" ? "分类" : "分组" + "下有商品,请先处理商品状态";
                }
                else
                {
                    bll.SetItemCategoryStatus(CurrentUserInfo, id, status, out checkRes);

                    if (!string.IsNullOrEmpty(checkRes))
                    {
                        rsp.success = false;
                        rsp.msg     = checkRes;
                    }
                    else
                    {
                        rsp.success = true;
                    }
                }
                #region 原来逻辑  20160103 wujx 屏蔽
                //if (bllItem.SearchItemList(null, null, id, null, null, null, 1, 0) != null)//判断该分类下是否有商品
                //{
                //    bll.SetItemCategoryStatus(CurrentUserInfo, id, status, out checkRes);

                //    if (!string.IsNullOrEmpty(checkRes))
                //    {
                //        // res = "{success:false,msg:\"" + checkRes + "\"}";
                //        rsp.success = false;
                //        rsp.msg = checkRes;
                //    }
                //    else
                //    {
                //        // res = "{success:true}";
                //        rsp.success = true;
                //    }
                //}
                //else
                //{
                //    rsp.success = false;
                //    rsp.msg = "该分类下有商品,请先处理商品状态";
                //}
                #endregion
            }
            return(rsp.ToJSON());
        }
示例#2
0
        /// <summary>
        /// 切换商品分类状态
        /// </summary>
        protected void ToggoleItemCategoryStatus()
        {
            var bll    = new ItemCategoryService(this.CurrentUserInfo);
            var id     = this.Request("id");
            var status = this.Request("status");

            if (!string.IsNullOrWhiteSpace(id))
            {
                string res = "";
                bll.SetItemCategoryStatus(CurrentUserInfo, id, status, out res);
            }
        }
示例#3
0
        /// <summary>
        /// 删除商品分类信息
        /// </summary>
        public string DeleteItemCategory()
        {
            var service = new ItemCategoryService(CurrentUserInfo);

            string content      = string.Empty;
            string error        = "";
            var    responseData = new ResponseData();

            string key = string.Empty;

            if (FormatParamValue(Request("ids")) != null && FormatParamValue(Request("ids")) != string.Empty)
            {
                key = FormatParamValue(Request("ids")).ToString().Trim();
            }

            if (key == null || key.Trim().Length == 0)
            {
                responseData.success = false;
                responseData.msg     = "商品分类ID不能为空";
                return(responseData.ToJSON());
            }

            var status = "-1";

            if (FormatParamValue(Request("status")) != null && FormatParamValue(Request("status")) != string.Empty)
            {
                status = FormatParamValue(Request("status")).ToString().Trim();
            }

            string[] ids = key.Split(',');
            foreach (var id in ids)
            {
                //删除商品分类信息
                string res = "";
                service.SetItemCategoryStatus(CurrentUserInfo, key, status, out res);
            }

            responseData.success = true;
            responseData.msg     = error;

            content = responseData.ToJSON();
            return(content);
        }