//public ObservableCollection<DozentNames> DozentList { get; private set; } #endregion #region Ctor // Initializes a new instance of the AddStudentViewModel class. public AddPraktikaViewModel(IFirmenDB firmenDB, IDozentDB dozentDB) { try { _firmenDB = firmenDB; _dozentDB = dozentDB; NewPraktika = new Praktika(); NewPraktika.Antrag = DateTime.Today; NewPraktika.Genehmigung = DateTime.Today; NewPraktika.Beginn = DateTime.Today; NewPraktika.Ende = DateTime.Today; FirmaList = _firmenDB.GetAllFirmen(); DozentList = _dozentDB.GetAllDozents(); AddCommand = new RelayCommand(AddPraktika, CanAddStudent); CancelCommand = new RelayCommand(Cancel); } catch (Exception e) { throw e; } }
// Initializes a new instance of the DozentViewModel class. public DozentViewModel(IDozentDB dozentDB, IDialogService dialogservice) { try { _dozentDB = dozentDB; _dialogservice = dialogservice; CurrentDozent = new Dozent(); // Get list of all Dozents from dozents table DozentList = new ObservableCollection <Dozent>(); DozentList = _dozentDB.GetAllDozents(); //Open new window to add new dozent ShowAddDozentCommand = new RelayCommand(ShowAddDozentViewExecute); SaveDozentCommand = new RelayCommand(SaveDozentExecute, CanSaveDozent); CancelDozentCommand = new RelayCommand(CancelDozentExecute); DeleteDozentCommand = new RelayCommand(DeleteDozentExecute, CanDeleteDozent); RefreshCommand = new RelayCommand(RefreshExecute); SelectedDozent = DozentList[0]; CurrentDozent.IsOkChanged += OnTempSelectedDozentPropertyChanged; } catch (Exception e) { MessageBox.Show(e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
// Initializes a new instance of the Studentviewmodel class. public StudentViewModel(IStudentDB studentDB, IPraktikaDB praktikaDB, IFirmenDB firmenDB, IDozentDB dozentDB, IDialogService dialogservice) { try { _studentDB = studentDB; _praktikaDB = praktikaDB; _firmenDB = firmenDB; _dozentDB = dozentDB; _dialogservice = dialogservice; //Student Commands RefreshCommand = new RelayCommand(RefreshExecute); NewStudentCommand = new RelayCommand(NewStudentExecute); SaveStudentCommand = new RelayCommand(SaveStudentExecute, CanSaveStudent); CancelStudentCommand = new RelayCommand(CancelStudentExecute); DeleteStudentCommand = new RelayCommand(DeleteStudentExecute, CanDeleteStudent); PrintReportCommand = new RelayCommand(PrintReportExecute, CanPrintReportExecute); //Praktika Commands NewPraktikaCommand = new RelayCommand(NewPraktikaExecute, CanNewPraktikaExecute); NextCommand = new RelayCommand(NextExecute, CanNextExecute); PreviousCommand = new RelayCommand(PreviousExecute, CanPreviousExecute); SavePraktikaCommand = new RelayCommand(SavePraktikaExecute); CancelPraktikaCommand = new RelayCommand(CancelPraktikaExecute); StudentList = new ObservableCollection <Student>(); StudentList = _studentDB.GetAllStudents(); FirmaList = new ObservableCollection <Firmen>(); FirmaList = _firmenDB.GetAllFirmen(); DozentList = new ObservableCollection <Dozent>(); DozentList = _dozentDB.GetAllDozents(); SelectedStudent = StudentList[0]; TempSelectedStudent.IsOkChanged += OnTempSelectedStudentPropertyChanged; StudiengangItems = new ObservableCollection <string> { "BA BWL Präsenz", "BA W-Informatik Präsenz", "BA BWL online", "BA BWL TZ online", "BA W-Informatik online", "MA BWL non-konsekutiv" }; } catch (Exception e) { throw e; } }
// Initializes a new instance of the StudentsOfDozentViewModel class. public StudentsOfDozentViewModel(IDozentDB dozentDB, IPraktikaDB praktikaDB) { try { _dozentDB = dozentDB; _praktikaDB = praktikaDB; DozentList = new ObservableCollection <Dozent>(); DozentList = _dozentDB.GetAllDozents(); SearchCommand = new RelayCommand(SearchExecute, CanSearchExecute); } catch (Exception e) { MessageBox.Show(e.InnerException.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }