Esempio n. 1
0
        public static async SystemThreading.Task ShowArrestReportView(ArrestReport report)
        {
            await PopulateArrestLineItems(report);

            //Globals.Navigation.Push(new ArrestReportContainer(report));
            Globals.Navigation.Push(new ArrestReportViewContainer(report));
        }
        private void RenderArrestReportListBoxRow(ArrestReport report, ListBoxRow row)
        {
            var dateString = report.ArrestTimeDate.ToLocalTimeString(DateOutputPart.DATE);

            row.Text = String.Format("{0} Charges: {1}", dateString, report.Charges.Count);
            row.SetToolTipText(String.Format("Arrested {0}, {1} charges with {2} felony", dateString, report.Charges.Count, report.Charges.Count(x => x.IsFelony)));
        }
Esempio n. 3
0
        public void Handle_ItemSelected(object sender, Xamarin.Forms.SelectedItemChangedEventArgs e)
        {
            ArrestReport report          = (ArrestReport)e.SelectedItem;
            var          crimeDetailPage = new CrimeDetailPage(report.DCN, report.CrimeType);

            Navigation.PushAsync(crimeDetailPage);
        }
 private static void PopulateArrestParties(ArrestReport arrestReport)
 {
     try
     {
         List <ArrestReportPartyDoc> partyDocs;
         if (Globals.Store.arrestReportPartyDict.TryGetValue(arrestReport.id, out partyDocs))
         {
             foreach (var partyDoc in partyDocs)
             {
                 var party = new ArrestReportAdditionalParty();
                 party.id        = partyDoc.Id;
                 party.PartyType = (PartyTypes)partyDoc.PartyType;
                 party.FirstName = partyDoc.FirstName == null ? String.Empty : partyDoc.FirstName;
                 party.LastName  = partyDoc.LastName == null ? String.Empty : partyDoc.LastName;
                 party.DOB       = partyDoc.DOB == null ? String.Empty : partyDoc.DOB;
                 party.ReportId  = arrestReport.id;
                 arrestReport.AdditionalParties.Add(party);
             }
         }
     }
     catch (Exception e)
     {
         Function.LogCatch(e.ToString());
     }
 }
        private void SetUpArrestReport()
        {
            var arrestReport = new ArrestReport(DataEntryUnitTestFixture.IdentityId, DataEntryUnitTestFixture.AgencyDetails.Id, Guid.NewGuid(), Guid.NewGuid(), false);

            arrestReport.Number = Number;
            _reportsUnitOfWork.Setup(mock => mock.Find <Report>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>())).Returns(arrestReport);
        }
 public static void ShowArrestReportView(ArrestReport report)
 {
     PopulateArrestLineItems(report);
     PopulateArrestParties(report);
     //Globals.Navigation.Push(new ArrestReportContainer(report));
     Globals.Navigation.Push(new ArrestReportViewContainer(report));
 }
        private static ArrestReport generateRandomArrestReport(ComputerPlusEntity entity)
        {
            ArrestReport newArrest     = ArrestReport.CreateForPed(entity);
            int          randomSeconds = Globals.Random.Next(SECONDS_IN_A_DAY * 7, SECONDS_IN_A_DAY * 1200) * -1;

            newArrest.ArrestTimeDate = DateTime.Now.AddSeconds(randomSeconds);
            Vector3 randomLocation = Rage.World.GetRandomPositionOnStreet();

            newArrest.ArrestStreetAddress = Rage.World.GetStreetName(randomLocation);
            newArrest.ArrestCity          = Functions.GetZoneAtPosition(randomLocation).RealAreaName;
            newArrest.Details             = String.Empty;

            string randomChargeName = ComputerPedController.GetRandomWantedReason();
            bool   isFelony         = false;

            randomChargeName = randomChargeName.Substring(randomChargeName.LastIndexOf("=>") + 3);
            if (randomChargeName.EndsWith("(F)"))
            {
                isFelony         = true;
                randomChargeName = randomChargeName.Substring(0, randomChargeName.Length - 3);
            }
            ArrestChargeLineItem newCharge = new ArrestChargeLineItem();

            newCharge.id       = new Guid();
            newCharge.Charge   = randomChargeName;
            newCharge.IsFelony = isFelony;
            newCharge.Note     = String.Empty;
            newArrest.Charges.Add(newCharge);

            return(SaveArrestRecord(newArrest));
        }
 private void ChangeArrestReportDetailView(ArrestReport report)
 {
     if (arrestReportView != null && report != null)
     {
         arrestReportView.ChangeReport(report);
     }
 }
        public void ClassSetUp()
        {
            _identityId = Guid.NewGuid();
            var identityContext = new IdentityContext()
            {
                IdentityId = Guid.NewGuid()
            };

            _authorizationPolicy = new Mock <IServiceAuthorizationPolicy>();
            _authorizationPolicy.Setup(mock => mock.RequireViewPermissions(It.IsAny <IdentityContext>(), It.IsAny <Guid>(), It.IsAny <ModuleType>()));
            _identityProvider = new Mock <IServiceIdentityProvider>();
            _identityProvider.Setup(x => x.GetPrincipalIdentifier()).Returns(identityContext.IdentityId);
            _identityProvider.Setup(x => x.GetIdentityContext()).Returns(identityContext);

            _factory           = new MockRepository(MockBehavior.Loose);
            _reportsUnitOfWork = _factory.Create <IReportsUnitOfWork>();
            var dependencyContainer = _factory.Create <IDependencyContainer>();

            _agencyQueryService = _factory.Create <IAgencyQueryService>();
            dependencyContainer.Setup(mock => mock.Resolve <IAgencyQueryService>()).Returns(_agencyQueryService.Object);
            DependencyContainer.SetInstance(dependencyContainer.Object);
            _arrestReport = new ArrestReport(DataEntryUnitTestFixture.IdentityId, DataEntryUnitTestFixture.AgencyDetails.Id, Guid.NewGuid(), Guid.NewGuid(), false);
            _reportList   = new List <Report>();
            _reportList.Add(_arrestReport);
            _reportsUnitOfWork.Setup(mock => mock.GetEntityQuery <Report>(It.IsAny <TrackingMode>())).Returns(_reportList.AsQueryable());
            _arrestReportQueryService = new ArrestReportQueryService(_reportsUnitOfWork.Object, Mock.Of <ILog>(), _authorizationPolicy.Object, _identityProvider.Object);
        }
Esempio n. 10
0
 internal ArrestReportContainer(ArrestReport arrestReport, ComputerPlusEntity entity) : base(typeof(ArrestReportContainerTemplate))
 {
     Report       = arrestReport;
     reportEntity = entity;
     pedDetailsPage.SetErrorSubscription(this);
     pedDetailsPage.SetActionSubscription(this);
 }
 internal static ArrestReportContainer CreateForPed(ComputerPlusEntity entity, out ArrestReport report)
 {
     report = ArrestReport.CreateForPed(entity);
     return(new ArrestReportContainer(report)
     {
         LockArresteePedDetails = true
     });
 }
 internal void ChangeReport(ArrestReport report)
 {
     Report = report;
     if (this.Exists())
     {
         PopulateInputs(Report);
     }
 }
 private void AddChargeToReport(ArrestReport report, ArrestChargeLineItem lineItem)
 {
     if (report == null || lineItem == null)
     {
         return;
     }
     report.Charges.Add(lineItem);
     AddChargeToReportListbox(lineItem);
 }
Esempio n. 14
0
        public ArrestReport Create(ArrestReport report)
        {
            report.Id = _arrestReportCommandService.CreateReportWithTemplate(
                report.TemplateId,
                report.IsSupplement,
                report);

            return(report);
        }
 private void RemoveChargeFromReport(ArrestReport report, ArrestChargeLineItem lineItem)
 {
     if (report == null || lineItem == null)
     {
         return;
     }
     report.Charges.Remove(lb_charges.SelectedRow.UserData as ArrestChargeLineItem);
     lb_charges.RemoveRow(lb_charges.SelectedRowIndex);
 }
 public void ClassSetUp()
 {
     _factory = new MockRepository(MockBehavior.Loose);
     _workflowInstanceService = _factory.Create <IWorkflowInstanceService>();
     _templateProvider        = _factory.Create <ITemplateProvider>();
     _log = new Mock <ILog>();
     _authorizationService = new Mock <IServiceAuthorizationPolicy>();
     _identityProvider     = new Mock <IServiceIdentityProvider>();
     _arrestReport         = new ArrestReport(DataEntryUnitTestFixture.IdentityId, DataEntryUnitTestFixture.AgencyDetails.Id, Guid.NewGuid(), Guid.NewGuid(), false);
 }
