예제 #1
0
        public void Process(TrainingReportReceived @event, EventSourceId caseReportId)
        {
            var dataCollector = _dataCollectors.GetById(@event.DataCollectorId);
            var healthRisk    = _healthRisks.GetById(@event.HealthRiskId);

            var report = new TrainingReport(caseReportId.Value)
            {
                Status                   = CaseReportStatus.Success,
                Message                  = @event.Message,
                DataCollectorId          = dataCollector.Id,
                DataCollectorDisplayName = dataCollector.DisplayName,
                DataCollectorDistrict    = dataCollector.District,
                DataCollectorRegion      = dataCollector.Region,
                DataCollectorVillage     = dataCollector.Village,
                Location                 = dataCollector.Location,
                Origin                   = @event.Origin,

                HealthRiskId = healthRisk.Id,
                HealthRisk   = healthRisk.Name,

                NumberOfMalesUnder5          = @event.NumberOfMalesUnder5,
                NumberOfMalesAged5AndOlder   = @event.NumberOfMalesAged5AndOlder,
                NumberOfFemalesUnder5        = @event.NumberOfFemalesUnder5,
                NumberOfFemalesAged5AndOlder = @event.NumberOfFemalesAged5AndOlder,
                Timestamp = @event.Timestamp,
            };

            _trainingReports.Insert(report);
        }
예제 #2
0
        public void Process(InvalidTrainingReportReceived @event, EventSourceId caseReportId)
        {
            var dataCollector = _dataCollectors.GetById(@event.DataCollectorId);

            var report = new TrainingReport(caseReportId.Value)
            {
                Status                   = CaseReportStatus.TextMessageParsingError,
                Message                  = @event.Message,
                DataCollectorId          = dataCollector.Id,
                DataCollectorDisplayName = dataCollector.DisplayName,
                DataCollectorDistrict    = dataCollector.District,
                DataCollectorRegion      = dataCollector.Region,
                DataCollectorVillage     = dataCollector.Village,
                Location                 = dataCollector.Location,
                Origin                   = @event.Origin,

                HealthRiskId = null,
                HealthRisk   = "Unknown",
                Timestamp    = @event.Timestamp,
            };

            _trainingReports.Insert(report);
        }