Example #1
0
        private void ConvertDataToExcel()
        {
            Discipline[] disciplines = new EducationProcessContext().Disciplines.ToArray();

            ExcelEducationPlanWriter.ToExcelFile(disciplines, null);
            _dialogCoordinator.ShowMessageAsync(this, "Конвертация в таблицу", "Операция завершена успешо.");
        }
Example #2
0
        public GroupsScheduleViewModel(INavigationManager navigationManager)
        {
            _navigationManager = navigationManager;
            _dialogCoordinator = DialogCoordinator.Instance;
            _context           = new EducationProcessContext();

            Discipline[] disciplines = new EducationProcessContext().Disciplines.ToArray();
            int          maxCourse   = new EducationProcessContext().Groups.Max(x => x.CourseNumber);

            CourseGroups = new ObservableCollection <CourseGroups>();
            for (int i = 1; i <= maxCourse; i++)
            {
                CourseGroups.Add(new CourseGroups(new EducationProcessContext().Groups.Where(x => x.CourseNumber == i).ToArray(), i));
            }
            Weeks = new ObservableCollection <EducationWeek>();
            for (int i = -5; i < 2; i++)
            {
                Weeks.Add(new EducationWeek(DateTime.Now.AddDays(i * 7).StartOfWeek(DayOfWeek.Monday), "Неделя"));
            }
            List <DaySchedule> schedules = new List <DaySchedule>();

            SelectedWeek = Weeks[5];
            for (int i = 0; i < 5; i++)
            {
                string      weekday     = weekdays[i] + " - " + SelectedWeek.StartDay.AddDays(i).ToShortDateString();
                DaySchedule daySchedule = new DaySchedule(disciplines, weekday);
                schedules.Add(daySchedule);
            }

            WeekSchedule    = new ObservableCollection <DaySchedule>(schedules);
            PageBackCommand = new RelayCommand(null, _ => _navigationManager.Back());
            ShowDisciplinesStatisticCommand =
                new RelayCommand(null, _ => ShowDisciplinesStatisticWindow(SelectedGroup));
            SelectGroupCommand = new RelayCommand(null, o => SelectGroup((Group)o));
        }
Example #3
0
        public CourceScheduleViewModel(INavigationManager navigationManager)
        {
            _navigationManager = navigationManager;
            _context           = new EducationProcessContext();

            int maxCourse = new EducationProcessContext().Groups.Max(x => x.CourseNumber);

            CourseGroups  = new ObservableCollection <CourseGroups>();
            CourceNumbers = new ObservableCollection <int>();
            for (int i = 1; i <= maxCourse; i++)
            {
                CourseGroups.Add(new CourseGroups(new EducationProcessContext().Groups.Where(x => x.CourseNumber == i).ToArray(), i));
                CourceNumbers.Add(i);
            }

            List <GroupSchedule> groupSchedules = new List <GroupSchedule>();

            foreach (var group in new EducationProcessContext().Groups.ToArray())
            {
                List <DaySchedule> schedules = new List <DaySchedule>();
                for (int i = 0; i < 5; i++)
                {
                    string      weekday     = weekdays[i];
                    DaySchedule daySchedule = new DaySchedule(new Discipline[] {}, weekday);
                    schedules.Add(daySchedule);
                }
                groupSchedules.Add(new GroupSchedule(group, schedules.ToArray()));
            }

            GroupSchedules       = new ObservableCollection <GroupSchedule>(groupSchedules);
            EditScheduleCommand  = new RelayCommand(null, _ => _navigationManager.Next(new GroupsScheduleViewModel(_navigationManager)));
            SelectedCourceNumber = CourceNumbers.FirstOrDefault();
        }
