Example #1
0
        /// <summary>
        /// Process a gun
        /// </summary>
        public long?Process(PublicSafetyGun gun)
        {
            var link = 0;

            gun.MasterPropertyId = _masterGunResolver.Resolve(gun);

            try
            {
                // invoke classic rms procs for master gun processing.
                link = new ProcessMasterGun(gun).Execute(_vsiData.Database);
            }
            catch (Exception e)
            {
                #region Handle Failure
                // TODO: Evaluate how the system should behave when unable to communicate with the classic system.
                // TODO: Should we set the link to null to indicate the gun has yet to be processed?
                // TODO: We may want to only set it to null if it is not already a proper value, so we don't
                // TODO: lose a valid link just because we cannot communicate with classic.

                var log = LogProvider.Get <MasterGunProcessor>();
                log.Error("Failed to process gun: " + Environment.NewLine + e);
                // TODO: What is a "valid" link? >0?  Do we need to do Anything?
                if (!gun.MasterPropertyId.HasValue || gun.MasterPropertyId < 1)
                {
                    link = 0;
                }
                #endregion
            }

            // Set the Link
            gun.SetMasterIndexLink(link);

            // Return the link for quick reference
            return(gun.MasterPropertyId);
        }
        public void ProcessMasterIndexes_Gun_AsEntity()
        {
            _gunProcessor.Setup(mock => mock.Process(It.IsAny <PublicSafetyGun>()));
            PublicSafetyGun entity = new PublicSafetyGun(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid());

            masterIndexServiceObj.ProcessMasterIndexes <PublicSafetyGun>(entity);
            _gunProcessor.VerifyAll();
        }
        private void SetUpIncidentGun()
        {
            var incidentGun = new PublicSafetyGun(DataEntryUnitTestFixture.IdentityId, DataEntryUnitTestFixture.AgencyDetails.Id, Guid.NewGuid());

            _summariesUnitOfWork.Setup(mock => mock.Find <PublicSafetyGun>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>()))
            .Returns(incidentGun);
            _incidentSummary.Guns.Add(incidentGun);
            _incidentGunId = incidentGun.Id;
        }
Example #4
0
        public long?Resolve(PublicSafetyGun gun)
        {
            var masterPropertyId = 0;

            if (gun.Make != null && gun.Model.Description != null && gun.Serial != null)
            {
                masterPropertyId = _vsiData.Master_Property.Where(x => x.Make == gun.Make.Description && x.Model == gun.Model.Description && x.Serial == gun.Serial).Select(x => x.Master_Property_Link).FirstOrDefault();
            }
            return(masterPropertyId);
        }
        public void FindArrestGun()
        {
            //Arrange
            var publicSafetyGun = new PublicSafetyGun(DataEntryUnitTestFixture.IdentityId, DataEntryUnitTestFixture.AgencyDetails.Id, Guid.NewGuid());

            summariesUnitOfWork.Setup(mock => mock.Find <PublicSafetyGun>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>())).Returns(publicSafetyGun);
            //Act
            var arrestGun = arrestSummaryQueryService.FindArrestGun(It.IsAny <Guid>());

            //Assert
            arrestGun.Should().NotBeNull();
        }
Example #6
0
 private void ProcessGun(PublicSafetyGun gun)
 {
     _gunProcessor.Process(gun);
 }
Example #7
0
 public ProcessMasterGun(PublicSafetyGun gun)
 {
     _gun = gun;
 }