public static void FillPatients(EFDataRetriever retriever) { DataTable dt = iRadiate.Common.IO.TextFileReader.ReadCSVFile("Patients.csv", true); Console.WriteLine("Datatable created - " + dt.Rows.Count + " rows & " + dt.Columns.Count + " columns"); foreach (DataRow r in dt.Rows) { Patient p = new Patient(); p.Surname = r["Surname"].ToString(); p.GivenNames = r["GivenNames"].ToString(); p.StreetNumber = new Random().Next(100).ToString(); p.StreetName = r["StreetName"].ToString(); p.TownName = r["Town"].ToString(); p.MRN = r["MRN"].ToString(); p.Title = r["Title"].ToString(); p.HomePhone = r["HomePhone"].ToString(); p.MobilePhone = r["MobilePhone"].ToString(); if (r["Sex"].ToString() == "Male") { p.Gender = Gender.Male; } else { p.Gender = Gender.Female; } string[] dates = r["DateOfBirth"].ToString().Split('/'); p.DateOfBirth = new DateTime(Convert.ToInt16(dates[2]), Convert.ToInt16(dates[1]), Convert.ToInt16(dates[0])); retriever.SaveItem(p); DumpDataStoreItem(p); } }
public static void FillElements(EFDataRetriever retriever) { DataTable dt = iRadiate.Common.IO.TextFileReader.ReadCSVFile("Elements.csv", true); Console.WriteLine("Datatable created - " + dt.Rows.Count + " rows & " + dt.Columns.Count + " columns"); foreach (DataRow r in dt.Rows) { Element el = new Element(); el.AtomicNumber = Convert.ToInt16(r["Number"].ToString()); el.Symbol = r["Sym."].ToString(); el.Name = r["Name"].ToString(); retriever.SaveItem(el); DumpDataStoreItem(el); } }
private static void AddFirstUser() { User u = new User(); u.Surname = "Forwood"; u.GivenNames = "Nicholas"; u.LoginName = "nf"; u.Password = "******"; u.PinNumber = "1234"; u.Title = "Mr"; retriever.SaveItem(u); }