コード例 #1
0
        private void Showteacher_Click(object sender, RoutedEventArgs e)
        {
            List <Teacher> Teachers = new List <Teacher>()
            {
                new Teacher()
                {
                    Id      = Guid.NewGuid(),
                    Name    = "Anar",
                    Surname = "Ehmedov",
                    Age     = 20
                },
                new Teacher()
                {
                    Id      = Guid.NewGuid(),
                    Name    = "Anar",
                    Surname = "Ehmedov",
                    Age     = 20
                },
                new Teacher()
                {
                    Id      = Guid.NewGuid(),
                    Name    = "Anar",
                    Surname = "Ehmedov",
                    Age     = 20
                },
            };
            TeacherViewModel teacherViewModel = new TeacherViewModel();

            teacherViewModel.AllTeacher = Teachers;
            TeacherWindow teacherWindow = new TeacherWindow(teacherViewModel);

            teacherWindow.ShowDialog();
        }
コード例 #2
0
        public TeacherWindowViewModel(TeacherWindow teacherWindow, Teacher ContextTeacher)
        {
            this.SourceWindow   = teacherWindow;
            this.ContextTeacher = ContextTeacher;

            this.SemesterCreateCommand = new RelayCommand(CreateSemester);
            this.SemesterEditCommand   = new RelayCommand(EditSemester, CanEditOrDeleteSelectedItem);
            this.SemesterDeleteCommand = new RelayCommand(DeleteSemester, CanEditOrDeleteSelectedItem);

            this.TeacherCreateCommand = new RelayCommand(CreateTeacher);
            this.TeacherEditCommand   = new RelayCommand(EditTeacher, CanEditOrDeleteSelectedItem);
            this.TeacherDeleteCommand = new RelayCommand(DeleteTeacher, CanEditOrDeleteSelectedItem);

            this.SessionGroupCreateCommand = new RelayCommand(CreateSessionGroup);
            this.SessionGroupEditCommand   = new RelayCommand(EditSessionGroup, CanEditOrDeleteSelectedItem);
            this.SessionGroupDeleteCommand = new RelayCommand(DeleteSessionGroup, CanEditOrDeleteSelectedItem);

            this.TeamCreateCommand = new RelayCommand(CreateTeam);
            this.TeamEditCommand   = new RelayCommand(EditTeam, CanEditOrDeleteSelectedItem);
            this.TeamDeleteCommand = new RelayCommand(DeleteTeam, CanEditOrDeleteSelectedItem);

            this.StudentCreateCommand = new RelayCommand(CreateStudent);
            this.StudentEditCommand   = new RelayCommand(EditStudent, CanEditOrDeleteSelectedItem);
            this.StudentDeleteCommand = new RelayCommand(DeleteStudent, CanEditOrDeleteSelectedItem);

            this.DictionaryCreateCommand = new RelayCommand(CreateDictionary);
            this.DictionaryEditCommand   = new RelayCommand(EditDictionary, CanEditOrDeleteSelectedItem);
            this.DictionaryDeleteCommand = new RelayCommand(DeleteDictionary, CanDeleteDictionary);

            this.DictionaryTypeCreateCommand = new RelayCommand(CreateDictionaryType);
            this.DictionaryTypeEditCommand   = new RelayCommand(EditDictionaryType, CanEditOrDeleteSelectedItem);
            this.DictionaryTypeDeleteCommand = new RelayCommand(DeleteDictionaryType, CanEditOrDeleteSelectedItem);

            this.CopySemesterCommand    = new RelayCommand(CopySelectedSemester, CanCopySemester);
            this.DeleteFilter           = new RelayCommand(DeleteSelectedFilter);
            this.DownloadImportTemplate = new RelayCommand(DownloadTemplate);
            this.ImportStudents         = new RelayCommand(ImportStudentsFromFile);

            this.ShowServiceStore = new RelayCommand(SwitchToServiceStoreWindow, canSwitch);
            this._contextDal      = new TeacherDAL();

            this.SemesterList       = ReloadSemesterList();
            this.TeacherList        = new ObservableCollection <Teacher>(_contextDal.FindAll());
            this.SessionGroupList   = ReloadActiveSessionGroupList();
            this.TeamList           = ReloadActiveTeamList();
            this.StudentList        = ReloadStudentList();
            this.DictionaryList     = ReloadDictionaryList();
            this.DictionaryTypeList = ReloadDictionaryTypeList();
            this.TeamFilterList     = ReloadTeamFilterList();

            this.MySessionGroups = new ObservableCollection <SessionGroup>(ReloadActiveSessionGroupList().Where(x => x.TeacherID == ContextTeacher.ID));

            this.LogoutCommand        = new RelayCommand(Logout);
            this.TeacherFilter        = _contextDal.FindById(ContextTeacher.ID);
            this.DictionaryTypeFilter = DictionaryTypeList[0];
        }
コード例 #3
0
ファイル: AdminPage.xaml.cs プロジェクト: Immaran/Dziennik
        private void ClickAdd(object sender, RoutedEventArgs e)
        {
            TeacherWindow teacherWindow = new TeacherWindow
            {
                Owner = ((MainWindow)Application.Current.MainWindow)
            };

            if (true == teacherWindow.ShowDialog())
            {
                this.fetchData();
            }
        }
コード例 #4
0
ファイル: AdminPage.xaml.cs プロジェクト: Immaran/Dziennik
 private void ClickEdit(object sender, RoutedEventArgs e)
 {
     if (TeacherListBox.SelectedItem != null)
     {
         TeacherWindow teacherWindow = new TeacherWindow((Models.Teacher)TeacherListBox.SelectedItem)
         {
             Owner = ((MainWindow)Application.Current.MainWindow)
         };
         if (true == teacherWindow.ShowDialog())
         {
             this.fetchData();
         }
     }
 }