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);
        }
Exemple #2
0
        internal override IEvent CreateUpdateEvent(ICommandCQRSUpdate command, DocumentUnit documentUnit = null)
        {
            IEvent  evt = null;
            PECMail pecMail;

            try
            {
                pecMail = ((ICommandUpdatePECMail)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.Where(x => x.Key == CustomPropertyName.COLLABORATION_ID).FirstOrDefault().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();
                }
                ProtocolUniqueId = null;
                if (command.CustomProperties.Any(x => x.Key == CustomPropertyName.PROTOCOL_UNIQUE_ID) && Guid.TryParse(command.CustomProperties.Single(x => x.Key == CustomPropertyName.PROTOCOL_UNIQUE_ID).Value.ToString(), out guidResult))
                {
                    ProtocolUniqueId = guidResult;
                }
                ProtocolNumber = null;
                if (command.CustomProperties.Any(x => x.Key == CustomPropertyName.PROTOCOL_NUMBER) && int.TryParse(command.CustomProperties.Single(x => x.Key == CustomPropertyName.PROTOCOL_NUMBER).Value.ToString(), out intResult))
                {
                    ProtocolNumber = intResult;
                }
                ProtocolYear = null;
                if (command.CustomProperties.Any(x => x.Key == CustomPropertyName.PROTOCOL_YEAR) && short.TryParse(command.CustomProperties.Single(x => x.Key == CustomPropertyName.PROTOCOL_YEAR).Value.ToString(), out short shortResult))
                {
                    ProtocolYear = shortResult;
                }

                evt = new EventUpdatePECMail(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, CreateUpdateEvent 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);
        }
Exemple #4
0
        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 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);
        }
Exemple #6
0
        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;
            FascicleDocumentUnit fascicleDocumentUnit;

            try
            {
                fascicleDocumentUnit = ((ICommandDeleteFascicleDocumentUnit)command).ContentType.ContentTypeValue;
                if (fascicleDocumentUnit.ReferenceType == ReferenceType.Reference)
                {
                    Task.Run(async() => await DeleteFascicleDocumentUnitCategory(fascicleDocumentUnit));
                }
                evt = new EventDeleteFascicleDocumentUnit(command.TenantName, command.TenantId, command.TenantAOOId, command.Identity, fascicleDocumentUnit);
            }
            catch (Exception ex)
            {
                _logger.WriteError(new LogMessage($"FascicleDocumentUnit, CreateUpdateEvent Error: {command.GetType()}"), ex, LogCategories);
                throw ex;
            }
            return(evt);
        }
Exemple #8
0
 internal override IEvent CreateUpdateEvent(ICommandCQRSUpdate command, DocumentUnit documentUnit = null)
 {
     return(null);
 }
 internal abstract IEvent CreateUpdateEvent(ICommandCQRSUpdate command, DocumentUnit documentUnit = null);