Exemplo n.º 1
0
        public ActionResult DeleteProductCate()
        {
            if (!AppData.IsManagerLogin)
            {
                return(Json(new { success = false, msg = "您未登录后台或会话已过期" }));
            }
            if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 303))
            {
                return(Json(new { success = false, msg = "您没有执行该操作的权限" }));
            }

            Validation validation = new Validation();
            int        categoryID = validation.GetInt("categoryID");

            if (validation.HasError || categoryID == 0)
            {
                return(Json(new { success = false, msg = "参数错误!" }));
            }
            ProductBLL productBLL = new ProductBLL();
            bool       hasChild   = productBLL.IsProductCateHasChildren(categoryID);

            if (hasChild)
            {
                return(Json(new { success = false, msg = "该类别包含子类或商品,无法删除!" }));
            }

            productBLL.DeleteProductCate(categoryID);
            return(Json(new { success = true }));
        }