Ejemplo n.º 1
0
        /// <summary>
        /// 判断功能名,在同一级别中是否存在
        /// </summary>
        public APIResponseEntity <bool> IsExistFunctionNameInSameLevel(APIRequestEntity <XCLCMS.Data.WebAPIEntity.RequestEntity.SysFunction.IsExistFunctionNameInSameLevelEntity> request)
        {
            var response = new APIResponseEntity <bool>();

            response.IsSuccess = true;
            response.Message   = "该功能名可以使用!";

            XCLCMS.Data.Model.SysFunction model = null;

            if (request.Body.SysFunctionID > 0)
            {
                model = sysFunctionBLL.GetModel(request.Body.SysFunctionID);
                if (null != model)
                {
                    if (string.Equals(request.Body.FunctionName, model.FunctionName, StringComparison.OrdinalIgnoreCase))
                    {
                        return(response);
                    }
                }
            }

            List <XCLCMS.Data.Model.SysFunction> lst = sysFunctionBLL.GetChildListByID(request.Body.ParentID);

            if (lst.IsNotNullOrEmpty())
            {
                if (lst.Exists(k => string.Equals(k.FunctionName, request.Body.FunctionName, StringComparison.OrdinalIgnoreCase)))
                {
                    response.IsSuccess = false;
                    response.Message   = "该功能名在当前层级中已存在!";
                }
            }

            return(response);
        }
Ejemplo n.º 2
0
        public APIResponseEntity <bool> IsExistFunctionNameInSameLevel([FromUri] string json)
        {
            var request  = Newtonsoft.Json.JsonConvert.DeserializeObject <APIRequestEntity <XCLCMS.Data.WebAPIEntity.RequestEntity.SysFunction.IsExistFunctionNameInSameLevelEntity> >(System.Web.HttpUtility.UrlDecode(json));
            var response = new APIResponseEntity <bool>();

            response.IsSuccess = true;
            response.Message   = "该功能名可以使用!";

            XCLCMS.Data.Model.SysFunction model = null;

            if (request.Body.SysFunctionID > 0)
            {
                model = sysFunctionBLL.GetModel(request.Body.SysFunctionID);
                if (null != model)
                {
                    if (string.Equals(request.Body.FunctionName, model.FunctionName, StringComparison.OrdinalIgnoreCase))
                    {
                        return(response);
                    }
                }
            }

            List <XCLCMS.Data.Model.SysFunction> lst = sysFunctionBLL.GetChildListByID(request.Body.ParentID);

            if (lst.IsNotNullOrEmpty())
            {
                if (lst.Exists(k => string.Equals(k.FunctionName, request.Body.FunctionName, StringComparison.OrdinalIgnoreCase)))
                {
                    response.IsSuccess = false;
                    response.Message   = "该功能名在当前层级中已存在!";
                }
            }

            return(response);
        }