示例#1
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());
        }
示例#2
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));
        }