Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CsvReader reader             = new CsvReader();
            var       inputs             = reader.GetInputList();
            var       exerciseDictionary = reader.GetExerciseDictionary();
            var       foodDictionary     = reader.GetFoodDictionary();

            // Calculate Blood Level
            BloodSugarCalculator      bloodSugarCalculator = new BloodSugarCalculator(exerciseDictionary, foodDictionary);
            List <List <BloodSugar> > bloodSugars          = bloodSugarCalculator.GetBloodSugar(inputs);

            List <BloodSugar> flattenedBloodSugars = new List <BloodSugar>();

            bloodSugars.ForEach(o => flattenedBloodSugars.AddRange(o));
            rptBloodSugar.DataSource = flattenedBloodSugars;
            rptBloodSugar.DataBind();


            // Calculate Glycation
            var glycationCalculator             = new GlycationCalculator();
            List <List <Glycation> > glycations = glycationCalculator.GetGlycation(bloodSugars);

            List <Glycation> flattenedGlycations = new List <Glycation>();

            glycations.ForEach(o => flattenedGlycations.AddRange(o));
            rptGlycation.DataSource = flattenedGlycations;
            rptGlycation.DataBind();
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CsvReader reader             = new CsvReader();
            var       inputs             = reader.GetInputList();
            var       exerciseDictionary = reader.GetExerciseDictionary();
            var       foodDictionary     = reader.GetFoodDictionary();

            // Calculate Blood Level
            BloodSugarCalculator      bloodSugarCalculator = new BloodSugarCalculator(exerciseDictionary, foodDictionary);
            List <List <BloodSugar> > bloodSugars          = bloodSugarCalculator.GetBloodSugar(inputs);

            // Calculate Glycation
            var glycationCalculator             = new GlycationCalculator();
            List <List <Glycation> > glycations = glycationCalculator.GetGlycation(bloodSugars);

            List <Tuple <List <BloodSugar>, List <Glycation> > > resultPerDay = new List <Tuple <List <BloodSugar>, List <Glycation> > >();

            for (int i = 0; i < bloodSugars.Count; i++)
            {
                resultPerDay.Add(new Tuple <List <BloodSugar>, List <Glycation> >(bloodSugars[i], glycations[i]));
            }

            rptDays.DataSource = resultPerDay;
            rptDays.DataBind();
        }