public DiscreteCollectionMethodViewData(Models.TreatmentBMPAssessmentObservationType treatmentBMPAssessmentObservationType) { ViewDataForAngular = new DiscreteCollectionMethodViewDataForAngular(treatmentBMPAssessmentObservationType.GetDiscreteObservationTypeSchema()); MeasurementUnitLabelAndUnit = $"{treatmentBMPAssessmentObservationType.GetDiscreteObservationTypeSchema().MeasurementUnitLabel} ({treatmentBMPAssessmentObservationType.BenchmarkMeasurementUnitType().LegendDisplayName})"; AssessmentDescription = treatmentBMPAssessmentObservationType.GetDiscreteObservationTypeSchema().AssessmentDescription; }
public ObservationTypeSchema(Models.TreatmentBMPAssessmentObservationType treatmentBMPAssessmentObservationType, List <CollectionMethodSectionViewModel> initialAssessmentObservations) { InitialAssessmentObservations = initialAssessmentObservations; TreatmentBMPAssessmentObservationTypeID = treatmentBMPAssessmentObservationType.TreatmentBMPAssessmentObservationTypeID; TreatmentBMPAssessmentObservationTypeName = treatmentBMPAssessmentObservationType.TreatmentBMPAssessmentObservationTypeName; ObservationTypeCollectionMethod = treatmentBMPAssessmentObservationType.ObservationTypeSpecification.ObservationTypeCollectionMethod.ToEnum; switch (ObservationTypeCollectionMethod) { case ObservationTypeCollectionMethodEnum.DiscreteValue: var discreteObservationTypeSchema = treatmentBMPAssessmentObservationType.GetDiscreteObservationTypeSchema(); PropertiesToObserve = discreteObservationTypeSchema.PropertiesToObserve .Select((x, index) => new SelectItemSimple(index, x)).ToList(); AssessmentDescription = discreteObservationTypeSchema.AssessmentDescription; MinimumNumberOfObservations = discreteObservationTypeSchema.MinimumNumberOfObservations; MaximumNumberOfObservations = discreteObservationTypeSchema.MaximumNumberOfObservations ?? int.MaxValue; MinimumValueOfObservations = discreteObservationTypeSchema.MinimumValueOfObservations; MaximumValueOfObservations = discreteObservationTypeSchema.MaximumValueOfObservations ?? double.MaxValue; MeasurementUnitLabelAndUnit = $"{discreteObservationTypeSchema.MeasurementUnitLabel} ({treatmentBMPAssessmentObservationType.BenchmarkMeasurementUnitType().LegendDisplayName})"; break; case ObservationTypeCollectionMethodEnum.PassFail: var passFailObservationTypeSchema = treatmentBMPAssessmentObservationType.GetPassFailSchema(); PropertiesToObserve = passFailObservationTypeSchema.PropertiesToObserve .Select((x, index) => new SelectItemSimple(index, x)).ToList(); AssessmentDescription = passFailObservationTypeSchema.AssessmentDescription; PassingScoreLabel = passFailObservationTypeSchema.PassingScoreLabel; FailingScoreLabel = passFailObservationTypeSchema.FailingScoreLabel; break; case ObservationTypeCollectionMethodEnum.Percentage: var percentageObservationTypeSchema = treatmentBMPAssessmentObservationType.GetPercentageSchema(); PropertiesToObserve = percentageObservationTypeSchema.PropertiesToObserve .Select((x, index) => new SelectItemSimple(index, x)).ToList(); AssessmentDescription = percentageObservationTypeSchema.AssessmentDescription; MeasurementUnitLabelAndUnit = $"{treatmentBMPAssessmentObservationType.BenchmarkMeasurementUnitLabel()} ({treatmentBMPAssessmentObservationType.BenchmarkMeasurementUnitType().LegendDisplayName})"; break; default: throw new ArgumentOutOfRangeException(); } }