Example #4
0
        private void DeleteSemesterDiscipline(EducationPlan educationPlan, SemesterDiscipline semesterDiscipline)
        {
            if (IsSelectedSemesterDiscipline(semesterDiscipline))
            {
                EducationProcessContext         context = new EducationProcessContext();
                EducationPlanSemesterDiscipline educationPlanSemesterDiscipline =
                    context.EducationPlanSemesterDisciplines
                    .First(x => x.EducationPlanId == educationPlan.EducationPlanId &&
                           x.SemesterDisciplineId == semesterDiscipline.SemesterDisciplineId);

                context.EducationPlanSemesterDisciplines.Remove(educationPlanSemesterDiscipline);

                EducationPlanSemesterDiscipline?otherEducationPlanSemesterDiscipline =
                    context.EducationPlanSemesterDisciplines
                    .FirstOrDefault(x => x.SemesterDisciplineId == semesterDiscipline.SemesterDisciplineId &&
                                    x.EducationPlanId != educationPlan.EducationPlanId);

                if (otherEducationPlanSemesterDiscipline == null)
                {
                    context.EducationPlans.Remove(educationPlan);
                }

                context.SaveChanges();
                RefreshSemesterDisciplines(educationPlan);
            }
        }
Example #5
0
        private int GetConfirmingLessonsCount(Employee employee, DateTime date)
        {
            ScheduleDisciplineReplacement[] replacements = new EducationProcessContext()
                                                           .ScheduleDisciplineReplacements
                                                           .Where(x => x.FixedDiscipline.EmployeeId == employee.EmployeeId &&
                                                                  x.Date == date.Date).ToArray();

            ScheduleDiscipline[] scheduleDisciplines = new EducationProcessContext()
                                                       .ScheduleDisciplines
                                                       .Where(x => x.FixedDiscipline.EmployeeId == employee.EmployeeId &&
                                                              x.Date == date.Date).ToArray();

            List <ConfirmingLesson> confirmingLessons = new List <ConfirmingLesson>();

            foreach (var replacement in replacements)
            {
                if (new EducationProcessContext().ConductedPairs.FirstOrDefault(x => x.ScheduleDisciplineReplacementId == replacement.ScheduleDisciplineReplacementId) == null)
                {
                    confirmingLessons.Add(new ConfirmingLesson(replacement.ScheduleDisciplineReplacementId, true));
                }
            }

            foreach (var scheduleDiscipline in scheduleDisciplines)
            {
                if (replacements.FirstOrDefault(x => x.ScheduleDisciplineId == scheduleDiscipline.ScheduleDisciplineId) == null &&
                    new EducationProcessContext().ConductedPairs.FirstOrDefault(x => x.ScheduleDisciplineId == scheduleDiscipline.ScheduleDisciplineId) == null)
                {
                    confirmingLessons.Add(new ConfirmingLesson(scheduleDiscipline.ScheduleDisciplineId, false));
                }
            }

            return(confirmingLessons.Count());
        }
Example #6
0
        public MainWindowViewModel(IDialogCoordinator dialogCoordinator)
        {
            this._dialogCoordinator = dialogCoordinator;
            //DisciplinesViewModel = new SemesterDisciplineViewModel();

            EducationalActivitiesViewModels = new EducationalActivitiesViewModel();

            CustomPrincipal customPrincipal = Thread.CurrentPrincipal as CustomPrincipal;

            if (customPrincipal == null)
            {
                throw new ArgumentException("The application's default thread principal must be set to a CustomPrincipal object on startup.");
            }
            int employeeId = customPrincipal.Identity.EmployeeId;

            Employee currentEmployee = new EducationProcessContext().Employees.FirstOrDefault(x => x.EmployeeId == employeeId);

            this.ShowInputDialogCommand = new RelayCommand(
                o => true,
                async x =>
            {
                await this._dialogCoordinator.ShowMessageAsync(this, "From a VM",
                                                               $"This dialog was shown from a VM, without knowledge of Window... And hello, {currentEmployee.Firstname} {currentEmployee.Lastname}");
            }
                );
            HelloUserMessage = $"Здравствуйте, {currentEmployee.Firstname} {currentEmployee.Lastname}";
            UserRole         = $"";
        }
