private async Task FillAttendeesAsync() { var seminarAttendeesToAdd = new List <AddSeminarAttendeesListItemDto>(); try { var existingAttendees = await _queryDao.ListAsync <SeminarAttendeesListItemDto>($"SeminarId = '{_seminarId}'"); var where = existingAttendees.Count == 0 ? "" : $"Id NOT IN ({string.Join(",", existingAttendees.Select(x => $"'{x.Id}'"))})"; seminarAttendeesToAdd = await _queryDao.ListAsync <AddSeminarAttendeesListItemDto>(where) .OnError(_ => MessageBoxWrapper.Error("Can't fill seminar attendees")); } catch (Exception) { MessageBoxWrapper.Error("Can't fill seminar attendees"); } foreach (var attendee in seminarAttendeesToAdd ?? new List <AddSeminarAttendeesListItemDto>()) { Attendees.Items.Add(new ListViewItem(new[] { attendee.Id, attendee.FullName, attendee.BirthDate.ToString("MM/dd/yyyy") }) { Tag = attendee }); } }
private async void FillFormAsync() { var student = await _dao.GetAsync <StudentsDetailsDto>(_id) .OnError(_ => MessageBoxWrapper.Error("Can't get student")); PersonalIdValue.Text = student.Id; FullNameValue.Text = student.FullName; BirthDateValue.Text = student.BirthDate.ToString("MM/dd/yyyy"); ImageBox.Image = student.Image.ToBitmap(); FingerprintBox.Image = student.FingerprintImage.ToBitmap(); }
private async Task RefreshTableAsync() { var seminars = await _queryDao.ListAsync <SeminarsListItemDto>() .OnError(_ => MessageBoxWrapper.Error("Can't fill seminars Table")); seminarsListItemDtoBindingSource.DataSource = seminars; _selectedSeminarId = seminars.FirstOrDefault()?.Id; if (_selectedSeminarId != null) { SeminarAttendeesBtn.Enabled = true; } }
private async Task RefreshTableAsync() { RemoveSeminarAttendeeBtn.Enabled = false; var attendees = await _queryDao.ListAsync <SeminarAttendeesListItemDto>($"SeminarId='{_seminarId}'") .OnError(_ => MessageBoxWrapper.Error("Can't fill seminar attendees")); seminarAttendeesListItemDtoBindingSource.DataSource = attendees; _selectedAttendeeId = attendees.FirstOrDefault()?.Id; if (_selectedAttendeeId != null) { RemoveSeminarAttendeeBtn.Enabled = true; } }
private void RefreshTable() { try { var students = _queryDao.List <StudentsListItemDto>(); studentsListItemDtoBindingSource.DataSource = students; _selectedStudentId = students.FirstOrDefault()?.Id; if (_selectedStudentId != null) { StudentDetailsBtn.Enabled = true; } } catch (Exception) { MessageBoxWrapper.Error("Can't fill students"); } }
private async void OnStartSessionBtnClick(object sender, EventArgs e) { var confirmed = MessageBoxWrapper.Confirmation("Are you sure you want to start session?") == DialogResult.Yes; if (!confirmed) { return; } await _commandService.StartAsync(new StartSession { Id = _selectedSession.Id }).OnError(_ => MessageBoxWrapper.Error("Failed to start session")); var dashboardOpen = new SessionDashboardForm(_selectedSession.Id, _queryDao, _commandService, DependencyResolver.Resolve <IFingerprintVerifier>()); dashboardOpen.ShowDialog(); RefreshSeminars(); }
private async void OnOkClick(object sender, EventArgs e) { var attendeeToAdd = (AddSeminarAttendeesListItemDto)_selectedSeminarAttendee.Tag; var dialogResult = MessageBoxWrapper.Confirmation($"Are you sure you want to register attendee {attendeeToAdd.Id} in seminar"); if (dialogResult != DialogResult.Yes) { return; } await _commandService.RegisterAttendeeAsync(new RegisterAttendeeAtSeminar { Id = _seminarId, AttendeeId = attendeeToAdd.Id }) .OnSuccess(() => MessageBoxWrapper.Info("Attendee registered successfully")) .OnError(_ => MessageBoxWrapper.Error("Attendee registration failed")); Close(); }
private void RefreshSeminars() { try { var sessions = _queryDao.List <SessionsListItemDto>( $"LecturerId = '{_securityService.CurrentLecturerId}'") .OrderBy(x => x.StartTime) .ToList(); SessionsGrid.DataSource = sessions; _sessionsLookUp = sessions.ToDictionary(x => x.Id, x => x); if (sessions.Count > 0) { _selectedSession = sessions.First(); EnableOrDisableButtons(); } } catch (Exception) { MessageBoxWrapper.Error("Failed to fetch sessions"); } }