Esempio n. 17
0
 public void ChangeReport(ArrestReport report)
 {
     this.Report = report;
     if (report == null)
     {
         return;
     }
     if (this.Exists())
     {
         PopulateListBoxFromReport();
     }
 }
 internal void ChangeReport(ArrestReport report)
 {
     Report = report;
     if (this.Exists())
     {
         lb_charges.UnselectAll();
         lb_charges.Clear();
         chargesTree.UnselectAll();
         tb_notes.Component.SetText(String.Empty);
         AddReportCharges();
     }
 }
        public static ArrestReport SaveArrestRecord(ArrestReport report)
        {
            try
            {
                if (report.IsNew)
                {
                    report.id = Guid.NewGuid();

                    insertArrestReport(report);
                    if (report.Charges != null && report.Charges.Count > 0)
                    {
                        foreach (var charge in report.Charges)
                        {
                            insertArrestReportLineItem(charge, report.id);
                        }
                    }
                    if (report.AdditionalParties != null && report.AdditionalParties.Count > 0)
                    {
                        foreach (var party in report.AdditionalParties)
                        {
                            insertArrestReportParties(party, report.id);
                        }
                    }
                }
                else
                {
                    updateArrestReport(report);
                    if (report.Charges != null && report.Charges.Count > 0)
                    {
                        clearArrestReportLineItem(report.id);
                        foreach (var charge in report.Charges)
                        {
                            insertArrestReportLineItem(charge, report.id);
                        }
                    }
                    if (report.AdditionalParties != null && report.AdditionalParties.Count > 0)
                    {
                        clearArrestReportParties(report.id);
                        foreach (var party in report.AdditionalParties)
                        {
                            insertArrestReportParties(party, report.id);
                        }
                    }
                }
                return(report);
            }
            catch (Exception e)
            {
                Function.LogCatch(e.ToString());
                return(null);
            }
        }
Esempio n. 20
0
 private async void OpenReport(ArrestReport report)
 {
     if (report != null)
     {
         if (OnArrestReportSelected == null)
         {
             await ComputerReportsController.ShowArrestReportView(report);
         }
         else
         {
             OnArrestReportSelected(report);
         }
     }
 }
Esempio n. 21
0
        public static async Task <bool> PopulateArrestLineItems(ArrestReport report)
        {
            try
            {
                await Globals.Store.Connection().GetChildrenAsync(report, true);

                return(true);
            }
            catch (Exception e)
            {
                Function.Log(e.ToString());
                return(false);
            }
        }
 public void ClassSetUp()
 {
     _factory             = new MockRepository(MockBehavior.Loose);
     _summariesUnitOfWork = _factory.Create <ISummariesUnitOfWork>();
     _summariesUnitOfWork.Setup(x => x.PendingMessages).Returns(new System.Collections.Generic.List <TriTech.InformRMS.Infrastructure.Messaging.Contracts.Messages.Message>());
     _masterIndexService = _factory.Create <IMasterIndexService>();
     _log = _factory.Create <ILog>();
     ////_eventDispatcher = _factory.Create<IEventDispatcher>();
     //MessageBus.SetInstance(//_eventDispatcher.Object, _messageBusClient.Object);
     _arrestReport            = new ArrestReport(DataEntryUnitTestFixture.IdentityId, DataEntryUnitTestFixture.AgencyDetails.Id, Guid.NewGuid(), Guid.NewGuid(), false);
     _arrestReport.Number     = Number;
     _arrestReport.CaseNumber = "999";
     _arrestReportTransfer    = new ArrestReportTransfer(_summariesUnitOfWork.Object, _masterIndexService.Object, _arrestReport, _log.Object, Mock.Of <IServiceAuthorizationPolicy>(), Mock.Of <IServiceIdentityProvider>());
 }
Esempio n. 23
0
        public void ArrestReportQueryService_FindArrest()
        {
            Guid reportId = GetReportId();

            Assert.IsInstanceOfType(reportId, typeof(Guid));
            Assert.AreNotEqual(reportId, Guid.Empty);
            var arrestReportQueryService = GetDependency <IArrestReportQueryService>();

            Assert.IsInstanceOfType(arrestReportQueryService, typeof(IArrestReportQueryService));

            ArrestReport arrestReport = arrestReportQueryService.FindArrestReport(reportId);

            Assert.IsNotNull(arrestReport);
            Assert.AreEqual(reportId, arrestReport.Id);
        }
        private static void updateArrestReport(ArrestReport report)
        {
            var arrestReportDoc = Globals.Store.arrestReportCollection.FindById(report.id);

            arrestReportDoc.ArrestTimeDate      = report.ArrestTimeDate.ToString(Function.DateFormatForPart(DateOutputPart.ISO));
            arrestReportDoc.FirstName           = report.FirstName;
            arrestReportDoc.LastName            = report.LastName;
            arrestReportDoc.DOB                 = report.DOB;
            arrestReportDoc.HomeAddress         = report.HomeAddress;
            arrestReportDoc.ArrestStreetAddress = report.ArrestStreetAddress;
            arrestReportDoc.ArrestCity          = report.ArrestCity;
            arrestReportDoc.Details             = report.Details;

            Globals.Store.arrestReportCollection.Update(arrestReportDoc);;
        }
        private static ArrestReport convertArrestReportDoc(ArrestReportDoc arrestReportDoc)
        {
            var arrestReport = new ArrestReport();

            arrestReport.id                  = arrestReportDoc.Id;
            arrestReport.ArrestTimeDate      = DateTime.ParseExact(arrestReportDoc.ArrestTimeDate, Function.DateFormatForPart(DateOutputPart.ISO), CultureInfo.CurrentCulture, DateTimeStyles.AssumeUniversal);
            arrestReport.FirstName           = arrestReportDoc.FirstName;
            arrestReport.LastName            = arrestReportDoc.LastName;
            arrestReport.DOB                 = arrestReportDoc.DOB;
            arrestReport.HomeAddress         = arrestReportDoc.HomeAddress;
            arrestReport.ArrestStreetAddress = arrestReportDoc.ArrestStreetAddress;
            arrestReport.ArrestCity          = arrestReportDoc.ArrestCity;
            arrestReport.Details             = arrestReportDoc.Details == null ? String.Empty : arrestReportDoc.Details;

            return(arrestReport);
        }
        private static void insertArrestReport(ArrestReport report)
        {
            var arrestReportDoc = new ArrestReportDoc
            {
                Id                  = report.id,
                ArrestTimeDate      = report.ArrestTimeDate.ToString(Function.DateFormatForPart(DateOutputPart.ISO)),
                FirstName           = report.FirstName,
                LastName            = report.LastName,
                DOB                 = report.DOB,
                HomeAddress         = report.HomeAddress,
                ArrestStreetAddress = report.ArrestStreetAddress,
                ArrestCity          = report.ArrestCity,
                Details             = report.Details
            };

            Globals.Store.arrestReportCollection.Insert(arrestReportDoc);
        }