Example #7
0
        private SuggestingDiscipline[] LoadSuggestingDisciplines()
        {
            var groupedFixedDisciplines = new EducationProcessContext()
                                          .FixedDisciplines
                                          .Include(x => x.Employee)
                                          .Include(x => x.SemesterDiscipline)
                                          .ThenInclude(x => x.Discipline)
                                          .Include(x => x.SemesterDiscipline)
                                          .ThenInclude(x => x.Semester)
                                          .Include(x => x.Group)
                                          .ToArray()
                                          .GroupBy(x =>
                                                   new
            {
                x.SemesterDiscipline.DisciplineId,
                x.GroupId,
                x.IsAgreed
            });

            List <SuggestingDiscipline> suggestingDisciplines = new List <SuggestingDiscipline>();

            foreach (var fixedDiscipline in groupedFixedDisciplines)
            {
                suggestingDisciplines.Add(new SuggestingDiscipline(fixedDiscipline.ToArray()));
            }

            return(suggestingDisciplines.ToArray());
        }
        public EducationPlansMenuViewModel(INavigationManager navigationManager)
        {
            _dialogCoordinator = DialogCoordinator.Instance;
            _navigationManager = navigationManager;

            EducationPlan[] educationPlans = new EducationProcessContext().EducationPlans
                                             .Include(x => x.Specialtie)
                                             .Include(x => x.AcademicYear)
                                             .ToArray();
            EducationPlans = new ObservableCollection <EducationPlan>(educationPlans);

            ViewEducationPlanCommand = new RelayCommand(null, _ =>
            {
                if (IsSelectedEducationPlan(SelectedEducationPlan))
                {
                    Navigate(new EducationPlanDisciplinesMenuViewModel(_navigationManager, SelectedEducationPlan));
                }
            });
            AddEducationPlanCommand           = new RelayCommand(null, _ => ShowEducationPlanEditor(null));
            EditEducationPlanCommand          = new RelayCommand(null, _ => EditEducationPlan(SelectedEducationPlan));
            DeleteEducationPlanCommand        = new RelayCommand(null, _ => DeleteEducationPlan(SelectedEducationPlan));
            AttachGroupToEducationPlanCommand = new RelayCommand(null, _ =>
            {
                if (IsSelectedEducationPlan(SelectedEducationPlan))
                {
                    Navigate(new EducationPlanGroupsMenuViewModel(_navigationManager, SelectedEducationPlan));
                }
            });
        }
