private void Lv_kurs_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            btn_reset.IsEnabled = false;
            btn_new.IsEnabled   = true;
            btn_del.IsEnabled   = true;
            btn_save.IsEnabled  = false;

            if (lv_kurs.SelectedItem is Kurs selectedKurs)
            {
                tb_name.Text         = selectedKurs.Name;
                tb_beschreibung.Text = selectedKurs.Beschreibung;
                tb_ects.Text         = selectedKurs.ECTS.ToString();

                validationController.ResetValidAttributes(true);
            }
            else
            {
                validationController.ResetValidAttributes(false);
            }
        }
        private void Lv_person_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            btn_reset.IsEnabled = false;
            btn_new.IsEnabled   = true;
            btn_del.IsEnabled   = true;
            btn_save.IsEnabled  = false;

            if (lv_person.SelectedItem is Person selectedPerson)
            {
                dp_geburtsdatum.SelectedDate = selectedPerson.Geburtsdatum;
                tb_vorname.Text      = selectedPerson.Vorname;
                tb_nachname.Text     = selectedPerson.Nachname;
                tb_strasse.Text      = selectedPerson.Adresse.Strasse;
                tb_hausnummer.Text   = selectedPerson.Adresse.Hausnummer;
                tb_postleitzahl.Text = selectedPerson.Adresse.Postleitzahl.ToString();
                tb_ort.Text          = selectedPerson.Adresse.Ort;

                cb_rolle.SelectedItem = selectedPerson.Rolle;

                switch (selectedPerson.Rolle)
                {
                case Rolle.Dozent:
                    Dozent dozent = (Dozent)selectedPerson;
                    tb_abschluss.Text = dozent.Abschluss.Name;
                    break;

                case Rolle.Student:
                    Student student = (Student)selectedPerson;
                    tb_matrikelnummer.Text = student.Matrikelnummer.ToString();
                    tb_ects.Text           = student.ECTS.ToString();
                    break;
                }

                validationController.ResetValidAttributes(true);
            }
            else
            {
                validationController.ResetValidAttributes(false);
            }
        }
예제 #3
0
        private void lv_studiengang_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (lv_studiengang.SelectedItem is Studiengang selectedStudiengang)
            {
                studiengang = (Studiengang)selectedStudiengang.Clone();
                validationControllerStudiengang.ResetValidAttributes(true);
            }
            else
            {
                studiengang = new Studiengang();
            }

            if (PersonListe.Instance.GetStudentListe().Count > 0)
            {
                cb_student.IsEnabled = true;
            }

            btn_reset.IsEnabled = false;
            btn_new.IsEnabled   = true;
            btn_del.IsEnabled   = true;
            btn_save.IsEnabled  = false;

            tb_studiengang.Text = studiengang.Name;
            tb_abschluss.Text   = studiengang.Abschluss.Name;
            tb_ects.Text        = studiengang.ECTS.ToString();

            tb_semester.Text           = "";
            dp_startdatum.Text         = "";
            dp_endedatum.Text          = "";
            btn_add_semester.IsEnabled = false;
            validationControllerSemester.ResetValidAttributes(false);

            lv_semester.ItemsSource   = studiengang.SemesterListe;
            lv_semester.SelectedIndex = 0;
            lv_student.ItemsSource    = studiengang.StudentListe;
            lv_student.SelectedIndex  = 0;
        }