/// <summary> /// 将操作附加到资源点 /// </summary> /// <returns></returns> public SYSOperation OperationInject(SYSOperationDTO dto) { if (string.IsNullOrEmpty(dto.OperationCode) || string.IsNullOrEmpty(dto.OperationName)) { throw CFException.Create(SYSOperationInjectResult.NameOrCodeNotFound); } try { //tag class 待确定 var prevCertificate = _operationRepository.Get(new EntitySpec <SYSOperation>(query => { query.SystemID = CurrentSystemId; query.OperationCode = dto.OperationCode; })); if (prevCertificate.ID.HasValue) { throw CFException.Create(SYSOperationInjectResult.CodeAlreadyExists); } SYSOperation entity = dto.Map <SYSOperationDTO, SYSOperation>(); entity.SystemID = CurrentSystemId; entity.InputTime = DateTime.Now; entity.Inputer = CFContext.User.UserName; entity.InputerID = CFContext.User.ID; _operationRepository.Add(entity); //粘贴tag return(entity); } catch (Exception ex) { throw CFException.Create(SYSOperationInjectResult.Fail, ex); } }
/// <summary> /// 删除资源点 /// </summary> /// <param name="operation"></param> /// <returns></returns> public bool Remove(SYSOperation operation) { return(_operationRepository.Remove(operation)); }