public void Initialize() { specie = new Specie("Ab", "Ab", DateTime.MinValue, DateTime.MaxValue, 5); observation = new Observation(1, 1, specie, ObservationType.BirdPresent, 5, 5, 5); observation2 = new Observation(1, 1, specie, ObservationType.TerritoryIndicating, 5, 5, 5); observation3 = new Observation(1, 1, specie, ObservationType.NestIndicating, 5, 5, 5); visit = new Visit(1, 1, DateTime.MinValue, DateTime.MaxValue, null); area = new Area(1, 1, "Test", "Image", null); project = new Project(1, "Project", DateTime.MinValue, DateTime.MaxValue, null); visits = new Visits(); observations = new Observations(); speciePoint = new SpeciePoint("Sp", 5, 6); projectRepo = new ProjectRepository(new ProjectOracleContext()); visitRepo = new VisitRepository(new VisitOracleContext()); visitForm = new VisitForm(visit); observationForm = new ObservationForm(observation); observationForm2 = new ObservationForm(5, 5, 5, 5); }
/// <summary> /// Enabled when the visit button is clicked /// </summary> /// <param name="sender">object type sender parameter</param> /// <param name="e">EventArgs type e parameter</param> private void btnVisit_Click(object sender, EventArgs e) { try { if (!File.Exists(@"C:\VogeltellerApp\LocalStorage.XML")) { Visit visit = new Visit(visitRepo.GetSequenceNextValVisit(), area.AreaId, DateTime.Now, null, null); var visitForm = new VisitForm(visit) { Text = "Bezoek " + visit.VisitId + " - " + area.Name + " - " + visit.StartDate }; visitForm.Closed += (s, args) => this.Close(); visitForm.Show(); this.Hide(); } else { MessageBox.Show("Bezoek kon niet worden aangemaakt. Sla eerst uw lokale gegevens op in de database en probeer het daarna nog eens.", "Error"); } } catch (Exception) { MessageBox.Show("Bezoek kon niet worden aangemaakt, probeer het nog eens", "Error"); } }