Beispiel #1
0
        /// <summary>
        /// 删除业务点数据
        /// </summary>
        /// <param name="ids">要删除的业务点数据编号</param>
        /// <returns>业务操作结果</returns>
        public async Task <OperationResult> DeleteBusinessNodes(params Guid[] ids)
        {
            ids.CheckNotNull("ids");
            foreach (var id in ids)
            {
                if (ProductionProcessEquipmentBusinessNodeMapRepository.CheckExists(a => a.BusinessNode.Id == id))
                {
                    return(new OperationResult(OperationResultType.Error, $"该业务点数据已被其他业务使用不能删除。"));
                }
            }
            var result = await BusinessNodeRepository.DeleteAsync(ids);

            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// 更新业务信息
        /// </summary>
        /// <param name="inputDtos"></param>
        /// <returns></returns>
        public async Task <OperationResult> Update(params BusinessNodeInputDto[] inputDtos)
        {
            inputDtos.CheckNotNull("inputDtos");
            foreach (BusinessNodeInputDto dtoData in inputDtos)
            {
                if (string.IsNullOrEmpty(dtoData.BusinessName))
                {
                    return(new OperationResult(OperationResultType.Error, "请正确填写业务名称,业务名称不能为空。"));
                }
                if (BusinessNodeRepository.CheckExists(x => x.BusinessName == dtoData.BusinessName && x.Id != dtoData.Id))
                {
                    return(new OperationResult(OperationResultType.Error, $"业务点名称 {dtoData.BusinessName} 的数据已被使用,请使用其他名称。"));
                }
            }
            var result = await BusinessNodeRepository.UpdateAsync(inputDtos);

            return(result);
        }
Beispiel #3
0
 /// <summary>
 /// 检查业务点信息是否存在
 /// </summary>
 /// <param name="predicate">检查谓语表达式</param>
 /// <param name="id">更新的业务点编号</param>
 /// <returns>业务点数据是否存在</returns>
 public bool CheckBusinessNodeExists(Expression <Func <BusinessNode, bool> > predicate, Guid id) => BusinessNodeRepository.CheckExists(predicate, id);