public ExamsView() { InitializeComponent(); ViewModel = new ExamsViewModel(); DataContext = ViewModel; }
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { base.OnNavigatingFrom(e); Window.Current.SizeChanged -= CurrentWindow_SizeChanged; StudentInfoViewModel.Dispose(); WellknownDataViewModel.Dispose(); ExamsViewModel.Dispose(); ScheduleViewModel.Dispose(); }
public Exams( IExamService examService, ICourseService courseService, IEnrolmentService enrolmentService, IStudentExamService studentExamService, ISemesterService semesterService, IExportService exportService, IDownloadFileService downloadFileService) { viewModel = new ExamsViewModel(examService, courseService, enrolmentService, studentExamService, semesterService, exportService, downloadFileService); InitializeComponent(); this.Loaded += ExamsTable_Load; }
public async Task <IActionResult> Index(int value, [Bind("SelectedCity")] ExamsViewModel viewModel) { var exams = await _repository.Query <Exam>() .Include(exam => exam.City) .ToListAsync(); List <ExamViewModel> examViewModels = new List <ExamViewModel>(); exams.ForEach(x => examViewModels.Add(ExamMappings.ToViewModel(x))); examViewModels = examViewModels.OrderByDescending(x => x.Date).ToList(); List <string> AcceptancePeriod = await CalculateAcceptancePeriods(examViewModels); var AcceptancePeriods = new List <SelectListItem>(); foreach (var ap in AcceptancePeriod) { AcceptancePeriods.Add(new SelectListItem { Value = AcceptancePeriod.FindIndex(a => a == ap).ToString(), Text = ap }); } viewModel.AcceptancePeriod = AcceptancePeriods; viewModel.ExamViewModels = examViewModels.Where(x => x.SetAcceptancePeriod == AcceptancePeriods.ElementAt(value).Text).ToList(); var SelectedAcceptancePeriod = AcceptancePeriods.ElementAt(value); viewModel.SelectedAcceptancePeriod = SelectedAcceptancePeriod.Text; TempData["SelectedAcceptancePeriod"] = SelectedAcceptancePeriod.Value; var selectedExams = examViewModels.Where(x => x.SetAcceptancePeriod == SelectedAcceptancePeriod.Text).ToList(); var results = await _repository.Query <Result>().ToListAsync(); int studentsCountInAcceptancePeriod = 0; foreach (var selectedExam in selectedExams) { int examId = exams.FirstOrDefault(x => x.Date == selectedExam.Date).Id; studentsCountInAcceptancePeriod += results.Count(x => x.ExamId == examId); } TempData["Count"] = studentsCountInAcceptancePeriod; _logger.LogInformation("Found {Count} records. User {User}.", viewModel.ExamViewModels.Count(), _user); return(View(viewModel)); }
public override void Execute(object parameter) { ExamsViewModel examsViewModel = new ExamsViewModel(); List <ExamModel> examModels = DataProvider.GetExams(); EnumerationUtil.Enumerate(examModels); examsViewModel.AllExams = examModels; examsViewModel.Exams = new ObservableCollection <ExamModel>(examModels); examsViewModel.CurrentExam = new ExamModel(); ExamsControl examsControl = new ExamsControl(); examsControl.DataContext = examsViewModel; MainWindow mainWindow = (MainWindow)mainViewModel.Window; mainWindow.GrdCenter.Children.Clear(); mainWindow.GrdCenter.Children.Add(examsControl); }
public BaseExamCommand(ExamsViewModel viewModel) { this.viewModel = viewModel; }
public SaveExamCommand(ExamsViewModel viewModel) : base(viewModel) { }
public RejectExamCommand(ExamsViewModel viewModel) : base(viewModel) { }
public ExcelExporterExamCommand(ExamsViewModel viewModel) : base(viewModel) { }
public DeleteExamCommand(ExamsViewModel viewModel) : base(viewModel) { }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); Analytics.TrackEvent("Main page reached", new Dictionary <string, string>() { { "Size", $"{Window.Current.Bounds}" } }); prevWidth = Window.Current.Bounds.Width; Window.Current.SizeChanged += CurrentWindow_SizeChanged; if (e.Parameter is string argument && !string.IsNullOrEmpty(argument)) { Analytics.TrackEvent("Launched with parameter", new Dictionary <string, string>() { { "Parameter", argument } }); if (argument.Equals("ScoreChanged", StringComparison.Ordinal)) { NavigationView.SelectedItem = NavigationView.MenuItems.Last(); } } bool signedIn = Application.Current.GetService <ICredentialService>().IsSignedIn; IAsyncOperation <PushNotificationChannel> channelCreationTask = PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync(); Task wellknownUpdateTask = WellknownDataViewModel.StartUpdateAsync(signedIn); Task studentInfoUpdateTask = StudentInfoViewModel.StartUpdateAsync(signedIn); await wellknownUpdateTask; Task examsUpdateTask = ExamsViewModel.StartUpdateAsync(signedIn); Task scheduleUpdateTask = ScheduleViewModel.StartUpdateAsync(signedIn); if (!signedIn) { ISignInService signInService = Application.Current.GetService <ISignInService>(); try { await signInService.SignInAsync(false); signedIn = true; Application.Current.GetService <IMessageService <SignInMessage> >().SendMessage(new SignInMessage(true)); } catch (BackendAuthenticationFailedException ex) { Crashes.TrackError(ex); Analytics.TrackEvent("Authentication failed"); await((App)Application.Current).SignOutAsync(); } catch (BackendRequestFailedException ex) { Crashes.TrackError(ex); Application.Current.GetService <IMessageService <SignInMessage> >().SendMessage(new SignInMessage(false)); } } if (signedIn) { INotificationChannelService channelService = Application.Current.GetService <INotificationChannelService>(); Task channelUpdateTask; try { PushNotificationChannel channel = await channelCreationTask; channelUpdateTask = channelService.PostNotificationChannelAsync(new NotificationChannelItem(channel.Uri)); } catch (Exception ex) { Crashes.TrackError(ex); channelUpdateTask = Task.CompletedTask; } await Task.WhenAll(studentInfoUpdateTask, examsUpdateTask, scheduleUpdateTask, channelUpdateTask); } else { await Task.WhenAll(studentInfoUpdateTask, examsUpdateTask, scheduleUpdateTask); } }