Example #1
0
        public ExecResult DelDict(DictQuery query)
        {
            ExecResult    execResult = new ExecResult();
            IDictService  service    = ServiceContainer.Instance.Container.Resolve <IDictService>();
            IList <Int64> dictIDs    = query.DictIDs.ToList();

            if (dictIDs == null)
            {
                execResult.result = EnumJsonResult.failure.ToString();
                execResult.msg    = "没有删除任何数据!";
                return(execResult);
            }
            string        msg  = string.Empty;
            IList <Int64> list = service.BatchDeleteDict(dictIDs);

            if (list == null || list.Count < dictIDs.Count)
            {
                execResult.result = EnumJsonResult.success.ToString();
                execResult.msg    = "删除数据字典成功!";
                if (list != null && list.Count > 0)
                {
                    execResult.msg += string.Format("部分编号[{0}]由于存在数据字典值,请先删除", string.Join(",", list));
                }
            }
            else
            {
                execResult.result = EnumJsonResult.failure.ToString();
                execResult.msg    = "删除数据字典失败!";
            }
            return(execResult);
        }