コード例 #1
0
        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
                });
            }
        }
コード例 #2
0
ファイル: StudentDetailsForm.cs プロジェクト: xleza/FAS
        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();
        }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
ファイル: SeminarAttendeesForm.cs プロジェクト: xleza/FAS
        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;
            }
        }
コード例 #5
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");
            }
        }
コード例 #6
0
ファイル: SessionsForm.cs プロジェクト: xleza/FAS
        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();
        }
コード例 #7
0
        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();
        }
コード例 #8
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");
            }
        }