private DataTable GetEventResults(long eventId) { DataTable results = new DataTable(); using (EventRegistrationManager erManager = new EventRegistrationManager()) { List <EventRegistration> eventRegistrations = erManager.GetAllRegistrationsByEvent(eventId); if (eventRegistrations.Count != 0) { XmlNodeReader xmlNodeReader = new XmlNodeReader(eventRegistrations[0].Data); results = CreateDataTableColums(results, XElement.Load(xmlNodeReader)); xmlNodeReader.Dispose(); } foreach (EventRegistration er in eventRegistrations) { XmlNodeReader xmlNodeReader = new XmlNodeReader(er.Data); results.Rows.Add(AddDataRow(XElement.Load(xmlNodeReader), results)); xmlNodeReader.Dispose(); } } return(results); }
public EventRegistrationModel(Event e) { Event = new EventModel(e); EditAllowed = e.EditAllowed; using (EventRegistrationManager erManger = new EventRegistrationManager()) { NumberOfRegistration = erManger.GetAllRegistrationsByEvent(e.Id).Count(); } }