Пример #1
0
        /// <summary>
        /// 增加分步教学任务调度明细信息
        /// </summary>
        /// <param name="inputDtos"></param>
        /// <returns></returns>
        public async Task <OperationResult> Add(params DisTaskDispatchItemInfoInputDto[] inputDtos)
        {
            inputDtos.CheckNotNull("inputDtos");
            foreach (var dtoData in inputDtos)
            {
                if (string.IsNullOrEmpty(dtoData.TaskItemCode))
                {
                    return(new OperationResult(OperationResultType.Error, "请正确填写任务明细编号,该组数据不被存储。"));
                }
                //if (string.IsNullOrEmpty(dtoData.WareHouseTypeName))
                //    return new OperationResult(OperationResultType.Error, "请正确填写仓库类型名称,该组数据不被存储。");
                //
                if (DisTaskDispatchItemRepository.CheckExists(x => x.TaskItemCode == dtoData.TaskItemCode))
                {
                    return(new OperationResult(OperationResultType.Error, $"任务明细编号 {dtoData.TaskItemCode} 的数据已存在,该组数据不被存储。"));
                }
                //if (DisTaskDispatchItemRepository.CheckExists(x => x.WareHouseTypeName == dtoData.WareHouseTypeName))
                //    return new OperationResult(OperationResultType.Error, $"仓库类型名称 {dtoData.WareHouseTypeName} 的数据已存在,该组数据不被存储。");
            }
            DisTaskDispatchItemRepository.UnitOfWork.BeginTransaction();
            var result = await DisTaskDispatchItemRepository.InsertAsync(inputDtos);

            DisTaskDispatchItemRepository.UnitOfWork.Commit();
            //
            return(result);
        }
Пример #2
0
        /// <summary>
        /// 物理删除分步教学任务调度明细信息
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public async Task <OperationResult> Delete(params Guid[] ids)
        {
            ids.CheckNotNull("ids");
            DisTaskDispatchItemRepository.UnitOfWork.BeginTransaction();
            var result = await DisTaskDispatchItemRepository.DeleteAsync(ids);

            DisTaskDispatchItemRepository.UnitOfWork.Commit();
            return(result);
        }
Пример #3
0
 /// <summary>
 /// 检查实体是否存在
 /// </summary>
 /// <param name="predicate"></param>
 /// <param name="id"></param>
 /// <returns></returns>
 public bool CheckExists(Expression <Func <DisTaskDispatchItemInfo, bool> > predicate, Guid id)
 {
     return(DisTaskDispatchItemRepository.CheckExists(predicate, id));
 }