Ejemplo n.º 1
0
 /// <summary>
 /// 编辑分组信息
 /// </summary>
 /// <param name="cache">当前操作用户的缓存</param>
 /// <param name="datas">待编辑的数据集合</param>
 /// <returns></returns>
 public OperationResult EditGroupControls(CacheUser cache, params GroupControlInputDto[] datas) => GroupControlRepository.Update(datas,
                                                                                                                                 checkAction: (dto, entity) =>
 {
     if (dto.DataItemDetail_Id == entity.DataItemDetail_Id && dto.GrounpNum != entity.GrounpNum)
     {
         if (GroupControlRepository.CheckExists(m => m.GrounpNum == dto.GrounpNum && m.ObjectId == dto.ObjectId && m.Organzie_Id == dto.Organzie_Id))
         {
             throw new Exception($"id:更新数据失败,因为已经存在相同的类型数据");
         }
     }
 },
                                                                                                                                 updateFunc: (dto, entity) =>
 {
     return(entity);
 });
Ejemplo n.º 2
0
 /// <summary>
 /// 添加分组信息
 /// </summary>
 /// <param name="cache">当前操作用户的缓存</param>
 /// <param name="datas">待添加的数据集合</param>
 /// <returns></returns>
 public OperationResult AddGroupControls(CacheUser cache, params GroupControlInputDto[] datas) =>
 GroupControlRepository.Insert(datas,
                               checkAction: dto =>
 {
     if (GroupControlRepository.CheckExists(m => m.ObjectId == dto.ObjectId && m.Organzie_Id == dto.Organzie_Id && m.GrounpNum == dto.GrounpNum && m.DataItemDetail_Id == dto.DataItemDetail_Id))
     {
         throw new Exception($"id:该分组已经存在!");
     }
 },
                               updateFunc: (dto, entity) =>
 {
     entity.CreatedTime = DateTime.Now;
     entity.UpdateTime  = DateTime.Now;
     return(entity);
 });