Ejemplo n.º 1
0
 public StudentLunchChoice(LunchChoice _lunchChoice, int _amountOfLunches, string _date)
 {
     lunchChoice     = _lunchChoice;
     userAddedBy     = null;
     amountOfLunches = _amountOfLunches;
     date            = _date;
 }
Ejemplo n.º 2
0
 public StudentLunchChoice(LunchChoice _lunchChoice, string _userAddedby, int _amountOfLunches)
 {
     lunchChoice     = _lunchChoice;
     userAddedBy     = _userAddedby;
     amountOfLunches = _amountOfLunches;
     date            = null;
 }
    public void DeleteSelectedLunchChoice()
    {
        if (selectedLunchChoice == null)
        {
            return;
        }

        DataBase.Instance.DeleteLunchChoice(selectedLunchChoice.lunchChoiceID);
        selectedLunchChoice = null;
        RepopulateTables();
    }
    public void ChangeLunchChoiceSelection(Button button)
    {
        if (lunchChoices.Count == 0)
        {
            return;
        }

        foreach (LunchChoice lunchChoice in lunchChoices)
        {
            if (lunchChoice.lunchChoiceName == button.name)
            {
                selectedLunchChoice = lunchChoice;
                return;
            }
        }
    }
    public void ChangeLunchChoiceSelection(Button button)
    {
        if (lunchChoices.Count == 0)
        {
            return;
        }

        foreach (LunchChoice lunchChoice in lunchChoices)
        {
            if (lunchChoice.lunchChoiceName == button.name)
            {
                selectedLunchChoice       = lunchChoice;
                selectedChosenProduct     = null;
                selectedAvailableProduct  = null;
                lunchChoiceNameInput.text = lunchChoice.lunchChoiceName;
                PopulateChosenProductsTable();
                return;
            }
        }
    }
    private void RepopulateTables()
    {
        if (selectedLunchChoice != null)
        {
            int lunchChoiceID = selectedLunchChoice.lunchChoiceID;
            PopulateLunchChoiceTable();

            foreach (LunchChoice lunchchoice in lunchChoices) //this makes the user not have to reselect their lunch choice after every delete
            {
                if (lunchchoice.lunchChoiceID == lunchChoiceID)
                {
                    selectedLunchChoice = lunchchoice;
                }
            }
        }
        else
        {
            PopulateLunchChoiceTable();
        }

        PopulateAvailableProductsTable();
        PopulateChosenProductsTable();
    }