Esempio n. 27
0
        public void ReportQueryService_CheckAgencyId()
        {
            Guid reportId = GetReportId();

            Assert.IsInstanceOfType(reportId, typeof(Guid));
            Assert.AreNotEqual(reportId, Guid.Empty);
            var reportQueryService = GetDependency <IReportQueryService>();

            Assert.IsInstanceOfType(reportQueryService, typeof(IReportQueryService));
            var arrestReportQueryService = GetDependency <IArrestReportQueryService>();

            Assert.IsInstanceOfType(arrestReportQueryService, typeof(IArrestReportQueryService));
            ArrestReport arrestReport = arrestReportQueryService.FindArrestReport(reportId);
            ReportInfo   reportInfo   = reportQueryService.GetReportInfo(reportId);

            Assert.AreEqual(arrestReport.Agency.AgencyId, reportInfo.Agency.AgencyId);
            Assert.AreEqual(reportId, reportInfo.ReportId);
        }
 private static void PopulateArrestReportCharges(ArrestReport arrestReport)
 {
     try
     {
         List <ArrestReportChargeDoc> chargeDocs = Globals.Store.arrestReportChargeCollection.Find(x => x.ArrestReportId == arrestReport.id).ToList();
         foreach (var chargeDoc in chargeDocs)
         {
             var charge = new ArrestChargeLineItem();
             charge.id       = chargeDoc.Id;
             charge.Charge   = chargeDoc.Charge;
             charge.IsFelony = chargeDoc.IsFelony;
             charge.Note     = chargeDoc.Note == null ? String.Empty : chargeDoc.Note;
             charge.ReportId = chargeDoc.ArrestReportId;
             arrestReport.Charges.Add(charge);
         }
     }
     catch (Exception e)
     {
         Function.LogCatch(e.ToString());
     }
 }
        private static void updateArrestReport(ArrestReport report)
        {
            string pedHash = report.FirstName + report.LastName + report.DOB;
            List <ArrestReportDoc> arrestReportDocs;

            if (Globals.Store.arrestReportDict.TryGetValue(pedHash, out arrestReportDocs))
            {
                ArrestReportDoc arrestReportDoc = arrestReportDocs.Find(x => x.Id == report.id);
                if (arrestReportDoc != null)
                {
                    arrestReportDoc.ArrestTimeDate      = report.ArrestTimeDate.ToString(Function.DateFormatForPart(DateOutputPart.ISO));
                    arrestReportDoc.FirstName           = report.FirstName;
                    arrestReportDoc.LastName            = report.LastName;
                    arrestReportDoc.DOB                 = report.DOB;
                    arrestReportDoc.HomeAddress         = report.HomeAddress;
                    arrestReportDoc.ArrestStreetAddress = report.ArrestStreetAddress;
                    arrestReportDoc.ArrestCity          = report.ArrestCity;
                    arrestReportDoc.Details             = report.Details;
                }
            }
        }
Esempio n. 30
0
        public static async Task <ArrestReport> SaveArrestRecordAsync(ArrestReport report)
        {
            try
            {
                if (report.IsNew)
                {
                    report.id = Guid.NewGuid();
                    await Globals.Store.Connection().InsertWithChildrenAsync(report, true);
                }
                else
                {
                    await Globals.Store.Connection().InsertOrReplaceWithChildrenAsync(report, true);
                }

                return(report);
            }
            catch (Exception e)
            {
                Function.LogCatch(e.ToString());
                return(null);
            }
        }