Пример #1
0
        private void EnterButton_Click(object sender, RoutedEventArgs e)
        {
            Team selectedTeam = (Team)TeamComboBox.SelectedItem;

            if (selectedTeam == null)
            {
                _errorText = "Teamnaam is niet ingevuld, vul een naam in";
                NotifyPropertyChanged("ErrorText");
                return;
            }
            _selectedTeam = teamController.getOnNaam(selectedTeam.TeamNaam);

            if (_selectedTeam == null)
            {
                // Naam komt niet voor, wijzigen is niet mogelijk
                _errorText = "Teamnaam komt niet voor in bestand, kies een andere naam";
                NotifyPropertyChanged("ErrorText");
                return;
            }
            //coachList.Add(new Coach("xxx de Lange","xxx",true);
            NotifyPropertyChanged("TeamList"); // method implemented below
                                               //this.NavigationService.Navigate(new CoachDataPage());
            if (_selectedTeam == null)
            {
                _selectedTeam = new Team(TeamComboBox.Text);
            }
            TeamDataPage TeamDataPage = new TeamDataPage(_selectedTeam);

            TeamDataPage.setTeam(_selectedTeam);
            this.NavigationService.Navigate(TeamDataPage);
        }
Пример #2
0
        //private void refreshCoachComboBox()
        //{
        //// Ophalen van alle Coaches
        //var coachList = coachController.findAllByNaam();
        //foreach (Coach coach in coachList)
        //{
        //    coachList.Add(coach);
        //    if (CoachComboBox.SelectedValue == null)
        //        TeamComboBox.SelectedValue = coach;
        //    }
        //coachList.Add(new Team("Stefan de Lange"));
        //coachList.Add("Wesley de Lange");
        //coachList.Add("Roel de Lange");
        //coachList.Add("Desiree de Lange");
        //
        //    NotifyPropertyChanged("Speler2List");
        //}
        //private void refreshSpeler1ComboBox()
        //{
        //    // Ophalen van alle Coaches
        //    var spelerList1 = spelerController.findAllByNaam();
        //    foreach (Speler splr in spelerList1)
        //    {
        //        speler1List.Add(splr);
        //        comboBox1.SelectedItem = 0;
        //    }
        //    NotifyPropertyChanged("Speler2List");
        // }
        //private void refreshSpeler2ComboBox()
        //{   // Ophalen van alle Coaches
        //    var spelerList2 = speler2Controller.findAllByNaam();
        //    foreach (Speler splr in speler2List)
        //    {
        //      speler2List.Add(splr);
        //        Speler2ComboBox.SelectedItem = 0;
        //    }
        //    NotifyPropertyChanged("Speler2List");
        //}
        private void NewButton_Click(object sender, RoutedEventArgs e)
        {
            Team _selectedTeam = (Team)TeamComboBox.SelectedItem;;

            if (string.IsNullOrWhiteSpace(TeamComboBox.Text))
            {
                _errorText = "Teamnaam is niet ingevuld, vul een naam in";
                NotifyPropertyChanged("ErrorText");
                return;
            }
            if (_selectedTeam is null)
            {
                _selectedTeam = new Team(TeamComboBox.Text);
            }
            _selectedTeam = teamController.getOnNaam(_selectedTeam.TeamNaam);

            // Indien de Coach al voorkomt, mag je die niet verder gaan
            if (_selectedTeam != null)// De coach bestaat niet indien gevonden record leeg is.
            {
                _errorText = "Team naam komt niet voor in bestand, kies een andere naam";
                NotifyPropertyChanged("ErrorText");
                return;
            }

            if (_selectedTeam == null)
            {
                _selectedTeam            = new Team(TeamComboBox.Text);
                _selectedTeam.SoortSport = "Tennis";
            }

            TeamDataPage TeamDataPage = new TeamDataPage(_selectedTeam);

            TeamDataPage.setTeam(_selectedTeam);
            this.NavigationService.Navigate(TeamDataPage);
        }