示例#1
0
        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;
        }
示例#2
0
        public StudentAttendanceReportForm(IQueryDao queryDao, SecurityService securityService)
        {
            _queryDao = queryDao;
            InitializeComponent();

            SeminarsComboBox.DataSource = queryDao.List <SeminarsListItemDto>($"LecturerId = '{securityService.CurrentLecturerId}'");
        }
示例#3
0
        private void RefreshTable()
        {
            var lecturers = _queryDao.List <LecturersListItemDto>();

            lecturersListItemDtoBindingSource.DataSource = lecturers;

            _selectedStudentId = lecturers.FirstOrDefault()?.Id;
            if (_selectedStudentId != null)
            {
                LecturerDetailsBtn.Enabled = true;
            }
        }
示例#4
0
        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");
            }
        }
示例#5
0
        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);
        }
示例#6
0
文件: SessionsForm.cs 项目: xleza/FAS
        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");
            }
        }