internal override IEvent CreateInsertEvent(ICommandCQRSCreate command, DocumentUnit documentUnit = null) { IEvent evt = null; Protocol protocol; try { protocol = ((ICommandCreateProtocol)command).ContentType.ContentTypeValue; CollaborationUniqueId = null; if (command.CustomProperties.Where(x => x.Key == CustomPropertyName.COLLABORATION_UNIQUE_ID).Any() && Guid.TryParse(command.CustomProperties.Where(x => x.Key == CustomPropertyName.COLLABORATION_UNIQUE_ID).FirstOrDefault().Value.ToString(), out Guid guidResult)) { CollaborationUniqueId = guidResult; } CollaborationId = null; if (command.CustomProperties.Where(x => x.Key == CustomPropertyName.COLLABORATION_ID).Any() && int.TryParse(command.CustomProperties.Where(x => x.Key == CustomPropertyName.COLLABORATION_ID).FirstOrDefault().Value.ToString(), out int intResult)) { CollaborationId = intResult; } CollaborationTemplateName = string.Empty; if (command.CustomProperties.Where(x => x.Key == CustomPropertyName.COLLABORATION_TEMPLATE_NAME).Any()) { CollaborationTemplateName = command.CustomProperties.Where(x => x.Key == CustomPropertyName.COLLABORATION_TEMPLATE_NAME).FirstOrDefault().Value.ToString(); } evt = new EventCreateProtocol(command.TenantName, command.TenantId, command.TenantAOOId, CollaborationUniqueId, CollaborationId, CollaborationTemplateName, command.Identity, protocol, ((ICommandCQRSFascicolable)command).CategoryFascicle, documentUnit); } catch (Exception ex) { _logger.WriteError(new LogMessage(string.Concat("Protocol, CreateInsertEvent Error: ", command.GetType())), ex, LogCategories); throw ex; } return(evt); }
/// <summary> /// Aggiunge una nuova DocumentUnit /// </summary> /// <param name="unit">DocumentUnit da aggiungere</param> /// <returns>DocumentUnit inserita</returns> public DocumentUnit UdsAddDocumentUnit(DocumentUnit unit) { try { if (unit == null) { throw DocumentUnitException.NotFound(); } var entity = new Model.DocumentUnit { IdDocumentUnit = Guid.NewGuid(), InsertDate = DateTime.Now, CloseDate = null, Identifier = unit.Identifier ?? "", Subject = unit.Subject ?? "", Classification = unit.Classification ?? "", UriFascicle = unit.UriFascicle ?? "", XmlDoc = unit.XmlDoc ?? "" }; this.db.DocumentUnit.AddObject(entity); if (requireSave) { this.db.SaveChanges(); } var ret = entity.Convert(0, 3); return(ret); } finally { Dispose(); } }
/// <summary> /// Aggiorna una DocumentUnit esistente /// </summary> /// <param name="unit">DocumentUnit da aggiornare</param> /// <returns>Ritorna document unit aggiornata</returns> public DocumentUnit UdsUpdateDocumentUnit(DocumentUnit item) { try { var docUnit = UdsTryEditDocumentUnit(item.IdDocumentUnit); docUnit.CloseDate = item.CloseDate; docUnit.Subject = item.Subject; docUnit.Classification = item.Classification; docUnit.UriFascicle = item.UriFascicle; docUnit.XmlDoc = item.XmlDoc; if (requireSave) { this.db.SaveChanges(); } var ret = docUnit.Convert(0, 3); return(ret); } finally { Dispose(); } }
public RepositoryItemRichTextIndentEdit() { Mask.MaskType = MaskType.Custom; this.defaultUnitType = DocumentUnit.Inch; this.maxValue = defaultMaxValue; this.minValue = defaultMinValue; }
/// <summary> /// Aggiunge una nuova DocumentUnit e collega i documenti collegati passati /// </summary> /// <param name="unit">DocumentUnit da inserire</param> /// <param name="documents">Elenco dei riferimenti ai documenti da collegare</param> /// <returns>DocumentUnit creata</returns> public static DocumentUnit UdsAddDocumentUnitWithDocuments(DocumentUnit unit, DocumentUnitChain[] documents) { EntityProvider provider = DbProvider; using (DbTransaction tran = provider.BeginNoSave()) { try { var unitRes = provider.UdsAddDocumentUnit(unit); if (unitRes != null) { provider.UdsDocumentUnitAddDocuments(unitRes.IdDocumentUnit, documents, false); } provider.SaveChanges(); tran.Commit(); return(unitRes); } catch { try { tran.Rollback(); } catch { } throw; } } }
internal override IEvent CreateUpdateEvent(ICommandCQRSUpdate command, DocumentUnit documentUnit = null) { IEvent evt = null; UDSBuildModel udsBuildModel; try { udsBuildModel = ((ICommandCQRSUpdateUDSData)command).ContentType.ContentTypeValue; CollaborationUniqueId = null; if (command.CustomProperties.Any(x => x.Key == CustomPropertyName.COLLABORATION_UNIQUE_ID) && Guid.TryParse(command.CustomProperties.Single(x => x.Key == CustomPropertyName.COLLABORATION_UNIQUE_ID).Value.ToString(), out Guid guidResult)) { CollaborationUniqueId = guidResult; } CollaborationId = null; if (command.CustomProperties.Any(x => x.Key == CustomPropertyName.COLLABORATION_ID) && int.TryParse(command.CustomProperties.Single(x => x.Key == CustomPropertyName.COLLABORATION_ID).Value.ToString(), out int intResult)) { CollaborationId = intResult; } CollaborationTemplateName = string.Empty; if (command.CustomProperties.Any(x => x.Key == CustomPropertyName.COLLABORATION_TEMPLATE_NAME)) { CollaborationTemplateName = command.CustomProperties.Single(x => x.Key == CustomPropertyName.COLLABORATION_TEMPLATE_NAME).Value.ToString(); } evt = new EventCQRSUpdateUDSData(command.TenantName, CollaborationUniqueId, CollaborationId, CollaborationTemplateName, command.TenantId, command.TenantAOOId, command.Identity, udsBuildModel, ((ICommandCQRSFascicolable)command).CategoryFascicle, documentUnit); } catch (Exception ex) { _logger.WriteError(new LogMessage(string.Concat("UDS, CreateUpdateEvent Error: ", command.GetType())), ex, LogCategories); throw ex; } return(evt); }
/// <summary> /// protocol cat = faccicle cat || protocol cat contine fasscicle cat /// </summary> /// <param name="objectToValidate"></param> protected override void ValidateObject(FascicleDocumentUnitValidator objectToValidate) { if (objectToValidate.ReferenceType != ReferenceType.Fascicle) { return; } bool result = false; FascicleFolder fascicleFolder = objectToValidate.FascicleFolder == null ? null : CurrentUnitOfWork.Repository <FascicleFolder>().GetByFolderId(objectToValidate.FascicleFolder.UniqueId); DocumentUnit documentUnit = objectToValidate.DocumentUnit == null ? null : CurrentUnitOfWork.Repository <DocumentUnit>().GetById(objectToValidate.DocumentUnit.UniqueId).FirstOrDefault(); Fascicle fascicle = objectToValidate.Fascicle == null ? null : CurrentUnitOfWork.Repository <Fascicle>().GetByUniqueId(objectToValidate.Fascicle.UniqueId); ICollection <CategoryFascicleTableValuedModel> categoryFascicles = CurrentUnitOfWork.Repository <CategoryFascicle>().GetCategorySubFascicles(fascicle.Category.EntityShortId); if (documentUnit != null && documentUnit.Category != null && fascicle != null && fascicle.Category != null && (documentUnit.Category.UniqueId == fascicle.Category.UniqueId || (categoryFascicles.Any() && categoryFascicles.Any(c => c.IdCategory == documentUnit.Category.EntityShortId)))) { result = true; } if (!result) { GenerateInvalidateResult(); } }
public bool IsWithinAllowedLimits(string stringValue, DocumentUnit unitType, bool isValueInPercent, UIUnitConverter uiUnitConverter) { UIUnit unit = uiUnitConverter.CreateUIUnit(stringValue, unitType, isValueInPercent); int intValue = uiUnitConverter.ToTwipsUnit(unit, IsValueInPercent); return(IsWithinAllowedLimits(intValue)); }
private async Task <Tuple <DocumentUnit, DocumentUnit> > EvaluateMappingDocumentUnitAsync(TCommand command, IBaseCommonExecutor baseCommonExecutor, IContentBase entity, bool isCommandUpdate) { DocumentUnit documentUnit = null; DocumentUnit existDocumentUnit = null; if (typeof(IDocumentUnitEntity).IsAssignableFrom(baseCommonExecutor.GetType())) { documentUnit = await baseCommonExecutor.Mapping(entity, command.Identity, isCommandUpdate); documentUnit.TenantAOO = new TenantAOO() { UniqueId = command.TenantAOOId }; existDocumentUnit = await _webApiClient.GetDocumentUnitAsync(documentUnit); bool skipSendDocument = existDocumentUnit != null && existDocumentUnit.UniqueId == documentUnit.UniqueId && existDocumentUnit.Year == documentUnit.Year && existDocumentUnit.Number == documentUnit.Number && existDocumentUnit.Subject == existDocumentUnit.Subject && existDocumentUnit.Environment == documentUnit.Environment; if ((!isCommandUpdate && !skipSendDocument) || isCommandUpdate) { await baseCommonExecutor.SendDocumentAsync(documentUnit, isCommandUpdate); _logger.WriteDebug(new LogMessage($"DocumentUnit - {entity.GetType()} - {entity.UniqueId} has been successfully created."), LogCategories); } else { _logger.WriteWarning(new LogMessage($"DocumentUnit - {entity.GetType()} - {entity.UniqueId} already exists and CQRS structures has been skipped."), LogCategories); } } return(new Tuple <DocumentUnit, DocumentUnit>(documentUnit, existDocumentUnit)); }
private void InsertProtocolLog(DocumentUnit entity, BiblosDocumentInfo documentInfo) { using (WindowsIdentity wi = (WindowsIdentity)HttpContext.Current.User.Identity) using (WindowsImpersonationContext wic = wi.Impersonate()) using (ExecutionContext.SuppressFlow()) { ProtocolLog protocolLog = new ProtocolLog() { LogDescription = string.Format("\"{0}\" [{1}]", documentInfo.Name, documentInfo.DocumentId.ToString("N")), Entity = new Protocol(entity.UniqueId) }; try { string actionType = EnumHelper.GetDescription(InsertActionType.ViewProtocolDocument); //string actionType = "ViewProtocolDocument"; protocolLog = _httpClient.PostAsync(protocolLog, actionType).ResponseToModel <ProtocolLog>(); } catch (Exception ex) { FileLogger.Error(LogName.FileLog, ex.Message, ex); throw ex; } finally { wic.Undo(); } } }
public async Task <DocumentUnit> PutDocumentUnitAsync(DocumentUnit entity) { return(await ExecuteHelper(async() => { _httpClient.SetEntityRest <DocumentUnit>(); return await _httpClient.PutAsync(entity) .ResponseToModelAsync <DocumentUnit>(); }, "WebAPIClient.PutDocumentUnitAsync -> PUT entities error")); }
protected override void ValidateObject(FascicleDocumentUnitValidator objectToValidate) { Fascicle localFascicle = objectToValidate.Fascicle == null ? null : CurrentUnitOfWork.Repository <Fascicle>().GetByUniqueId(objectToValidate.Fascicle.UniqueId); DocumentUnit documentUnit = objectToValidate.DocumentUnit == null ? null : CurrentUnitOfWork.Repository <DocumentUnit>().GetById(objectToValidate.DocumentUnit.UniqueId).SingleOrDefault(); if (documentUnit != null && localFascicle != null && !((documentUnit.Environment).Equals(localFascicle.DSWEnvironment)) && objectToValidate.ReferenceType == ReferenceType.Fascicle && localFascicle.FascicleType == FascicleType.Period) { GenerateInvalidateResult(); } }
public void AddUDSDocumentUnitChain(DocumentUnit documentUnit, UDSDocumentModel udsDocument, ChainType chainType, IIdentityContext identity) { string documentName = string.Empty; BiblosDS.BiblosDS.Document document = _biblosClient.Document.GetDocumentChildren(udsDocument.IdChain).FirstOrDefault(); if (document != null) { AddDocumentUnitChain(documentUnit, udsDocument.IdChain, chainType, identity, document.Archive.Name, chainType == ChainType.MainChain ? document.Name : null, udsDocument.DocumentLabel); } }
public async Task <Fascicle> GetAvailablePeriodicFascicleByDocumentUnitAsync(DocumentUnit documentUnit) { return(await ExecuteHelper(async() => { _httpClient.SetEntityODATA <Fascicle>(); ODataModel <Fascicle> result = (await _httpClient.GetAsync <Fascicle>() .WithRowQuery(string.Format("/FascicleService.PeriodicFascicles(uniqueId = {0})", documentUnit.UniqueId)) .ResponseToModelAsync <ODataModel <Fascicle> >()); return result.Value.SingleOrDefault(); }, $"WebAPIClient.GetAvailablePeriodicFascicleByDocumentUnitAsync -> GET entities error")); }
public async Task <DocumentUnit> GetDocumentUnitAsync(DocumentUnit documentUnit) { return(await ExecuteHelper(async() => { _httpClient.SetEntityODATA <DocumentUnit>(); ODataModel <DocumentUnit> result = (await _httpClient.GetAsync <DocumentUnit>() .WithOData(string.Concat("$filter=UniqueId eq ", documentUnit.UniqueId, "&$expand=DocumentUnitRoles,DocumentUnitChains,DocumentUnitUsers,Fascicle,Category,Container,UDSRepository")) .ResponseToModelAsync <ODataModel <DocumentUnit> >()); return result.Value.SingleOrDefault(); }, $"WebAPIClient.GetDocumentUnitAsync -> GET entities error")); }
public override IEvent BuildEvent(ICommandCQRS command, WorkflowActionShareDocumentUnitModel workflowAction) { DocumentUnitModel documentUnitModel = workflowAction.GetReferenced(); DocumentUnit documentUnit = _webAPIClient.GetDocumentUnitAsync(new DocumentUnit(documentUnitModel.UniqueId)).Result; documentUnit.WorkflowName = workflowAction.WorkflowName; documentUnit.IdWorkflowActivity = workflowAction.IdWorkflowActivity; EventShareDocumentUnit @event = new EventShareDocumentUnit(Guid.NewGuid(), workflowAction.CorrelationId, command.TenantName, command.TenantId, command.TenantAOOId, command.Identity, documentUnit, null); return(@event); }
internal async Task <DocumentUnit> PutDocumentUnitAsync(DocumentUnit documentUnit) { try { return(await _webApiClient.PutDocumentUnitAsync(documentUnit)); } catch (Exception ex) { _logger.WriteError(new LogMessage("PutDocumentUnitAsync Error: DocumentUnit not sended to WebAPI"), ex, LogCategories); throw ex; } }
internal void AddResolutionDocumentUnitChain(DocumentUnit documentUnit, ResolutionModel resolution, Guid chainId, ChainType chainType, IIdentityContext identity) { string documentName = string.Empty; if (chainType == ChainType.MainChain) { BiblosDS.BiblosDS.Document document = _biblosClient.Document.GetDocumentChildren(chainId).FirstOrDefault(); documentName = document != null ? document.Name : string.Empty; } AddDocumentUnitChain(documentUnit, chainId, chainType, identity, resolution.Container.ReslLocation.ResolutionArchive, documentName); }
public void AddDocumentUnitChain(DocumentUnit documentUnit, Guid chainId, ChainType chainType, IIdentityContext identity, string archiveName, string documentName = null, string label = null) { documentUnit.DocumentUnitChains.Add(new DocumentUnitChain() { ArchiveName = archiveName, ChainType = chainType, DocumentName = chainType == ChainType.MainChain ? documentName : null, IdArchiveChain = chainId, RegistrationDate = DateTimeOffset.UtcNow, RegistrationUser = identity.User, DocumentLabel = label }); }
internal override IEvent CreateInsertEvent(ICommandCQRSCreate command, DocumentUnit documentUnit = null) { IEvent evt = null; PECMail pecMail; try { pecMail = ((ICommandCreatePECMail)command).ContentType.ContentTypeValue; CollaborationUniqueId = null; if (command.CustomProperties.Where(x => x.Key == CustomPropertyName.COLLABORATION_UNIQUE_ID).Any() && Guid.TryParse(command.CustomProperties.Where(x => x.Key == CustomPropertyName.COLLABORATION_UNIQUE_ID).FirstOrDefault().Value.ToString(), out Guid guidResult)) { CollaborationUniqueId = guidResult; } CollaborationId = null; if (command.CustomProperties.Where(x => x.Key == CustomPropertyName.COLLABORATION_ID).Any() && int.TryParse(command.CustomProperties.Where(x => x.Key == CustomPropertyName.COLLABORATION_ID).FirstOrDefault().Value.ToString(), out int intResult)) { CollaborationId = intResult; } CollaborationTemplateName = string.Empty; if (command.CustomProperties.Where(x => x.Key == CustomPropertyName.COLLABORATION_TEMPLATE_NAME).Any()) { CollaborationTemplateName = command.CustomProperties.Where(x => x.Key == CustomPropertyName.COLLABORATION_TEMPLATE_NAME).FirstOrDefault().Value.ToString(); } ProtocolUniqueId = null; if (command.CustomProperties.Where(x => x.Key == CustomPropertyName.PROTOCOL_UNIQUE_ID).Any() && Guid.TryParse(command.CustomProperties.Where(x => x.Key == CustomPropertyName.PROTOCOL_UNIQUE_ID).FirstOrDefault().Value.ToString(), out guidResult)) { ProtocolUniqueId = guidResult; } ProtocolNumber = null; if (command.CustomProperties.Where(x => x.Key == CustomPropertyName.PROTOCOL_NUMBER).Any() && int.TryParse(command.CustomProperties.Where(x => x.Key == CustomPropertyName.PROTOCOL_NUMBER).FirstOrDefault().Value.ToString(), out intResult)) { ProtocolNumber = intResult; } ProtocolYear = null; if (command.CustomProperties.Where(x => x.Key == CustomPropertyName.PROTOCOL_YEAR).Any() && short.TryParse(command.CustomProperties.Where(x => x.Key == CustomPropertyName.PROTOCOL_YEAR).FirstOrDefault().Value.ToString(), out short shortResult)) { ProtocolYear = shortResult; } evt = new EventCreatePECMail(command.TenantName, command.TenantId, command.TenantAOOId, CollaborationUniqueId, CollaborationId, CollaborationTemplateName, ProtocolUniqueId, ProtocolYear, ProtocolNumber, false, command.Identity, pecMail, null); } catch (Exception ex) { _logger.WriteError(new LogMessage(string.Concat("PEC, CreateInsertEvent Error: ", command.GetType())), ex, LogCategories); throw ex; } return(evt); }
public async Task <DocumentUnit> SendDocumentAsync(DocumentUnit documentUnit, bool isUpdate) { DocumentUnit doc = null; if (!isUpdate) { doc = await PostDocumentUnitAsync(documentUnit); } if (isUpdate) { doc = await PutDocumentUnitAsync(documentUnit); } return(doc); }
public IEvent CreateEvent(ICommandCQRS command, bool isUpdate, DocumentUnit documentUnit = null) { IEvent evt = null; if (!isUpdate) { ICommandCQRSCreate cQRSCreate = (ICommandCQRSCreate)command; evt = CreateInsertEvent(cQRSCreate, documentUnit); } if (isUpdate) { ICommandCQRSUpdate cQRSUpdate = (ICommandCQRSUpdate)command; evt = CreateUpdateEvent(cQRSUpdate, documentUnit); } return(evt); }
internal override IEvent CreateInsertEvent(ICommandCQRSCreate command, DocumentUnit documentUnit = null) { IEvent evt = null; Message message; try { message = ((ICommandCreateMessage)command).ContentType.ContentTypeValue; evt = new EventCreateMessage(command.TenantName, command.TenantId, command.TenantAOOId, command.Identity, message); } catch (Exception ex) { _logger.WriteError(new LogMessage(string.Concat("Message, CreateInsertEvent Error: ", command.GetType())), ex, LogCategories); throw ex; } return(evt); }
internal override IEvent CreateUpdateEvent(ICommandCQRSUpdate command, DocumentUnit documentUnit = null) { IEvent evt = null; CategoryFascicle categoryFascicle; try { categoryFascicle = ((ICommandDeleteCategoryFascicle)command).ContentType.ContentTypeValue; evt = new EventDeleteCategoryFascicle(command.TenantName, command.TenantId, command.TenantAOOId, command.Identity, categoryFascicle); } catch (Exception ex) { _logger.WriteError(new LogMessage(string.Concat("CategoryFascicle, CreateUpdateEvent Error: ", command.GetType())), ex, LogCategories); throw ex; } return(evt); }
internal override IEvent CreateUpdateEvent(ICommandCQRSUpdate command, DocumentUnit documentUnit = null) { IEvent evt = null; Dossier dossier; try { dossier = ((ICommandUpdateDossier)command).ContentType.ContentTypeValue; evt = new EventUpdateDossier(command.TenantName, command.TenantId, command.TenantAOOId, command.Identity, dossier); } catch (Exception ex) { _logger.WriteError(new LogMessage($"Dossier, CreateUpdateEvent Error: {command.GetType()}"), ex, LogCategories); throw ex; } return(evt); }
internal override IEvent CreateUpdateEvent(ICommandCQRSUpdate command, DocumentUnit documentUnit = null) { IEvent evt = null; try { DocumentSeriesItem documentSeriesItem = ((ICommandUpdateDocumentSeriesItem)command).ContentType.ContentTypeValue; evt = new EventUpdateDocumentSeriesItem(command.TenantName, command.TenantId, command.TenantAOOId, command.Identity, documentSeriesItem, ((ICommandCQRSFascicolable)command).CategoryFascicle, documentUnit); } catch (Exception ex) { _logger.WriteError(new LogMessage(string.Concat("DocumentSeriesItem, CreateUpdateEvent Error: ", command.GetType())), ex, LogCategories); throw ex; } return(evt); }
internal override IEvent CreateInsertEvent(ICommandCQRSCreate command, DocumentUnit documentUnit = null) { IEvent evt = null; ResolutionModel resolution; try { resolution = ((ICommandCreateResolution)command).ContentType.ContentTypeValue; evt = new EventCreateResolution(command.TenantName, command.TenantId, command.TenantAOOId, command.Identity, resolution, ((ICommandCQRSFascicolable)command).CategoryFascicle, documentUnit); } catch (Exception ex) { _logger.WriteError(new LogMessage(string.Concat("Resolution, CreateInsertEvent Error: ", command.GetType())), ex, LogCategories); throw ex; } return(evt); }
internal override IEvent CreateInsertEvent(ICommandCQRSCreate command, DocumentUnit documentUnit = null) { IEvent evt = null; Collaboration collaboration; try { collaboration = ((ICommandCreateCollaboration)command).ContentType.ContentTypeValue; evt = new EventCreateCollaboration(command.Id, command.CorrelationId, command.TenantName, command.TenantId, command.TenantAOOId, command.Identity, collaboration, command.ScheduledTime); } catch (Exception ex) { _logger.WriteError(new LogMessage(string.Concat("Collaboration, CreateInsertEvent Error: ", command.GetType())), ex, LogCategories); throw ex; } return(evt); }
public async Task <IHttpActionResult> GetBiblosDocuments(Guid uniqueId, Guid?workflowArchiveChainId) { return(await ActionHelper.TryCatchWithLoggerGeneric(async() => { DocumentUnit documentUnit = _unitOfWork.Repository <DocumentUnit>().GetById(uniqueId).SingleOrDefault(); if (documentUnit == null) { throw new ArgumentNullException("Document unit not found"); } IList <DocumentModel> documents = new List <DocumentModel>(); foreach (DocumentUnitChain documentUnitChain in documentUnit.DocumentUnitChains) { foreach (ModelDocument.Document item in await _documentService.GetDocumentsFromChainAsync(documentUnitChain.IdArchiveChain)) { documents.Add(new DocumentModel { DocumentId = item.IdDocument, FileName = item.Name, ChainType = (DocSuiteWeb.Model.Entities.DocumentUnits.ChainType)documentUnitChain.ChainType, ChainId = item.IdChain.Value, ArchiveSection = documentUnitChain.DocumentLabel }); } } if (workflowArchiveChainId.HasValue) { foreach (ModelDocument.Document item in await _documentService.GetDocumentsFromChainAsync(workflowArchiveChainId.Value)) { documents.Add(new DocumentModel { ChainType = (DocSuiteWeb.Model.Entities.DocumentUnits.ChainType)ChainType.Miscellanea, DocumentId = item.IdDocument, FileName = item.Name, ChainId = workflowArchiveChainId.Value, ArchiveSection = "Miscellanea" }); } } return Ok(documents.AsQueryable()); }, _logger, LogCategories)); }
public IHttpActionResult DocumentUnitAssociated(ODataQueryOptions <Fascicle> options, Guid uniqueId) { return(CommonHelpers.ActionHelper.TryCatchWithLoggerGeneric <IHttpActionResult>(() => { DocumentUnit documentUnit = _unitOfWork.Repository <DocumentUnit>().GetById(uniqueId).SingleOrDefault(); if (documentUnit == null) { throw new DSWValidationException("DocumentUnitAssociated validation error", new List <ValidationMessageModel>() { new ValidationMessageModel() { Key = "Protocol", Message = "Nessun documneti trovato con l'ID passato" } }, null, DSWExceptionCode.VA_RulesetValidation); } IQueryable <Fascicle> associatedFascicles = _unitOfWork.Repository <Fascicle>().GetAssociated(documentUnit); return Ok(_mapper.MapCollection(associatedFascicles)); }, _logger, LogCategories)); }