示例#1
0
        private void GenerateCaseReceivedEvents(
            CaseReportData caseReportData,
            AgeGroup group,
            Sex sex,
            int count,
            int healthRiskNumber)
        {
            for (int i = 0; i < count; i++)
            {
                var caseRegistered = new CaseRegistered(
                    Guid.NewGuid(),
                    caseReportData.CaseReportId,
                    (int)group,
                    (int)sex,
                    caseReportData.Latitude,
                    caseReportData.Longitude,
                    caseReportData.Timestamp,
                    caseReportData.DataCollectorId,
                    caseReportData.HealthRiskId,
                    healthRiskNumber,
                    caseReportData.PhoneNumber);

                Apply(caseRegistered);
            }
        }
示例#2
0
        public void ProcessReport(CaseReportData caseReportData)
        {
            if (_isProcessed)
            {
                return;
            }

            GenerateCaseReceivedEvents(caseReportData, AgeGroup.AgeUnder5, Sex.Male, caseReportData.NumberOfMalesUnder5);
            GenerateCaseReceivedEvents(caseReportData, AgeGroup.Age5AndOver, Sex.Male, caseReportData.NumberOfMalesAged5AndOlder);
            GenerateCaseReceivedEvents(caseReportData, AgeGroup.AgeUnder5, Sex.Female, caseReportData.NumberOfFemalesUnder5);
            GenerateCaseReceivedEvents(caseReportData, AgeGroup.Age5AndOver, Sex.Female, caseReportData.NumberOfFemalesAged5AndOlder);
        }
示例#3
0
        public void ProcessReport(CaseReportData caseReportData)
        {
            if (_isProcessed)
            {
                return;
            }

            int healthRiskNumber = this.GetHealthRiskNumber(caseReportData.Message);

            GenerateCaseReceivedEvents(caseReportData, AgeGroup.AgeUnder5, Sex.Male, caseReportData.NumberOfMalesUnder5, healthRiskNumber);
            GenerateCaseReceivedEvents(caseReportData, AgeGroup.Age5AndOver, Sex.Male, caseReportData.NumberOfMalesAged5AndOlder, healthRiskNumber);
            GenerateCaseReceivedEvents(caseReportData, AgeGroup.AgeUnder5, Sex.Female, caseReportData.NumberOfFemalesUnder5, healthRiskNumber);
            GenerateCaseReceivedEvents(caseReportData, AgeGroup.Age5AndOver, Sex.Female, caseReportData.NumberOfFemalesAged5AndOlder, healthRiskNumber);
        }
示例#4
0
        public void Handle(ForcePublishNewCaseReport cmd)
        {
            var aggrRoot = _aggregateRootRepoForCaseReport.Get(cmd.CaseReportId);
            var data     = new CaseReportData
            {
                CaseReportId                 = cmd.CaseReportId,
                DataCollectorId              = cmd.DataCollectorId,
                HealthRiskId                 = cmd.HealthRiskId,
                Latitude                     = cmd.Latitude,
                Longitude                    = cmd.Longitude,
                Timestamp                    = cmd.Timestamp,
                NumberOfMalesUnder5          = cmd.NumberOfMalesUnder5,
                NumberOfMalesAged5AndOlder   = cmd.NumberOfMalesAged5AndOlder,
                NumberOfFemalesUnder5        = cmd.NumberOfFemalesUnder5,
                NumberOfFemalesAged5AndOlder = cmd.NumberOfFemalesAged5AndOlder,
                Message     = cmd.Message,
                PhoneNumber = cmd.Origin
            };

            aggrRoot.ProcessReport(data);
        }