Ejemplo n.º 1
0
        private async void OnRemoveSpecialty()
        {
            var specialityStudents = await _sRepo.GetFilteredStudentsAsync(st =>
                                                                           st.SpecialityId == SelectedSpeciality.SpecialtyId);

            if (specialityStudents.Count > 0)
            {
                var result = MessageBox.Show(
                    "Вы точно хотите удалить специальность вместе с прикреплёнными студентами?",
                    "К этой специальности прикреплены студенты.",
                    MessageBoxButton.YesNo);

                switch (result)
                {
                case MessageBoxResult.Yes:
                    break;

                case MessageBoxResult.No:
                    return;

                default:
                    return;
                }
            }

            await _repo.DeleteSpecialtyWithStudentsAsync(SelectedSpeciality.SpecialtyId);

            var specialty = Specialities.FirstOrDefault(s => s.SpecialtyId == SelectedSpeciality.SpecialtyId);

            if (specialty != null)
            {
                Specialities.Remove(specialty);
            }
        }
Ejemplo n.º 2
0
        private async void OnUpdateSpecialty()
        {
            SelectedSpeciality.Faculty = Faculties.FirstOrDefault(f => f.FacultyId == SelectedSpeciality.FacultyId);

            var result = await _repo.UpdateSpecialtyAsync(SelectedSpeciality);

            var specialty = Specialities.FirstOrDefault(s => s.SpecialtyId == SelectedSpeciality.SpecialtyId);

            specialty.CopyProperties(SelectedSpeciality);
        }
Ejemplo n.º 3
0
        private async void OnUpdateStudent()
        {
            SelectedStudent.Specialty = Specialities.FirstOrDefault(s => s.SpecialtyId == SelectedStudent.SpecialityId);

            var result = await _repo.UpdateStudentAsync(SelectedStudent);

            var student = Students.FirstOrDefault(s => s.StudentId == SelectedStudent.StudentId);

            student.CopyProperties(SelectedStudent);
        }
Ejemplo n.º 4
0
        public AspirantSelectLists(Aspirant aspirant, AspiranturaContext context)
        {
            Statuses     = Helper.GetStatuses();
            Studyforms   = Helper.GetStudyForms();
            Specialities = Helper.GetSpecialities(context);
            Departments  = Helper.GetDepartments(context);
            Prepods      = Helper.GetPrepods(context);

            if (aspirant != null)
            {
                selectedStatus     = Statuses.FirstOrDefault(k => k.Value == (int)aspirant.StatusType);
                selectedStudyform  = Studyforms.FirstOrDefault(k => k.Value == (int)aspirant.StudyForm);
                selectedSpeciality = Specialities.FirstOrDefault(k => k.Value == aspirant.SpecialityId);  // возможно нужна проверка на null
                selectedDepartment = Departments.FirstOrDefault(k => k.Value == aspirant.DepartmentId);
                selectedPrepod     = Prepods.FirstOrDefault(k => k.Value == aspirant.PrepodId);
            }
        }