public void ReadTeamsAndSchools( ) { Schools.Clear( ); Teams.Clear( ); Athletes.Clear( ); doc.Load(FilePath); foreach (XmlElement teams in doc.SelectSingleNode("EntryForm").SelectSingleNode("Teams").ChildNodes) { IIdentityStorage t = new IIdentityStorage(); t.ShortName = teams.InnerText; t.item = FileIO.FConnFile.GetFileDetails( ).IO.GetAll <DM.Team> ( ).Where(te => te.ShortName.Trim( ) == t.ShortName.Trim( )).FirstOrDefault( ); t.processor = this; Teams.Add(t); } foreach (XmlElement school in doc.SelectSingleNode("EntryForm").SelectSingleNode("Schools").ChildNodes) { IIdentityStorage t = new IIdentityStorage(); t.ShortName = school.InnerText; t.item = FileIO.FConnFile.GetFileDetails( ).IO.GetAll <DM.School> ( ).Where(te => te.ShortName.Trim() == t.ShortName.Trim()).FirstOrDefault( ); t.isSchool = true; t.processor = this; Schools.Add(t); } foreach (XmlElement athlete in doc.SelectSingleNode("EntryForm").SelectSingleNode("Entries").ChildNodes) { try { AthleteStorage a = new AthleteStorage(); a.Name = athlete.Attributes["Name"].Value.ToString( ).Replace(" ", " "); a.DateOfBirth = DateTime.Parse(athlete.Attributes["DateOfBirth"].Value); a.School = FileIO.FConnFile.GetFileDetails( ).IO.GetAll <DM.School> ( ).Where(te => te.ShortName.Trim( ) == athlete.Attributes["SchoolCode"].Value.Trim( )).FirstOrDefault( ); a.Team = FileIO.FConnFile.GetFileDetails( ).IO.GetAll <DM.Team> ( ).Where(te => te.ShortName.Trim( ) == athlete.Attributes["TeamCode"].Value.Trim( )).FirstOrDefault( ); if (athlete.Attributes["GlobalID"].Value != "") { a.GlobalID = int.Parse(athlete.Attributes["GlobalID"].Value); } if (athlete.Attributes["CategoryCode"].Value.Contains("B")) { a.Gender = DM.Gender.Male; } else { a.Gender = DM.Gender.Female; } a.EventCodes = new List <string> ( ); if (athlete.SelectSingleNode("Events").HasChildNodes) { foreach (XmlElement ev in athlete.SelectSingleNode("Events").ChildNodes) { a.EventCodes.Add(ev.Attributes["EventCode"].Value); } } Athletes.Add(a); Console.WriteLine("Athlete Read: " + a.Name); } catch (Exception ex) { MessageBox.Show("Failed to read " + athlete.Attributes["Name"].Value.ToString( ) + "\n" + ex.Message); continue; } } Wizard.changeHappend( ); }