Example #9
0
        private SuggestingDiscipline[] GetSuggestingDisciplines(int employeeId)
        {
            var disciplines = new EducationProcessContext().FixedDisciplines
                              .Where(x => x.IsAgreed == null && x.EmployeeId == employeeId)
                              .Include(x => x.Group)
                              .Include(x => x.SemesterDiscipline)
                              .ThenInclude(x => x.Discipline)
                              .Include(x => x.SemesterDiscipline.Semester)
                              .ToArray()
                              .GroupBy(x => new
            {
                x.SemesterDiscipline.DisciplineId,
                x.GroupId
            });

            List <SuggestingDiscipline> suggestingDisciplines = new List <SuggestingDiscipline>();

            foreach (var discipline in disciplines)
            {
                SuggestingDiscipline suggestingDiscipline =
                    new SuggestingDiscipline(discipline.ToArray());
                suggestingDisciplines.Add(suggestingDiscipline);
            }

            return(suggestingDisciplines.ToArray());
        }
        private void ConfirmLesson(ConfirmingLesson confirmingLesson)
        {
            EducationProcessContext context = new EducationProcessContext();
            ConductedPair           conductedPair;

            if (confirmingLesson.IsReplacement)
            {
                conductedPair = new ConductedPair()
                {
                    ScheduleDisciplineReplacementId = confirmingLesson.ScheduleDisciplineId, LessonTypeId = 1
                }
            }
            ;
            else
            {
                conductedPair = new ConductedPair()
                {
                    ScheduleDisciplineId = confirmingLesson.ScheduleDisciplineId, LessonTypeId = 1
                }
            };

            context.ConductedPairs.Add(conductedPair);
            context.SaveChanges();

            ConfirmingLessons = new ObservableCollection <ConfirmingLesson>(GetConfirmingLessons(_employee, _date));
        }
 public ConfirmingLesson(int scheduleDisciplineId, bool isReplacement)
 {
     ScheduleDisciplineId = scheduleDisciplineId;
     IsReplacement        = isReplacement;
     if (isReplacement)
     {
         ScheduleDisciplineReplacement replacement =
             new EducationProcessContext().ScheduleDisciplineReplacements
             .Include(x => x.FixedDiscipline)
             .ThenInclude(x => x.SemesterDiscipline)
             .ThenInclude(x => x.Discipline)
             .First(x => x.ScheduleDisciplineReplacementId == scheduleDisciplineId);
         PairNumber = replacement.PairNumber;
         Discipline = replacement.FixedDiscipline.SemesterDiscipline.Discipline.Name;
         Group      = new EducationProcessContext().Groups
                      .First(x => x.GroupId == replacement.FixedDiscipline.GroupId).Name;
     }
     else
     {
         ScheduleDiscipline discipline =
             new EducationProcessContext().ScheduleDisciplines
             .Include(x => x.FixedDiscipline)
             .ThenInclude(x => x.SemesterDiscipline)
             .ThenInclude(x => x.Discipline)
             .First(x => x.ScheduleDisciplineId == scheduleDisciplineId);
         PairNumber = discipline.PairNumber;
         Discipline = discipline.FixedDiscipline.SemesterDiscipline.Discipline.Name;
         Group      = new EducationProcessContext().Groups
                      .First(x => x.GroupId == discipline.FixedDiscipline.GroupId).Name;
     }
 }
        private void Save(Discipline discipline)
        {
            EducationProcessContext context = new EducationProcessContext();

            if (context.Disciplines.FirstOrDefault(x => x.DisciplineIndex.ToLower() == DisciplineIndex.ToLower()) != null)
            {
                _dialogCoordinator.ShowMessageAsync(this, "Внимание", "Данный индекс уже существует");
                return;
            }

            if (discipline == null)
            {
                Discipline newDiscipline = new Discipline()
                {
                    CathedraId       = SelectedCathedra.CathedraId,
                    DisciplineIndex  = DisciplineIndex,
                    Name             = DisciplineName,
                    EducationCycleId = SelectedCyclesAndModule.EducationCycleId
                };
                context.Disciplines.Add(newDiscipline);
                context.SaveChanges();
            }
            else
            {
                _discipline.Name             = DisciplineName;
                _discipline.DisciplineIndex  = DisciplineIndex;
                _discipline.CathedraId       = SelectedCathedra.CathedraId;
                _discipline.EducationCycleId = SelectedCyclesAndModule.EducationCycleId;
                context.Disciplines.Update(_discipline);
                context.SaveChanges();
            }

            _dialogCoordinator.ShowMessageAsync(this, "Дисциплина сохранена", null);
        }
 private void RefreshDisciplines()
 {
     Discipline[] disciplines = new EducationProcessContext()
                                .Disciplines
                                .Include(x => x.Cathedra)
                                .Include(x => x.EducationCycle)
                                .ToArray();
     Disciplines = new ObservableCollection <Discipline>(disciplines);
 }
 private void RefreshEducationPlans()
 {
     EducationPlan[] educationPlans = new EducationProcessContext()
                                      .EducationPlans
                                      .Include(x => x.Specialtie)
                                      .Include(x => x.AcademicYear)
                                      .ToArray();;
     EducationPlans = new ObservableCollection <EducationPlan>(educationPlans);
 }
