コード例 #1
0
        private void FillWindow()
        {
            _userRepository = new UserRepository();
            _userService    = new UserService(_userRepository);
            this.user       = _userService.FindById(user.Id);
            if (user.Gender == true)
            {
                lbGender.Content = "Male";
            }
            else
            {
                lbGender.Content = "Female";
            }
            lbAge.Content    = user.Age;
            lbWeight.Content = user.Weight;
            lbHeight.Content = user.Height;
            lbName.Content   = user.FirstName + " " + user.LastName;
            tblCalories.Text = user.RecommentedCountOfCalories.ToString();

            lbRecommendedCalories.Content = user.RecommentedCountOfCalories.ToString();
            lbRecommendedCarbs.Content    = user.RecommentedCountOfCarbohydrates.ToString();
            lbRecommendedFats.Content     = user.RecommentedCountOfFats.ToString();
            lbRecommendedProteins.Content = user.RecommentedCountOfProteins.ToString();

            cbProducts.SelectedIndex = -1;
            tboxProductWeight.Text   = "";
            DayDTO day = user.FindDay(Convert.ToDateTime(Calendar1.SelectedDate));

            if (day != null)
            {
                day.FillDay();
                lbAtedCalories.Content     = day.AtedCalories.ToString();
                lbAtedCarbs.Content        = day.AtedCarbohydrates.ToString();
                lbAtedFats.Content         = day.AtedFats.ToString();
                lbAtedProteins.Content     = day.AtedProteins.ToString();
                lbAtedProducts.ItemsSource = day.AtedProducts.ToList();
            }
            else
            {
                lbAtedCalories.Content = 0;
                lbAtedCarbs.Content    = 0;
                lbAtedFats.Content     = 0;
                lbAtedProteins.Content = 0;
            }
        }