예제 #1
0
        /// <summary>
        /// 根据父Code查数据字典列表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static List <BaseDic> GetDicListByPCode(int pCode, int isDefault)
        {
            var list = new List <BaseDic>();

            if (isDefault == 1)
            {
                list.Add(new BaseDic {
                    Code = 0, Name = "请选择"
                });
            }
            var pId = GetDicModel(0, pCode)?.Id ?? 0;

            if (pId > 0)
            {
                var data = Sys_BaseDictionaryAccess.GetDicList(new GetDicListRequest
                {
                    ParentId = pId,
                    PageSize = 100
                });
                data?.List?.ForEach(x =>
                {
                    list.Add(new BaseDic {
                        Code = x.DCode, Name = x.DName
                    });
                });
            }
            return(list);
        }
예제 #2
0
        /// <summary>
        /// 查询供应商列表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static BasePageResponse <SupplierModel> GetList(SupplierSearchRequest request)
        {
            var data     = H_SupplierAccess.GetList(request);
            var response = new BasePageResponse <SupplierModel>()
            {
                IsSuccess = data.IsSuccess,
                Total     = data.Total,
                List      = new List <SupplierModel>()
            };

            data?.List?.ForEach(x =>
            {
                response.List.Add(new SupplierModel
                {
                    Code     = x.SCode,
                    Id       = x.Id,
                    Linker   = x.SLinker,
                    Name     = x.SName,
                    SourceId = x.SSourceId,
                    Source   = Sys_BaseDictionaryAccess.GetDicModel(0, x.SSourceId)?.DName ?? string.Empty,
                    PmName   = x.SPMName,
                });
            });
            return(response);
        }
예제 #3
0
        /// <summary>
        /// 修改数据字典
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static BaseResponse UpdateDicModel(Sys_BaseDictionaryModel model)
        {
            var res = new BaseResponse();
            var i   = Sys_BaseDictionaryAccess.UpdateDicModel(model);

            res = new BaseResponse
            {
                IsSuccess = i > 0 ? 1 : 0,
                Msg       = i > 0 ? string.Empty : "更新失败",
            };
            return(res);
        }
예제 #4
0
        /// <summary>
        /// 新增数据字典
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static BaseResponse AddDicModel(Sys_BaseDictionaryModel model)
        {
            var res = new BaseResponse();
            var id  = 0;

            if (model.DCode == 0)
            {
                res.Msg = "无效的Code";
                return(res);
            }
            if (string.IsNullOrEmpty(model.DName))
            {
                res.Msg = "字典名称不能为空";
                return(res);
            }
            var dic = Sys_BaseDictionaryAccess.GetDicModel(0, model.DCode);

            if (dic != null && dic.Id > 0)
            {
                res.Msg = "已存在相同Code的字典";
                return(res);
            }
            id = Sys_BaseDictionaryAccess.AddDicModel(model);
            if (id <= 0)
            {
                res.Msg = "新增失败";
                return(res);
            }
            else
            {
                res = new BaseResponse
                {
                    AddId     = (int)id,
                    IsSuccess = 1
                };
            }
            return(res);
        }
예제 #5
0
 /// <summary>
 /// 获取Code数据字典
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public static Sys_BaseDictionaryModel GetNewDicModel(int pId)
 {
     return(Sys_BaseDictionaryAccess.GetNewDicModel(pId));
 }
예제 #6
0
 /// <summary>
 /// 数据字典
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public static Sys_BaseDictionaryModel GetDicModel(int id, int code)
 {
     return(Sys_BaseDictionaryAccess.GetDicModel(id, code));
 }
예제 #7
0
 /// <summary>
 /// 数据字典列表
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public static BasePageResponse <Sys_BaseDictionaryModel> GetDicList(GetDicListRequest request)
 {
     return(Sys_BaseDictionaryAccess.GetDicList(request));
 }