Example #15
0
        public EFUnitOfWork(EducationProcessContext db)
        {
            this.db = db;

            groupRepository     = new Lazy <GroupRepository>(() => new GroupRepository(db));
            subjectRepository   = new Lazy <SubjectRepository>(() => new SubjectRepository(db));
            studentRepository   = new Lazy <StudentRepository>(() => new StudentRepository(db));
            educationRepository = new Lazy <EducationProcessRepository>(() => new EducationProcessRepository(db));
        }
        public AddGroupToEducationPlanViewModel(EducationPlan educationPlan)
        {
            _dialogCoordinator = DialogCoordinator.Instance;
            _educationPlan     = educationPlan;
            _context           = new EducationProcessContext();

            Groups            = new ObservableCollection <Group>(GetRelevantGroupsByEducationPlan(educationPlan));
            ChainGroupCommand = new RelayCommand(null, _ => ChainGroup(SelectedGroup));
            CancelCommand     = new RelayCommand(null, o => ((MetroWindow)o).Close());
        }
Example #17
0
        public AddDisciplineToTeacherViewModel()
        {
            _dialogCoordinator = DialogCoordinator.Instance;
            EducationProcessContext context = new EducationProcessContext();

            Groups = new ObservableCollection <Group>(context.Groups
                                                      .Where(x => x.EducationPlanId != null)
                                                      .Include(x => x.EducationPlan)
                                                      .ThenInclude(x => x.Specialtie).ToArray());

            SendSuggestionCommand = new RelayCommand(null, _ => SendSuggestion());
        }
Example #18
0
        public DisciplineStatisticInfo(FixedDiscipline fixedDiscipline)
        {
            _fixedDiscipline = fixedDiscipline;
            _context         = new EducationProcessContext();

            Discipline = _context.Disciplines
                         .First(x => x.DisciplineId == _fixedDiscipline.SemesterDiscipline.DisciplineId).Name;
            Employee employee = _context.Employees
                                .First(x => x.EmployeeId == _fixedDiscipline.EmployeeId);

            Teacher = $"{employee.Lastname} {employee.Firstname.First()}.{employee.Firstname.First()}.";
        }
Example #19
0
 private void RefreshSemesterDisciplines(EducationPlan educationPlan)
 {
     SemesterDiscipline[] semesterDisciplines = new EducationProcessContext()
                                                .EducationPlanSemesterDisciplines
                                                .Where(x => x.EducationPlanId == educationPlan.EducationPlanId)
                                                .Include(x => x.SemesterDiscipline)
                                                .ThenInclude(x => x.Discipline)
                                                .Include(x => x.SemesterDiscipline)
                                                .ThenInclude(x => x.Semester)
                                                .Select(x => x.SemesterDiscipline)
                                                .ToArray();
     SemesterDisciplines = new ObservableCollection <SemesterDiscipline>(semesterDisciplines);
 }
        public EducationPlanGroupsMenuViewModel(INavigationManager navigationManager, EducationPlan educationPlan)
        {
            _navigationManager = navigationManager;
            _educationPlan     = educationPlan;
            _dialogCoordinator = DialogCoordinator.Instance;
            _context           = new EducationProcessContext();

            PageBackCommand     = new RelayCommand(null, _ => _navigationManager.Back());
            ChainGroupCommand   = new RelayCommand(null, _ => ChainGroup());
            UnchainGroupCommand = new RelayCommand(null, _ => UnchainGroup(SelectedGroup));

            Group[] groups = GetGroupsByEducationPlanId(educationPlan.EducationPlanId);
            Groups = new ObservableCollection <Group>(groups);
        }
Example #21
0
        private void AddNewSemesterDiscipline(EducationPlan educationPlan, SemesterDiscipline semesterDiscipline)
        {
            EducationProcessContext context = new EducationProcessContext();

            context.SemesterDisciplines.Add(semesterDiscipline);
            context.SaveChanges();
            EducationPlanSemesterDiscipline educationPlanSemesterDiscipline = new EducationPlanSemesterDiscipline()
            {
                EducationPlanId      = educationPlan.EducationPlanId,
                SemesterDisciplineId = semesterDiscipline.SemesterDisciplineId
            };

            context.EducationPlanSemesterDisciplines.Add(educationPlanSemesterDiscipline);
            context.SaveChanges();
        }
