internal override IEvent CreateInsertEvent(ICommandCQRSCreate command, DocumentUnit documentUnit = null) { IEvent evt = null; UDSBuildModel udsBuildModel; try { udsBuildModel = ((ICommandCQRSCreateUDSData)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 EventCQRSCreateUDSData(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, CreateInsertEvent Error: ", command.GetType())), ex, LogCategories); throw ex; } return(evt); }
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 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; try { DocumentSeriesItem documentSeriesItem = ((ICommandCreateDocumentSeriesItem)command).ContentType.ContentTypeValue; evt = new EventCreateDocumentSeriesItem(command.TenantName, command.TenantId, command.TenantAOOId, command.Identity, documentSeriesItem, ((ICommandCQRSFascicolable)command).CategoryFascicle, documentUnit); } catch (Exception ex) { _logger.WriteError(new LogMessage(string.Concat("UDS, CreateInsertEvent Error: ", command.GetType())), ex, LogCategories); throw ex; } 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 CreateInsertEvent(ICommandCQRSCreate command, DocumentUnit documentUnit = null) { IEvent evt = null; Dossier dossier; try { dossier = ((ICommandCreateDossier)command).ContentType.ContentTypeValue; evt = new EventCreateDossier(command.TenantName, command.TenantId, command.TenantAOOId, command.Identity, dossier); } catch (Exception ex) { _logger.WriteError(new LogMessage($"Dossier, 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); }
internal override IEvent CreateInsertEvent(ICommandCQRSCreate command, DocumentUnit documentUnit = null) { IEvent evt = null; FascicleDocumentUnit fascicleDocumentUnit; try { fascicleDocumentUnit = ((ICommandCreateFascicleDocumentUnit)command).ContentType.ContentTypeValue; if (fascicleDocumentUnit.ReferenceType == ReferenceType.Reference) { Task.Run(async() => await InsertFascicleDocumentUnitCategory(fascicleDocumentUnit)); } evt = new EventCreateFascicleDocumentUnit(command.TenantName, command.TenantId, command.TenantAOOId, command.Identity, fascicleDocumentUnit); } catch (Exception ex) { _logger.WriteError(new LogMessage($"FascicleDocumentUnit, CreateInsertEvent Error: {command.GetType()}"), ex, LogCategories); throw ex; } return(evt); }
internal abstract IEvent CreateInsertEvent(ICommandCQRSCreate command, DocumentUnit documentUnit = null);