private void FillSessions() { var activeSessions = _queryDao.List <SessionsListItemDto>($"LecturerId = '{_securityService.CurrentLecturerId}' AND Status != '{SessionStatus.Finished}'"); var activeSessionIds = string.Join(",", activeSessions.Select(x => $"'{x.SeminarId}'")); var where = $"LecturerId = '{_securityService.CurrentLecturerId}'"; if (!string.IsNullOrWhiteSpace(activeSessionIds)) { where += $" AND Id NOT IN ({activeSessionIds})"; } var sessionsToAdd = _queryDao.List <SessionsDropDownListItemDto>(where); Sessions.DataSource = sessionsToAdd; }
public StudentAttendanceReportForm(IQueryDao queryDao, SecurityService securityService) { _queryDao = queryDao; InitializeComponent(); SeminarsComboBox.DataSource = queryDao.List <SeminarsListItemDto>($"LecturerId = '{securityService.CurrentLecturerId}'"); }
private void RefreshTable() { var lecturers = _queryDao.List <LecturersListItemDto>(); lecturersListItemDtoBindingSource.DataSource = lecturers; _selectedStudentId = lecturers.FirstOrDefault()?.Id; if (_selectedStudentId != null) { LecturerDetailsBtn.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"); } }
public bool IsAuthorized() { var lecturers = _queryDao.List <ProfileListItemDto>(); var verificationForm = new VerificationForm( DependencyResolver.Resolve <IFingerprintVerifier>(), lecturers.Select(lecturer => lecturer.FingerprintChecksum).ToList()); var dialogResult = verificationForm.ShowDialog(); if (dialogResult != DialogResult.OK) { return(false); } var currentLecturer = lecturers.First(lecturer => lecturer.FingerprintChecksum == verificationForm.VerifiedChecksum); CurrentLecturerId = currentLecturer.Id; CurrentLecturerFullName = currentLecturer.FullName; return(true); }
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"); } }