Example #22
0
        public DisciplineStatisticViewModel(Group group, int semesterNumber)
        {
            _group = group;
            FixedDiscipline[] fixedDisciplines = new EducationProcessContext()
                                                 .FixedDisciplines
                                                 .Where(x => x.SemesterDiscipline.Semester.Number == semesterNumber && x.GroupId == group.GroupId)
                                                 .Include(x => x.SemesterDiscipline)
                                                 .ToArray();
            GroupFixedDisciplines = new ObservableCollection <DisciplineStatisticInfo>();
            foreach (var fixedDiscipline in fixedDisciplines)
            {
                GroupFixedDisciplines.Add(new DisciplineStatisticInfo(fixedDiscipline));
            }

            HeaderText = $"Сводка дисциплин группы: {group.Name}";
        }
Example #23
0
        public ConfirmLessonView()
        {
            InitializeComponent();

            CustomPrincipal customPrincipal = Thread.CurrentPrincipal as CustomPrincipal;

            if (customPrincipal == null)
            {
                throw new ArgumentException("The application's default thread principal must be set to a CustomPrincipal object on startup.");
            }
            int employeeId = customPrincipal.Identity.EmployeeId;

            Employee currentEmployee = new EducationProcessContext().Employees.FirstOrDefault(x => x.EmployeeId == employeeId);

            DataContext = new ConfirmLessonViewModel(currentEmployee, DateTime.Now);
        }
Example #24
0
        private void UpdateSemesterDiscipline(EducationPlan educationPlan, SemesterDiscipline semesterDiscipline)
        {
            EducationProcessContext context   = new EducationProcessContext();
            bool isChainedForOtherDisciplines =
                context.EducationPlanSemesterDisciplines.FirstOrDefault(x =>
                                                                        x.EducationPlanId != educationPlan.EducationPlanId &&
                                                                        x.SemesterDisciplineId == semesterDiscipline.SemesterDisciplineId) != null;

            if (isChainedForOtherDisciplines)
            {
                AddNewSemesterDiscipline(educationPlan, semesterDiscipline);
                return;
            }
            context.SemesterDisciplines.Update(semesterDiscipline);
            context.SaveChanges();
        }
Example #25
0
        public TeacherMainViewModel(IDialogCoordinator dialogCoordinator) : base(dialogCoordinator)
        {
            CustomPrincipal customPrincipal = Thread.CurrentPrincipal as CustomPrincipal;

            if (customPrincipal == null)
            {
                throw new ArgumentException("The application's default thread principal must be set to a CustomPrincipal object on startup.");
            }
            int employeeId = customPrincipal.Identity.EmployeeId;

            Employee currentEmployee = new EducationProcessContext().Employees.First(x => x.EmployeeId == employeeId);

            ConfirmingLessonsCount     = GetConfirmingLessonsCount(currentEmployee, DateTime.Now);
            SuggestionDisciplinesCount = new EducationProcessContext().FixedDisciplines
                                         .Count(x => x.EmployeeId == currentEmployee.EmployeeId && x.IsAgreed == null);
        }
        public DisciplineMenuViewModel()
        {
            _dialogCoordinator = DialogCoordinator.Instance;
            Discipline[] disciplines = new EducationProcessContext()
                                       .Disciplines
                                       .Include(x => x.Cathedra)
                                       .Include(x => x.EducationCycle)
                                       .ToArray();


            Disciplines = new ObservableCollection <Discipline>(disciplines);
            ViewDisciplineInfoCommand = new RelayCommand(null, o => ViewDisciplineInfo());
            AddDisciplineCommand      = new RelayCommand(null, _ => AddDiscipline());
            EditDisciplineCommand     = new RelayCommand(null, _ => EditDiscipline(SelectedDiscipline));
            DeleteDisciplineCommand   = new RelayCommand(null, _ => DeleteDiscipline(SelectedDiscipline));
        }
