Beispiel #1
0
        public void LogsForCharts()
        {
            var logs = realm.All <Log>().Where(l => l.UserId == User.Id);

            DailyTotalCarbs = 0;
            if (logs.Count() > 0)
            {
                foreach (Log log in logs)
                {
                    switch (log.Type)
                    {
                    case "Blood Glucose":
                        List <int> Amounts = new List <int>();
                        ListOfLogs.Add(log);
                        foreach (Log l in ListOfLogs)
                        {
                            Amounts.Add(int.Parse(l.Amount));
                        }
                        Average = Amounts.Average().ToString("F1");
                        Highest = Amounts.Max().ToString();
                        Lowest  = Amounts.Min().ToString();
                        break;

                    case "Food Item":
                        ListOfFoodLogs.Add(log);
                        if (log.LogDate.Day == DateTimeOffset.Now.Day)
                        {
                            DailyTotalCarbs = DailyTotalCarbs + int.Parse(log.Amount);
                            if (log.Calorie != null)
                            {
                                TotalCal = TotalCal + int.Parse(log.Calorie);
                            }
                        }
                        break;

                    case "Activity":
                        ListOfActivity.Add(log);
                        if (log.LogDate.Day == DateTimeOffset.Now.Day)
                        {
                            TotalMins = TotalMins + int.Parse(log.Amount);
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
        }
Beispiel #2
0
        public void FillActivities()
        {
            string[] listact = new string[5] {
                "Sledovanie TV", "Čítanie novín", "Ležanie na posteli", "Varenie", "Oddych na balkóne"
            };
            int i = 1;

            foreach (var a in listact)
            {
                Activities act = new Activities()
                {
                    Name = a
                };

                ListOfActivity.Enqueue(act);
            }
        }