예제 #1
0
        private string addOrUpdateCurrentDay(string date)
        {
            date = Md5Hashing.CreateMD5(date);
            var day = _dayRepository.Get(date);

            if (day == null)
            {
                _dayRepository.Add(new WholeDay(date));
            }

            return(date);
        }
예제 #2
0
        private void loadData()
        {
            pastItemsCombo.Items.Clear();
            var day  = Md5Hashing.CreateMD5(dateTimePicker.Text.Replace(" ", ""));
            var data = _nutritionRepo.GetAll(day);

            foreach (var item in data)
            {
                currentDayItems.Items.Add(new FoodBoxItem(item.calories, item.fats, item.saturatedFats, item.carbohydrates,
                                                          item.sugars, item.protein, item.salt, item.fibre, item.name, item.NutritionItemId, item.amount, item.dateTime));
            }

            var distinct   = _nutritionRepo.GetAllUnique();
            var collection = new AutoCompleteStringCollection();

            foreach (var item in distinct)
            {
                pastItemsCombo.Items.Add(new FoodComboItem(item.name, item.NutritionItemId, item.calories, item.fats,
                                                           item.saturatedFats, item.carbohydrates, item.sugars, item.protein, item.salt, item.fibre, item.amount));
                collection.Add(item.name);
            }
            pastItemsCombo.AutoCompleteCustomSource = collection;
        }