Exemplo n.º 1
0
        /// <summary>
        /// Create the appropriate entity Modified message
        /// </summary>
        /// <param name="entity">The entity being Modified.</param>
        /// <param name="moduleType">Module Type of </param>
        /// <param name="aggregateType"></param>
        public static EntityModifiedMessage EntityModified <TEntity>(TEntity entity, ModuleType moduleType, DataEntryAggregateType aggregateType)
            where TEntity : PublicSafetyEntity
        {
            if (entity == null)
            {
                Log.Error("EntityModified called with null entity.");
            }

            else if (entity is PublicSafetyAttachment)
            {
                return(AttachmentMessageFactory.Modified(entity as PublicSafetyAttachment, moduleType, aggregateType));
            }

            else if (entity is PublicSafetyDrug)
            {
                return(DrugMessageFactory.Modified(entity as PublicSafetyDrug, moduleType, aggregateType));
            }

            else if (entity is PublicSafetyEvent)
            {
                return(EventMessageFactory.Modified(entity as PublicSafetyEvent, moduleType, aggregateType));
            }

            else if (entity is PublicSafetyGun)
            {
                return(GunMessageFactory.Modified(entity as PublicSafetyGun, moduleType, aggregateType));
            }

            else if (entity is PublicSafetyNarrative)
            {
                return(NarrativeMessageFactory.Modified(entity as PublicSafetyNarrative, moduleType, aggregateType));
            }

            else if (entity is PublicSafetyOffense)
            {
                return(OffenseMessageFactory.Modified(entity as PublicSafetyOffense, moduleType, aggregateType));
            }

            else if (entity is PublicSafetyOfficer)
            {
                return(OfficerMessageFactory.Modified(entity as PublicSafetyOfficer, moduleType, aggregateType));
            }

            else if (entity is PublicSafetyOrganization)
            {
                return(OrganizationMessageFactory.Modified(entity as PublicSafetyOrganization, moduleType, aggregateType));
            }

            else if (entity is PublicSafetyPerson)
            {
                return(PersonMessageFactory.Modified(entity as PublicSafetyPerson, moduleType, aggregateType));
            }

            else if (entity is PublicSafetyProperty)
            {
                return(PropertyMessageFactory.Modified(entity as PublicSafetyProperty, moduleType, aggregateType));
            }

            else if (entity is PublicSafetyVehicle)
            {
                return(VehicleMessageFactory.Modified(entity as PublicSafetyVehicle, moduleType, aggregateType));
            }

            else if (entity is PublicSafetyFeesPayments)
            {
                return(FeePaymentMessageFactory.Modified(entity as PublicSafetyFeesPayments, moduleType, aggregateType));
            }

            //else if (entity is CallForServiceCaseReceived)
            //    return CFSCaseReceivedMessageFactory.Modified(entity as CallForServiceCaseReceived, moduleType, aggregateType);

            else if (entity is CallForServiceE911)
            {
                return(CFSE911MessageFactory.Modified(entity as CallForServiceE911, moduleType, aggregateType));
            }

            else if (entity is CallForServiceResponse)
            {
                return(CFSResponseMessageFactory.Modified(entity as CallForServiceResponse, moduleType, aggregateType));
            }

            else if (entity is CallForServiceVehicle)
            {
                return(CFSVehicleMessageFactory.Modified(entity as CallForServiceVehicle, moduleType, aggregateType));
            }

            else if (entity is IncidentOfficerInvolvedShooting)
            {
                return(OfficerInvolvedShootingMessageFactory.Modified(entity as IncidentOfficerInvolvedShooting, moduleType, aggregateType));
            }

            else
            {
                Log.Info("No EntityModified message is defined for entity type " + entity.GetType().Name);
            }

            return(null);
        }