// Import events from flat-file (events.txt). private void ImportEventsFromFile() { try { StreamReader sr = new StreamReader("events.txt"); while (!sr.EndOfStream) { int id = Convert.ToInt16(sr.ReadLine()); string name = sr.ReadLine(); string description = sr.ReadLine(); string startDate = sr.ReadLine(); string organizerName = sr.ReadLine(); Event i = new Event(id, name, description, startDate, organizerName); this._upcomingEventsList.Add(i); } } catch (IOException e) { // Display error message. Console.WriteLine(e); } }
public void createEvent(int Id, string Name, string Description, string StartDate) { Event ev = new Event(Id, Name, Description, StartDate, this.userId); ev.saveToFile(); }