Exemplo n.º 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
                });
            }
        }
Exemplo n.º 2
0
        private async void OnRefreshReportBtnClick(object sender, EventArgs e)
        {
            if (SeminarsComboBox.SelectedItem == null)
            {
                return;
            }

            var reportData = await _queryDao.ListAsync <StudentsAttendanceReportDto>($"SeminarId = '{(SeminarsComboBox.SelectedItem as SeminarsListItemDto)?.Id}'");

            studentsAttendanceReportDtoBindingSource.DataSource = reportData;
            ReportViewer.RefreshReport();
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 4
0
        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;
            }
        }