public void LoadMemberEvent() { CheckInDao checkInDao = new CheckInDao(); checkInDao.MakeConnection(Properties.Resources.strConnection); memberWindow.DefaulData = checkInDao.ReadData(memberWindow.Id, memberWindow.Search); List <dynamic> checkInShowList = new List <dynamic>(); int count = 1; foreach (CheckInDto checkInDto in checkInDao.ReadData(memberWindow.Id, memberWindow.Search)) { checkInShowList.Add(new { NO = count, Name = checkInDto.Name, Email = checkInDto.Email, Other = checkInDto.Other }); count++; } memberWindow.ShowData = checkInShowList; }
public void ExportReportToExcel() { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Excel file (*.xlsx)|*.xlsx"; if ((bool)saveFileDialog.ShowDialog()) { try { ExcelConnection.ExcelConnect excelConnect = new ExcelConnection.ExcelConnect(); CheckInDao checkInDao = new CheckInDao(); checkInDao.MakeConnection(Properties.Resources.strConnection); List <EventDto> events = (List <EventDto>)mainWindow.OldEventData; List <CheckInDto> checkInDtos = checkInDao.ReadData(events[mainWindow.SelectIndexOldEvent].Id, ""); List <EventAttendeesDtoToExportReport> eventAttendeesDtoToExportReports = new List <EventAttendeesDtoToExportReport>(); foreach (CheckInDto checkInDto in checkInDtos) { EventAttendeesDtoToExportReport eventAttendeesDtoToExportReport = new EventAttendeesDtoToExportReport(); eventAttendeesDtoToExportReport.Name = checkInDto.Name; eventAttendeesDtoToExportReport.Email = checkInDto.Email; eventAttendeesDtoToExportReport.Other = checkInDto.Other; eventAttendeesDtoToExportReport.IsChecked = checkInDto.Check; eventAttendeesDtoToExportReports.Add(eventAttendeesDtoToExportReport); } excelConnect.ExportExcel(eventAttendeesDtoToExportReports, saveFileDialog.FileName); } catch (Exception e) { } } }
public void LoadMemberEvent() { CheckInDao checkInDao = new CheckInDao(); checkInDao.MakeConnection(Properties.Resources.strConnection); checkInWindow.MemberInEventData = checkInDao.ReadData(checkInWindow.EventID, ""); List <CheckBox> checkInShowList = new List <CheckBox>(); int count = 1; foreach (CheckInDto checkInDto in checkInDao.ReadData(checkInWindow.EventID, "")) { CheckBox checkBox = new CheckBox(); checkBox.Content = checkInDto.Name + " | " + checkInDto.Email; checkBox.IsChecked = checkInDto.Check; checkInShowList.Add(checkBox); count++; } checkInWindow.MemberInEventShow = checkInShowList; }