Example #1
0
        private void LoadWeekCalories()
        {
            var calories = MainWindow.UserNutritionRepository.GetSumsOfCalories(MainWindow.UserId, 7);

            foreach (var i in calories)
            {
                Calories.Add(new GraphicPoint()
                {
                    Date = i.Key.ToShortDateString(), Number = i.Value
                });
            }
        }
        public async void db()
        {
            calenDatabase = new CalendarTableDatabaseAzure();
            var details = await calenDatabase.GetCalendar();

            foreach (var row in details)
            {
                Calories.Add(new GraphModel {
                    Amount = row.Calorie, Date = row.Date.Date
                });
                Weights.Add(new GraphModel {
                    Amount = row.Weight, Date = row.Date.Date
                });
            }
        }
Example #3
0
 /// <summary>
 /// Расчет необходимых каллорий
 /// </summary>
 /// <param name="name">Цель.</param>
 public void ConsiderCalories(string name)
 {
     if (string.IsNullOrWhiteSpace(name))
     {
         throw new ArgumentNullException("Данные не могут быть пустыми или null", nameof(name));
     }
     if (name == "Mass gain")
     {
         var calories = MassGain();
         Calories.Add(name, calories);
     }
     else if (name == "Losing weight")
     {
         var calories1 = LosingWeight();
         Calories.Add(name, calories1);
     }
     Save();
 }
        void FakeSomeData()
        {
            Calories.Clear();
            Weights.Clear();

            Calories.Add(new GraphModel {
                Amount = 0, Date = new DateTime(2016, 10, 28)
            });
            Calories.Add(new GraphModel {
                Amount = 10, Date = new DateTime(2016, 10, 29)
            });
            Calories.Add(new GraphModel {
                Amount = 20, Date = new DateTime(2016, 10, 30)
            });
            Calories.Add(new GraphModel {
                Amount = 30, Date = new DateTime(2016, 11, 1)
            });

            Weights.Add(new GraphModel {
                Amount = 0, Date = new DateTime(2016, 10, 28)
            });
            Weights.Add(new GraphModel {
                Amount = 10, Date = new DateTime(2016, 10, 29)
            });
            Weights.Add(new GraphModel {
                Amount = 20, Date = new DateTime(2016, 10, 30)
            });
            Weights.Add(new GraphModel {
                Amount = 30, Date = new DateTime(2016, 11, 1)
            });
            Weights.Add(new GraphModel {
                Amount = 10, Date = new DateTime(2016, 11, 2)
            });
            Weights.Add(new GraphModel {
                Amount = 20, Date = new DateTime(2016, 11, 3)
            });
        }