private async Task InsertFascicleDocumentUnitCategory(FascicleDocumentUnit fascicleDocumentUnit)
        {
            try
            {
                DocumentUnitFascicleCategory documentUnitFascicleCategory = new DocumentUnitFascicleCategory
                {
                    Category     = fascicleDocumentUnit.Fascicle.Category,
                    DocumentUnit = fascicleDocumentUnit.DocumentUnit,
                    Fascicle     = fascicleDocumentUnit.Fascicle
                };
                DocumentUnitFascicleHistoricizedCategory documentUnitFascicleHistoricizedCategory = new DocumentUnitFascicleHistoricizedCategory
                {
                    UnfascicolatedDate = fascicleDocumentUnit.RegistrationDate,
                    ReferencedFascicle = $"{fascicleDocumentUnit.Fascicle.Title} - {fascicleDocumentUnit.Fascicle.FascicleObject}",
                    Category           = fascicleDocumentUnit.Fascicle.Category,
                    DocumentUnit       = fascicleDocumentUnit.DocumentUnit
                };

                await PostDocumentUnitFascicleCategory(documentUnitFascicleCategory);

                _logger.WriteDebug(new LogMessage($"DocumentUnitFascicleCategory - {documentUnitFascicleCategory.GetType()} - {documentUnitFascicleCategory.UniqueId} has been successfully created."), LogCategories);

                await PostDocumentUnitFascicleHistoricizedCategory(documentUnitFascicleHistoricizedCategory);

                _logger.WriteDebug(new LogMessage($"DocumentUnitFascicleHistoricizedCategory - {documentUnitFascicleHistoricizedCategory.GetType()} - {documentUnitFascicleHistoricizedCategory.UniqueId} has been successfully created."), LogCategories);
            }
            catch (Exception ex)
            {
                _logger.WriteError(new LogMessage("FascicleDocumentUnit, InsertFascicleDocumentUnitCategory Error: "), ex, LogCategories);
                throw ex;
            }
        }
예제 #2
0
 internal async Task <DocumentUnitFascicleHistoricizedCategory> PostDocumentUnitFascicleHistoricizedCategory(DocumentUnitFascicleHistoricizedCategory documentUnitFascicleHistoricizedCategory)
 {
     try
     {
         return(await _webApiClient.PostEntityAsync(documentUnitFascicleHistoricizedCategory));
     }
     catch (Exception ex)
     {
         _logger.WriteError(new LogMessage("PostDocumentUnitFascicleHistoricizedCategory Error: DocumentUnitFascicleHistoricizedCategory not sended to WebAPI"), ex, LogCategories);
         throw ex;
     }
 }