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 index of the project combo box changes /// </summary> /// <param name="sender">object type sender parameter</param> /// <param name="e">EventArgs type e parameter</param> private void cbProjects_SelectedIndexChanged(object sender, EventArgs e) { cbAreas.Enabled = true; cbAreas.Items.Clear(); cbAreas.Text = string.Empty; project = (Project)cbProjects.SelectedItem; foreach (var area in project.Areas) { cbAreas.Items.Add(area); } }
/// <summary> /// Enabled when the index of the area combo box changes /// </summary> /// <param name="sender">object type sender parameter</param> /// <param name="e">EventArgs type e parameter</param> private void cbAreas_SelectedIndexChanged(object sender, EventArgs e) { project = (Project)cbProjects.SelectedItem; area = (Area)cbAreas.SelectedItem; if (project.EndDate != null) { btnVisit.Enabled = false; btnPrint.Enabled = false; } else { btnVisit.Enabled = true; btnPrint.Enabled = true; } }