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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            return(null);
        }