/*Function that shows the specific food for a child
         * if the food of the day can not eat it.
         * */
        private void DietSpecificForChild_Load(object sender, EventArgs e)
        {
            this.Text     = "BLIST - " + language["DietA"];
            lbB.Text      = language["Bre"];
            lbL.Text      = language["Lunch"];
            lbS.Text      = language["Snack"];
            btChange.Text = language["Chan"];

            if (breakfast == null && lunch == null && snack == null)
            {
                FoodSelection food = new FoodSelection(listC, listM);
                Child         c    = listC.GetChildOfList(index);
                lbInfoChild.Text = c.GetCod().ToString() + "  :  " + c.GetName() + " " + c.GetSurname();
                tbBreak.Text     = food.SelectFoodForChild(listM.GetBreakfastFood(), index);
                tbLunch.Text     = food.SelectFoodForChild(listM.GetLunchFood(), index);
                tbSnack.Text     = food.SelectFoodForChild(listM.GetSnackFood(), index);
                breakfast        = food.GetBreakfast();
                lunch            = food.GetLunch();
                snack            = food.GetSnack();
            }
            else
            {
                tbBreak.Text = breakfast;
                tbLunch.Text = lunch;
                tbSnack.Text = snack;
            }
        }
Пример #2
0
        //Function that chooses a meal according to a child's allergies
        public string SelectFoodForChild(List <Meal> m, int i)
        {
            Child child = listC.GetChildOfList(i);
            bool  found;

            if (child.GetAllergies() == "")
            {
                return(FoodForShow(m));
            }

            else
            {
                string[] arrAllergiesChild = child.GetArrayAllergies();
                string[] arrAllergiesMeals = new string[m.Count];
                for (int j = 0; j < m.Count; j++)
                {
                    arrAllergiesMeals[j] = m[j].GetAllergies();
                }

                for (int j = 0; j < m.Count; j++)
                {
                    found = false;

                    for (int h = 0; h < arrAllergiesChild.Length && !found; h++)
                    {
                        if (arrAllergiesMeals[j].Contains(arrAllergiesChild[h]))
                        {
                            found = true;
                        }
                        if ((h == arrAllergiesChild.Length - 1) && (!found))
                        {
                            return(m[j].GetFood());
                        }
                    }
                }

                return("");
            }
        }
