/** * Creates an eventModel from a CsvRow list of strings. It is assumed that the CsvRow follows the following order: * Title * Date * Location * Summary * Description * Host * Tags * Google Maps Url, if no Url is attached it will place a null value in its place in the EventModel */ private EventModel parseEvent(CsvRow row) { // Converting the CsvRow list into more readable variable names string title = (row.Count > 0) ? row[0] : null; string dateStr = (row.Count > 1) ? row[1] : null; string location = (row.Count > 2) ? row[2] : null; string summary = (row.Count > 3) ? row[3] : null; string description = (row.Count > 4) ? row[4] : null; string company = (row.Count > 5) ? row[5] : null; string tagStr = (row.Count > 6) ? row[6] : null; string mapsUrl = (row.Count > 7) ? row[7] : null; // Creating the base event model to store the information EventModel e = new Models.EventModel(); // Populating the event model with the CSV information e.setName(title); e.setDescription(summary); e.setLocation(location); e.setHost(company); e.setGoogleMapsUrl(mapsUrl); DateTime date = new DateTime(); DateTime.TryParseExact(dateStr, DATE_PATTERN, null, System.Globalization.DateTimeStyles.None, out date); e.setDate(date); List <string> tags = new List <string>(); foreach (string s in tagStr.Split(',')) { tags.Add(s); } e.setTags(tags); return(e); }