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); } }
static void Main(string[] args) { DateTime appStartTime = DateTime.Now; Console.WriteLine("Program commenced @ " + appStartTime.ToShortTimeString()); StandardDataLibrarian lib = new StandardDataLibrarian(); Console.WriteLine("Libarian instantiated"); printRetriever(); //List<RetrievalCriteria> rc = new List<RetrievalCriteria>(); //RetrievalCriteria first = new RetrievalCriteria("CreationDate", CriteraType.GreaterThan, DateTime.Today.Date); //rc.Add(first); //RetrievalCriteria second = new RetrievalCriteria("CreationDate", CriteraType.LessThan, DateTime.Today.AddDays(1)); //rc.Add(second); //var result = Platform.Retriever.RetrieveItems(typeof(Appointment), rc); var result = (lib as IDataLibrarian).GetAppointments(DateTime.Today); printRetriever(); EFDataRetriever r = (EFDataRetriever)Platform.Retriever; r.printAllUnmodified(); #region ignore //RetrievalCriteria rc1 = new RetrievalCriteria("ID", CriteraType.Equals, 1); //List<RetrievalCriteria> rcList = new List<RetrievalCriteria>(); //rcList.Add(rc1); //User u = (User)Platform.Retriever.RetrieveItems(typeof(User), rcList).First(); //Console.WriteLine("User 1 retrieved"); //printRetriever(); //string password = "******"; //Console.WriteLine("Password = "******"Hash = " + hash); //hash = Authenticator.HashPassword(password); //Console.WriteLine("Hash = " + hash); //hash = Authenticator.HashPassword(password); //Console.WriteLine("Hash = " + hash); #endregion DateTime appEndTime = DateTime.Now; Console.WriteLine("Program finished @ " + appEndTime.ToShortTimeString() + "; completed in " + (appEndTime - appStartTime).TotalSeconds.ToString("F1") + " seconds"); Console.ReadLine(); }