Пример #3
0
        private void ShowChild_Load(object sender, EventArgs e)
        {
            this.Text = "BLIST - " + language["ShowC"];
            Day birth = listChildren.GetChildOfList(index).GetBirthday();
            Day today = new Day();

            lbAge.Text               = language["Age"];
            lbName.Text              = language["Name"];
            lbSurnames.Text          = language["Sur"];
            lbSex.Text               = language["Sex"];
            lbCod.Text               = language["Cod"];
            lbObservations.Text      = language["Obs"];
            lbAllergies.Text         = language["Aller"];
            lbMessageForSchool.Text  = language["MesS"];
            lbMessgeForHome.Text     = language["MesH"];
            lbInfoBeak.Text          = language["IEBr"];
            lbInfLunch.Text          = language["IELu"];
            lbInfSnack.Text          = language["IESn"];
            btDiet.Text              = language["Diet"];
            cbEatBreakAll.Text       = language["All"];
            cbEatBreakHalf.Text      = language["Half"];
            cbEatBreakLittle.Text    = language["Little"];
            cbEatLunchAll.Text       = language["All"];
            cbEatLunchHalf.Text      = language["Half"];
            cbEatLunchLittle.Text    = language["Little"];
            cbEatSnackAll.Text       = language["All"];
            cbEatSnackHalf.Text      = language["Half"];
            cbEatSnackLittle.Text    = language["Little"];
            lbDepositions.Text       = language["Depo"];
            lbDepositionsMor.Text    = language["Morn"];
            lbDepositionsAft.Text    = language["Aft"];
            lbSleepMor.Text          = language["Morn"];
            lbSleepAft.Text          = language["Aft"];
            lbSleep.Text             = language["Sleep"];
            cbDepositionsMorYes.Text = language["Y"];
            cbDepositionsAftYes.Text = language["Y"];
            cbSleepMorGood.Text      = language["Good"];
            cbSleepMorBad.Text       = language["Bad"];
            cbSleepAftGood.Text      = language["Good"];
            cbSleepAftBad.Text       = language["Bad"];
            lbSinceMor.Text          = language["Since"];
            lbSinceAft.Text          = language["Since"];
            lbUntilMor.Text          = language["Until"];
            lbUntilAft.Text          = language["Until"];
            btPrintA.Text            = language["PrintAll"];

            today.day   = time.Day;
            today.month = time.Month;
            today.year  = time.Year;

            foreach (InformationOfDay j in list.GetInformationOfAChild(index + 1))
            {
                cbDaysInformation.Items.Add(j.GetDayForShow());
            }

            tbBirthday.Text     = birth.day + "/" + birth.month + "/" + birth.year;
            tbName.Text         = listChildren.GetChildOfList(index).GetName();
            tbSurnames.Text     = listChildren.GetChildOfList(index).GetSurname();
            tbSex.Text          = listChildren.GetChildOfList(index).GetSex().ToString();
            tbCod.Text          = listChildren.GetChildOfList(index).GetCod().ToString();
            tbObservations.Text =
                listChildren.GetChildOfList(index).GetObservations();
            tbAllergies.Text =
                listChildren.GetChildOfList(index).GetAllergies();
            tbAge.Text     = listChildren.GetChildOfList(index).GetAge().ToString();
            lbTypeAge.Text = listChildren.GetChildOfList(index).GetTypeAge();

            tbFoodBreakfast.Text = meal.GetBreakfast();
            tbFoodLunch.Text     = meal.GetLunch();
            tbFoodSnack.Text     = meal.GetSnack();

            dtpSinceSleepMor.Format       = DateTimePickerFormat.Custom;
            dtpSinceSleepMor.CustomFormat = "HH : mm";
            dtpUntilSleepMor.Format       = DateTimePickerFormat.Custom;
            dtpUntilSleepMor.CustomFormat = "HH : mm";
            dtpSinceSleepAft.Format       = DateTimePickerFormat.Custom;
            dtpSinceSleepAft.CustomFormat = "HH : mm";
            dtpUntilSleepAft.Format       = DateTimePickerFormat.Custom;
            dtpUntilSleepAft.CustomFormat = "HH : mm";
            cbDaysInformation.Text        = time.Day + "/" + time.Month + "/" + time.Year;

            InformationOfDay information = list.GetInformationOfAChildFromDate(
                today, listChildren.GetChildOfList(index).GetCod());

            if (information != null)
            {
                if (information.GetEatAmoutB() == 1)
                {
                    cbEatBreakAll.CheckState = CheckState.Checked;
                }
                else if (information.GetEatAmoutB() == 2)
                {
                    cbEatBreakHalf.CheckState = CheckState.Checked;
                }
                else if (information.GetEatAmoutB() == 3)
                {
                    cbEatBreakLittle.CheckState = CheckState.Checked;
                }

                if (information.GetEatAmoutL() == 1)
                {
                    cbEatLunchAll.CheckState = CheckState.Checked;
                }
                else if (information.GetEatAmoutL() == 2)
                {
                    cbEatLunchHalf.CheckState = CheckState.Checked;
                }
                else if (information.GetEatAmoutL() == 3)
                {
                    cbEatLunchLittle.CheckState = CheckState.Checked;
                }

                if (information.GetEatAmoutS() == 1)
                {
                    cbEatSnackAll.CheckState = CheckState.Checked;
                }
                else if (information.GetEatAmoutS() == 2)
                {
                    cbEatSnackHalf.CheckState = CheckState.Checked;
                }
                else if (information.GetEatAmoutS() == 3)
                {
                    cbEatSnackLittle.CheckState = CheckState.Checked;
                }

                switch (information.GetDepositionsMor())
                {
                case 1:
                    cbDepositionsMorYes.CheckState = CheckState.Checked;
                    break;

                case 2:
                    cbDepositionsMorNo.CheckState = CheckState.Checked;
                    break;

                default:
                    break;
                }

                switch (information.GetDepositionsAft())
                {
                case 1: cbDepositionsAftYes.CheckState = CheckState.Checked;
                    break;

                case 2: cbDepositionsAftNo.CheckState = CheckState.Checked;
                    break;

                default:
                    break;
                }

                switch (information.GetSleepMor())
                {
                case 1:
                    cbSleepMorGood.CheckState = CheckState.Checked;
                    break;

                case 2:
                    cbSleepMorBad.CheckState = CheckState.Checked;
                    break;

                default:
                    break;
                }

                switch (information.GetSleepAft())
                {
                case 1:
                    cbSleepAftGood.CheckState = CheckState.Checked;
                    break;

                case 2:
                    cbSleepAftBad.CheckState = CheckState.Checked;
                    break;

                default:
                    break;
                }


                tbMessageForHome.Text   = information.GetMessageForHome();
                tbMessageForSchool.Text = information.GetMessageForSchool();
            }
        }