コード例 #1
0
 private void SetUpOtherEventSummary()
 {
     _otherEventSummary = new OtherEventSummary(DataEntryUnitTestFixture.IdentityId, DataEntryUnitTestFixture.AgencyDetails.Id, Guid.NewGuid(), Number, null);
     _otherEventSummaryList.Add(_otherEventSummary);
     _summariesUnitOfWork.Setup(mock => mock.GetEntityQuery <Summary>(It.IsAny <TrackingMode>())).Returns(_otherEventSummaryList.AsQueryable());
     _summariesUnitOfWork.Setup(mock => mock.GetEntityQuery <OtherEventSummary>(It.IsAny <TrackingMode>())).Returns(_otherEventSummaryList.AsQueryable());
     _summariesUnitOfWork.Setup(mock => mock.Find <OtherEventSummary>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>())).Returns(_otherEventSummary);
     SetUpOtherEventEvent();
 }
コード例 #2
0
        public OtherEventSummary Create(OtherEventSummary summary)
        {
            var agencyId   = summary.Agency.AgencyId;
            var caseNumber = summary.Case.Number;

            summary.Id = _otherEventSummaryCommandService.CreateOtherEventSummary(agencyId, caseNumber, summary);

            return(summary);
        }
コード例 #3
0
        public void GetOtherEventSummaries()
        {
            SetUpIdentitityContext(ModuleType.OtherEvent);
            var otherEventSummaryList = new List <OtherEventSummary>();
            var otherEventSummary     = new OtherEventSummary(QueueUnitTestFixture.IdentityId, QueueUnitTestFixture.AgencyDetails.Id, It.IsAny <Guid>(), "123", null);

            otherEventSummaryList.Add(otherEventSummary);
            _summariesUnitOfWork.Setup(mock => mock.GetEntityQuery <OtherEventSummary>(TrackingMode.Automatic))
            .Returns(otherEventSummaryList.AsQueryable());
            var otherEventSummaryQueue = _summaryQueueService.GetOtherEventSummaries(It.IsAny <SummaryQueueFilter>());

            otherEventSummaryQueue.Should().NotBeEmpty();
            otherEventSummaryQueue.Should().BeOfType(typeof(List <OtherEventSummaryQueueItem>));
            _summariesUnitOfWork.Verify(mock => mock.GetEntityQuery <OtherEventSummary>(TrackingMode.Automatic));
        }
コード例 #4
0
        public OtherEventSynopsis FindOtherEventSynopsis(Guid id)
        {
            OtherEventSummary summary = FindOtherEventSummary(id);

            return(summary.As <OtherEventSynopsis>());
        }
