コード例 #1
0
        /// <summary>
        /// 增加刀具类别信息
        /// </summary>
        /// <param name="inputDtos"></param>
        /// <returns></returns>
        public async Task <OperationResult> AddKnifeToolType(params KnifeToolTypeInfoInputDto[] inputDtos)
        {
            inputDtos.CheckNotNull("inputDtos");
            foreach (KnifeToolTypeInfoInputDto dtoData in inputDtos)
            {
                if (string.IsNullOrEmpty(dtoData.KnifeToolTypeCode))
                {
                    return(new OperationResult(OperationResultType.Error, "请正确填写刀具类别编号,该组数据不被存储。"));
                }
                if (string.IsNullOrEmpty(dtoData.KnifeToolTypeName))
                {
                    return(new OperationResult(OperationResultType.Error, "请正确填写刀具类别名称,该组数据不被存储。"));
                }
                if (KnifeToolTypeRepository.CheckExists(x => x.KnifeToolTypeCode == dtoData.KnifeToolTypeCode /*&& x.IsDeleted == false*/))
                {
                    return(new OperationResult(OperationResultType.Error, $"刀具类别编号 {dtoData.KnifeToolTypeCode} 的数据已存在,该组数据不被存储。"));
                }
                if (KnifeToolTypeRepository.CheckExists(x => x.KnifeToolTypeName == dtoData.KnifeToolTypeName /* && x.IsDeleted == false*/))
                {
                    return(new OperationResult(OperationResultType.Error, $"刀具类别名称 {dtoData.KnifeToolTypeName} 的数据已存在,该组数据不被存储。"));
                }
            }
            KnifeToolTypeRepository.UnitOfWork.BeginTransaction();
            var result = await KnifeToolTypeRepository.InsertAsync(inputDtos);

            KnifeToolTypeRepository.UnitOfWork.Commit();
            return(result);
        }
コード例 #2
0
 /// <summary>
 /// 检查刀具类别信息是否存在
 /// </summary>
 /// <param name="predicate">检查谓语表达式</param>
 /// <param name="id">更新的刀具类别信息编号</param>
 /// <returns>刀具信息是否存在</returns>
 public bool CheckKnifeToolTypeExists(Expression <Func <KnifeToolTypeInfo, bool> > predicate, Guid id)
 {
     return(KnifeToolTypeRepository.CheckExists(predicate, id));
 }