public void Process(InvalidReportReceived @event, EventSourceId caseReportId)
        {
            var dataCollector = _dataCollectors.GetById(@event.DataCollectorId);

            var caseReport = new TrainingCaseReportForListing(caseReportId.Value)
            {
                Status = CaseReportStatus.TextMessageParsingError,
                DataCollectorDisplayName = dataCollector.DisplayName,
                DataCollectorId          = dataCollector.Id,
                DataCollectorRegion      = dataCollector.Region,
                DataCollectorDistrict    = dataCollector.District,
                DataCollectorVillage     = dataCollector.Village,

                HealthRiskId = null,
                HealthRisk   = "Unknown",

                Location            = dataCollector.Location,
                Message             = @event.Message,
                Origin              = @event.Origin,
                ParsingErrorMessage = @event.ErrorMessages,
                Timestamp           = @event.Timestamp
            };

            _caseReports.Insert(caseReport);
        }
        public void Process(CaseReportReceived @event, EventSourceId caseReportId)
        {
            var dataCollector = _dataCollectors.GetById(@event.DataCollectorId);
            var healthRisk    = _healthRisks.GetById(@event.HealthRiskId);

            var caseReport = new TrainingCaseReportForListing(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
            };

            _caseReports.Insert(caseReport);
        }
        public void Process(CaseReportFromUnknownDataCollectorReceived @event, EventSourceId caseReportId)
        {
            var healthRisk = _healthRisks.GetById(@event.HealthRiskId);

            var caseReport = new TrainingCaseReportForListing(caseReportId.Value)
            {
                Status = CaseReportStatus.UnknownDataCollector,
                DataCollectorDisplayName = "Unknown",
                DataCollectorId          = null,

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

                Location  = Location.NotSet,
                Message   = @event.Message,
                Origin    = @event.Origin,
                Timestamp = @event.Timestamp,

                DataCollectorDistrict = null,
                DataCollectorRegion   = null,
                DataCollectorVillage  = null
            };

            _caseReports.Insert(caseReport);
        }
        public void Process(InvalidReportFromUnknownDataCollectorReceived @event, EventSourceId caseReportId)
        {
            var caseReport = new TrainingCaseReportForListing(caseReportId.Value)
            {
                Status = CaseReportStatus.TextMessageParsingErrorAndUnknownDataCollector,
                DataCollectorDisplayName = "Unknown",
                DataCollectorId          = null,
                HealthRiskId             = null,
                HealthRisk          = "Unknown",
                Location            = Location.NotSet,
                Message             = @event.Message,
                Origin              = @event.Origin,
                ParsingErrorMessage = @event.ErrorMessages,
                Timestamp           = @event.Timestamp,

                DataCollectorDistrict = null,
                DataCollectorRegion   = null,
                DataCollectorVillage  = null,
            };

            _caseReports.Insert(caseReport);
        }