コード例 #5
0
        private void PrepareOtherEventSummarySectionsForReport(Guid reportId, Section templateSection, string sectionHeader,
                                                               OtherEventSummary otherEventSummary, IReportsData reportDetails)
        {
            //All Public Safety type items
            var itemList = new List <IPublicSafetyEntityDetails>();

            switch (templateSection.SectionType)
            {
            case SectionType.Event:
                itemList.Add(otherEventSummary.Event);
                sectionHeader = GenericSectionName.EVENT;
                PreparePublicSafetyEntityForReport(templateSection, itemList, sectionHeader, string.Empty, reportDetails);
                break;

            case SectionType.Offense:
                sectionHeader = GenericSectionName.OFFENSES;
                PreparePublicSafetyEntityForReport(templateSection,
                                                   otherEventSummary.Offenses.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader,
                                                   string.Empty, reportDetails);
                break;

            case SectionType.Person:
                if (templateSection.Name == GenericSectionName.OTHERS)
                {
                    #region victims from others section

                    var otherVictims =
                        otherEventSummary.People.FindAll(
                            x =>
                            String.Equals(x.InvolvementType.Code, GenericSectionName.VICTIM,
                                          StringComparison.CurrentCultureIgnoreCase));

                    if (otherVictims.Count > 0)
                    {
                        PreparePublicSafetyEntityForReport(templateSection,
                                                           otherVictims.ToList <IPublicSafetyEntityDetails>(), GenericSectionName.VICTIMS,
                                                           string.Empty, reportDetails,
                                                           string.Empty, _runningIndexVictim);

                        _runningIndexVictim = (_runningIndexVictim > 0 ? _runningIndexVictim : 0) +
                                              otherVictims.Count;
                    }

                    #endregion

                    #region suspects from others section

                    var otherSuspects =
                        otherEventSummary.People.FindAll(
                            x =>
                            String.Equals(x.InvolvementType.Code, GenericSectionName.SUSPECT,
                                          StringComparison.CurrentCultureIgnoreCase));

                    if (otherSuspects.Count > 0)
                    {
                        PreparePublicSafetyEntityForReport(templateSection,
                                                           otherSuspects.ToList <IPublicSafetyEntityDetails>(), GenericSectionName.SUSPECTS,
                                                           string.Empty, reportDetails,
                                                           string.Empty, _runningIndexSuspect);

                        _runningIndexSuspect = (_runningIndexSuspect > 0 ? _runningIndexSuspect : 0) +
                                               otherSuspects.Count;
                    }

                    #endregion

                    var otherInvolvementTypes =
                        otherEventSummary.People.FindAll(
                            x =>
                            !String.Equals(x.InvolvementType.Code, GenericSectionName.VICTIM,
                                           StringComparison.CurrentCultureIgnoreCase)
                            &&
                            !String.Equals(x.InvolvementType.Code, GenericSectionName.SUSPECT,
                                           StringComparison.CurrentCultureIgnoreCase));

                    if (otherInvolvementTypes.Count > 0)
                    {
                        PrepareOtherEventPersonEntityForReport(templateSection, otherInvolvementTypes,
                                                               sectionHeader, reportDetails);
                    }
                }
                break;

            case SectionType.Organization:
                #region victims from organization section
                var organizationVictims =
                    otherEventSummary.Organizations.FindAll(x => String.Equals(x.InvolvementType.Code, GenericSectionName.VICTIM, StringComparison.CurrentCultureIgnoreCase));

                if (organizationVictims.Count > 0)
                {
                    PreparePublicSafetyEntityForReport(templateSection,
                                                       organizationVictims.ToList <IPublicSafetyEntityDetails>(), GenericSectionName.VICTIMS, string.Empty,
                                                       reportDetails,
                                                       string.Empty, _runningIndexVictim);
                    _runningIndexVictim = (_runningIndexVictim > 0 ? _runningIndexVictim : 0) + organizationVictims.Count;
                }
                #endregion

                #region suspects from organization section
                var organizationSuspects =
                    otherEventSummary.Organizations.FindAll(x => String.Equals(x.InvolvementType.Code, GenericSectionName.SUSPECT, StringComparison.CurrentCultureIgnoreCase));

                if (organizationSuspects.Count > 0)
                {
                    PreparePublicSafetyEntityForReport(templateSection,
                                                       organizationSuspects.ToList <IPublicSafetyEntityDetails>(), GenericSectionName.SUSPECTS, string.Empty,
                                                       reportDetails,
                                                       string.Empty, _runningIndexSuspect);
                    _runningIndexSuspect = (_runningIndexSuspect > 0 ? _runningIndexSuspect : 0) + organizationSuspects.Count;
                }
                #endregion

                var organizationOthers =
                    otherEventSummary.Organizations.FindAll(x => !String.Equals(x.InvolvementType.Code, GenericSectionName.VICTIM, StringComparison.CurrentCultureIgnoreCase) &&
                                                            !String.Equals(x.InvolvementType.Code, GenericSectionName.SUSPECT, StringComparison.CurrentCultureIgnoreCase));

                if (organizationOthers.Count > 0)
                {
                    PrepareOtherEventOrganizationOthersEntityForReport(templateSection, organizationOthers,
                                                                       GenericSectionName.OTHERS, reportDetails);
                }
                break;

            case SectionType.Vehicle:
                PreparePublicSafetyEntityForReport(templateSection,
                                                   otherEventSummary.Vehicles.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader,
                                                   string.Empty, reportDetails);
                break;

            case SectionType.Officer:
                PreparePublicSafetyEntityForReport(templateSection,
                                                   otherEventSummary.Officers.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader,
                                                   string.Empty, reportDetails);
                break;

            case SectionType.Narrative:
                PreparePublicSafetyEntityForReport(templateSection,
                                                   otherEventSummary.Narratives.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader,
                                                   string.Empty, reportDetails);
                break;

            case SectionType.Drug:
                PreparePublicSafetyEntityForReport(templateSection,
                                                   otherEventSummary.Drugs.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader, string.Empty,
                                                   reportDetails);
                break;

            case SectionType.Gun:
                PreparePublicSafetyEntityForReport(templateSection,
                                                   otherEventSummary.Guns.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader, string.Empty,
                                                   reportDetails);
                break;

            case SectionType.Property:
                PreparePublicSafetyEntityForReport(templateSection,
                                                   otherEventSummary.Property.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader,
                                                   string.Empty, reportDetails);
                break;
            }
        }