Example #27
0
        private void SaveEducationPlan(EducationPlan educationPlan)
        {
            if (SelectedAcademicYear == null)
            {
                _dialogCoordinator.ShowMessageAsync(this, null, "Выберите учебный год");
                return;
            }
            if (SelectedSpecialty == null)
            {
                _dialogCoordinator.ShowMessageAsync(this, null, "Выберите специальность");
                return;
            }

            if (string.IsNullOrWhiteSpace(EducationPlanName))
            {
                _dialogCoordinator.ShowMessageAsync(this, null, "Назовите учебный план");
                return;
            }

            EducationProcessContext context = new EducationProcessContext();

            if (educationPlan == null)
            {
                educationPlan = new EducationPlan()
                {
                    Name           = EducationPlanName,
                    AcademicYearId = SelectedAcademicYear.AcademicYearId,
                    SpecialtieId   = SelectedSpecialty.SpecialtieId
                };
                context.EducationPlans.Add(educationPlan);
            }
            else
            {
                educationPlan.Name           = EducationPlanName;
                educationPlan.AcademicYearId = SelectedAcademicYear.AcademicYearId;
                educationPlan.SpecialtieId   = SelectedSpecialty.SpecialtieId;
                context.EducationPlans.Update(educationPlan);
            }
            context.SaveChanges();

            if (SelectedEducationPlan != null)
            {
                CopySemesterDisciplines(educationPlan, SelectedEducationPlan);
            }

            _dialogCoordinator.ShowMessageAsync(this, "Сохранено", null);
        }
        public EducationalActivitiesViewModel()
        {
            _dialogCoordinator  = DialogCoordinator.Instance;
            _selectedViewModels = new List <BindableBase>(new[] { new EducationPlansMenuViewModel(this) });
            SelectedViewModel   = _selectedViewModels[0];

            SemesterDiscipline[] disciplines = new EducationProcessContext().SemesterDisciplines
                                               .Include(x => x.Discipline)
                                               .ToArray();
            List <SemesterDiscipline> semestreInfos = new List <SemesterDiscipline>();

            string[] academicYears = new string[] { "2020-2021", "2019-2020", "2018-2019" };

            SemesterDisciplines   = new ObservableCollection <SemesterDiscipline>(disciplines);
            AcademicYears         = new ObservableCollection <string>(academicYears);
            ConvertToExcelCommand = new RelayCommand(null, _ => ConvertDataToExcel());
        }
Example #29
0
        private async void DecineDiscipline(SuggestingDiscipline suggestingDiscipline)
        {
            MessageDialogResult mgs = await _dialogCoordinator.ShowMessageAsync(this, null,
                                                                                $"Вы уверены?", MessageDialogStyle.AffirmativeAndNegative);

            if (mgs == MessageDialogResult.Affirmative)
            {
                EducationProcessContext context = new EducationProcessContext();
                foreach (var fixedDiscipline in suggestingDiscipline.FixedDisciplines)
                {
                    fixedDiscipline.IsAgreed = false;
                    context.FixedDisciplines.Update(fixedDiscipline);
                }
                context.SaveChanges();
                await _dialogCoordinator.ShowMessageAsync(this, null, "Отменено");
            }
            SuggestingDisciplines =
                new ObservableCollection <SuggestingDiscipline>(GetSuggestingDisciplines(_employeeId));
        }
Example #30
0
        private void CopySemesterDisciplines(EducationPlan educationPlan, EducationPlan copyingEducationPlan)
        {
            EducationProcessContext context = new EducationProcessContext();

            EducationPlanSemesterDiscipline[] copyingSemesterDisciplines = context.EducationPlanSemesterDisciplines
                                                                           .Where(x => x.EducationPlanId == copyingEducationPlan.EducationPlanId)
                                                                           .AsNoTracking()
                                                                           .ToArray();
            foreach (var copyingSemesterDiscipline in copyingSemesterDisciplines)
            {
                EducationPlanSemesterDiscipline educationPlanSemesterDiscipline =
                    new EducationPlanSemesterDiscipline()
                {
                    EducationPlanId      = educationPlan.EducationPlanId,
                    SemesterDisciplineId = copyingSemesterDiscipline.SemesterDisciplineId
                };
                context.EducationPlanSemesterDisciplines.Add(educationPlanSemesterDiscipline);
            }
            context.SaveChanges();
        }