public static bool SaveSmokerDiabeticInformation(long customerId, bool isSmoker, bool isDiabetic) { IFraminghamRiskCalculationRepository framinghamRiskCalculationRepository = new FraminghamRiskCalculationRepository(); return(framinghamRiskCalculationRepository.SaveSmokerDiabeticInformation(customerId, isSmoker, isDiabetic)); }
private List <FraminghamCalculationSource> BindGridViews() { IFraminghamRiskCalculationRepository framinghamRiskCalculationRepository = new FraminghamRiskCalculationRepository(); List <FraminghamCalculationSource> framinghamCalculationSources = framinghamRiskCalculationRepository.GetFraminghamCalculationSource(); AgeChartGridView.DataSource = framinghamCalculationSources.Where( framinghamCalculationSource => framinghamCalculationSource.Reading == ReadingLabels.Age).Select( framinghamCalculationSource => new FraminghamSourceViewData() { Range = GetDisplayRange(framinghamCalculationSource.MinValue, framinghamCalculationSource.MaxValue), MaxValue = framinghamCalculationSource.MaxValue, MinValue = framinghamCalculationSource.MinValue, MaleScore = framinghamCalculationSource.MaleScore, FemaleScore = framinghamCalculationSource.FemaleScore }); AgeChartGridView.DataBind(); var systolicData = framinghamCalculationSources.Where( framinghamCalculationSource => framinghamCalculationSource.Reading == ReadingLabels.SystolicRight).OrderBy( framinghamCalculationSource => framinghamCalculationSource.Id); var diastolicData = framinghamCalculationSources.Where( framinghamCalculationSource => framinghamCalculationSource.Reading == ReadingLabels.DiastolicRight).OrderBy( framinghamCalculationSource => framinghamCalculationSource.Id); IsSystolic = GetWorstBloodPressure(systolicData, diastolicData); var combinedData = systolicData.SelectMany( systolic => diastolicData.Where(d => d.MaleScore == systolic.MaleScore && d.FemaleScore == systolic.FemaleScore), (systolic, diastolic) => new FraminghamSourceViewData() { Range = GetDisplayRange(systolic.MinValue, systolic.MaxValue) + "/" + GetDisplayRange(diastolic.MinValue, diastolic.MaxValue), MaxValue = IsSystolic ? systolic.MaxValue : diastolic.MaxValue, MinValue = IsSystolic ? systolic.MinValue : diastolic.MinValue, MaleScore = IsSystolic ? systolic.MaleScore : diastolic.MaleScore, FemaleScore = IsSystolic ? systolic.FemaleScore : diastolic.FemaleScore }); BPGridView.DataSource = combinedData; BPGridView.DataBind(); SmokerGridView.DataSource = framinghamCalculationSources.Where( framinghamCalculationSource => framinghamCalculationSource.Reading == ReadingLabels.Smoker).Select( framinghamCalculationSource => new FraminghamSourceViewData() { Range = framinghamCalculationSource.MaxValue.Value == 0 ? "No" : "Yes", MaxValue = framinghamCalculationSource.MaxValue, MinValue = framinghamCalculationSource.MinValue, MaleScore = framinghamCalculationSource.MaleScore, FemaleScore = framinghamCalculationSource.FemaleScore }); SmokerGridView.DataBind(); DiabetesGridView.DataSource = framinghamCalculationSources.Where( framinghamCalculationSource => framinghamCalculationSource.Reading == ReadingLabels.Diabetes).Select ( framinghamCalculationSource => new FraminghamSourceViewData() { Range = framinghamCalculationSource.MaxValue.Value == 0 ? "No" : "Yes", MaxValue = framinghamCalculationSource.MaxValue, MinValue = framinghamCalculationSource.MinValue, MaleScore = framinghamCalculationSource.MaleScore, FemaleScore = framinghamCalculationSource.FemaleScore }); DiabetesGridView.DataBind(); TCholGridView.DataSource = framinghamCalculationSources.Where( framinghamCalculationSource => framinghamCalculationSource.Reading == ReadingLabels.TotalCholestrol). Select( framinghamCalculationSource => new FraminghamSourceViewData() { Range = GetDisplayRange(framinghamCalculationSource.MinValue, framinghamCalculationSource.MaxValue), MaxValue = framinghamCalculationSource.MaxValue, MinValue = framinghamCalculationSource.MinValue, MaleScore = framinghamCalculationSource.MaleScore, FemaleScore = framinghamCalculationSource.FemaleScore }); TCholGridView.DataBind(); HDLGridView.DataSource = framinghamCalculationSources.Where( framinghamCalculationSource => framinghamCalculationSource.Reading == ReadingLabels.HDL).Select( framinghamCalculationSource => new FraminghamSourceViewData() { Range = GetDisplayRange(framinghamCalculationSource.MinValue, framinghamCalculationSource.MaxValue), MaxValue = framinghamCalculationSource.MaxValue, MinValue = framinghamCalculationSource.MinValue, MaleScore = framinghamCalculationSource.MaleScore, FemaleScore = framinghamCalculationSource.FemaleScore }); HDLGridView.DataBind(); LDLGridView.DataSource = framinghamCalculationSources.Where( framinghamCalculationSource => framinghamCalculationSource.Reading == ReadingLabels.LDL).Select( framinghamCalculationSource => new FraminghamSourceViewData() { Range = GetDisplayRange(framinghamCalculationSource.MinValue, framinghamCalculationSource.MaxValue), MaxValue = framinghamCalculationSource.MaxValue, MinValue = framinghamCalculationSource.MinValue, MaleScore = framinghamCalculationSource.MaleScore, FemaleScore = framinghamCalculationSource.FemaleScore }); LDLGridView.DataBind(); return(framinghamCalculationSources); }