static void Main() { var app = new ApplicationService(); var training = new TrainingCreator(app); var location = new LocationCreator(app); var trainer = new TrainerCreator(app); var company = new CompanyCreator(app); var student = new StudentCreator(app); var contact = new ContactCreator(app, company); var session = new SessionCreator(app, training, trainer, location, student, company); var reader = new MsAccessReader("c:\\temp\\Database1.mdb"); var lineCount = 1; foreach (DataRow row in reader.GetRows("Formation")) { Console.Write($"Traitement de la ligne {lineCount++}\r"); training.Create(row["Formation"].ToString()); location.Create(row["Lieu"].ToString()); trainer.Create(row["Formateur"].ToString()); company.Create(row["Societe"].ToString(), row["Adresse"].ToString(), row["CP"].ToString(), row["Ville"].ToString()); student.Create(row["Stagiaire"].ToString()); contact.Create(row["Contact"].ToString(), row["Email"].ToString(), row["Telephone"].ToString(), row["Societe"].ToString()); session.Create(DateTime.Parse(row["DateFormation"].ToString()), int.Parse(row["NbJour"].ToString()), row["Formation"].ToString(), row["Formateur"].ToString(), row["Lieu"].ToString(), row["Stagiaire"].ToString(), row["Societe"].ToString()); } /* DisableAll("Formations", training.GetAll(), id => app.Command<DisableTraining>().Execute(id)); * DisableAll("Lieux", location.GetAll(), id => app.Command<DisableLocation>().Execute(id)); * DisableAll("Formateur", trainer.GetAll(), id => app.Command<DisableTrainer>().Execute(id));*/ Console.WriteLine("\r\nImport terminé !"); Console.ReadKey(); }
/// <summary> /// Method used to add a contact by absolute position /// </summary> /// <param name="position">Absolute position of contact <see cref="PointF"/></param> /// <param name="contactType">Contact type to create <see cref="ContactTypes"/></param> /// <param name="heading"></param> /// <param name="speed"></param> /// <param name="altitude"></param> /// <returns></returns> protected IReferencePoint CreateContactAtPoint(PointF position, ContactTypes contactType, double heading = 0.00, double speed = 0.00, double altitude = 0.00) { var contactFactory = new ContactCreator(); var newContact = contactFactory.Create(RadarReceiver, position, heading, altitude, speed, contactType); Logger.Info($"Creating contact: {contactType} as a plotted contact at {position}"); newContact.ReferencePointChanged += NewContact_ReferencePointChanged; RadarReceiver.AddContact(newContact); newContact.Start(); return(newContact); }
public void SaveAndLoadTest() { var builders = new ContactBuilder[3] { new ContactBuilder(), new ContactBuilder(), new ContactBuilder() }; using (var creator = new ContactCreator()) { builders[0].SetFirstName("Brian").SetLastName("Rothwell").SetContactInfo("*****@*****.**"); builders[1].SetFirstName("Billy").SetLastName("Bob").SetContactInfo("*****@*****.**"); builders[2].SetFirstName("Jenny").SetLastName("Twotone").SetContactInfo("(210) 867-5308"); foreach (var builder in builders) { builder.SetCreator(creator); var contact = (Contact)builder.Build(); builder.SetObjectId(contact.GetObjectId()); Helper.AssertAreEqual(builder, contact, "Original"); } creator.Save(); } using (var creator = new ContactCreator()) // Re-open the files. { foreach (var builder in builders) { var objectId = builder.GetObjectId(); var savedContact = (Contact)creator.Create(objectId); Helper.AssertAreEqual(builder, savedContact, "Saved"); } } }