public void LoadMemberGroup() { EventAttendeesDao eventAttendeesDao = new EventAttendeesDao(); eventAttendeesDao.MakeConnection(Properties.Resources.strConnection); memberWindow.DefaulData = eventAttendeesDao.ReadData(memberWindow.Id, memberWindow.Search); List <dynamic> eventAttendeesShowList = new List <dynamic>(); int count = 1; foreach (EventAttendeesDto eventAttendeesDto in eventAttendeesDao.ReadData(memberWindow.Id, memberWindow.Search)) { eventAttendeesShowList.Add(new { NO = count, Name = eventAttendeesDto.Name, Email = eventAttendeesDto.Email, Other = eventAttendeesDto.Other }); count++; } memberWindow.ShowData = eventAttendeesShowList; }
public bool AddEvent() { if (addEventWindow.EventName.Length == 0) { addEventWindow.Status = "Event name is empty"; return(false); } if (addEventWindow.EventName.Length > 50) { addEventWindow.Status = "Event name have length lower than 50"; return(false); } EventDao eventDao = new EventDao(); eventDao.MakeConnection(Properties.Resources.strConnection); if (eventDao.Create(new EventDto(addEventWindow.EventName, addEventWindow.Desciption, "", ((App)Application.Current).UserName))) { List <CheckBox> groupShowList = (List <CheckBox>)addEventWindow.Group; int index = 0; foreach (CheckBox checkBox in groupShowList) { if ((bool)checkBox.IsChecked) { EventAttendeesDao eventAttendeesDao = new EventAttendeesDao(); List <GroupDto> groupDtos = (List <GroupDto>)addEventWindow.GroupData; eventAttendeesDao.MakeConnection(Properties.Resources.strConnection); List <EventAttendeesDto> eventAttendeesDtos = eventAttendeesDao.ReadData(groupDtos[index].Id, ""); foreach (EventAttendeesDto eventAttendeesDto in eventAttendeesDtos) { CheckInDao checkInDao = new CheckInDao(); checkInDao.MakeConnection(Properties.Resources.strConnection); CheckInDto checkInDto = new CheckInDto(); checkInDto.EventID = eventDao.GetLastId(); checkInDto.Name = eventAttendeesDto.Name; checkInDto.Email = eventAttendeesDto.Email; checkInDto.Other = eventAttendeesDto.Other; checkInDao.Create(checkInDto); } } index++; } } return(true); }