private Support CreateSupport(string name, string school, string city, string comment) { string name1 = name.Replace(" ", ""); string[] names = name1.Split(','); Support s = new Support(); s.dateNull = "NI"; s.streetNull = "NI"; s.city = city; s.stateNull = "NI"; s.postalCodeNull = "NI"; s.telecomNull = "NI"; s.firstName = names[1]; s.lastname = names[0]; s.comment = comment; s.schoolName = school; return s; }
private void ReadSupports(XmlTextReader textReader) { bool inSupports = true; while (inSupports) { textReader.Read(); switch (textReader.LocalName) { case "supports": inSupports = false; break; case "support": Support newSupport = new Support(); bool buildSupport = true; while (buildSupport) { textReader.Read(); switch (textReader.LocalName) { case "support": buildSupport = false; break; case "date": newSupport.dateNull = textReader.GetAttribute(0); break; case "streetAddressLine": newSupport.streetNull = textReader.GetAttribute(0); break; case "city": textReader.Read(); newSupport.city = textReader.Value.ToString(); textReader.Read(); break; case "state": newSupport.stateNull = textReader.GetAttribute(0); break; case "postalCode": newSupport.postalCodeNull = textReader.GetAttribute(0); break; case "contactTelecom": newSupport.telecomNull = textReader.GetAttribute(0); break; case "given": textReader.Read(); newSupport.firstName = textReader.Value.ToString(); textReader.Read(); break; case "family": textReader.Read(); newSupport.lastname = textReader.Value.ToString(); textReader.Read(); break; case "schoolName": textReader.Read(); newSupport.schoolName = textReader.Value.ToString(); textReader.Read(); break; case "comment": textReader.Read(); textReader.Read(); newSupport.comment = textReader.Value.ToString(); textReader.Read(); textReader.Read(); break; } } patientForm.patientData.Supports.Add(newSupport); break; } } }