/// <summary> /// Initializes a new instance of the Observation class. /// </summary> /// <param name="obsId">integer type obsId parameter</param> /// <param name="visitId">integer type visitId parameter</param> /// <param name="specie">Specie type specie parameter</param> /// <param name="obsType">ObservationType type obsType parameter</param> /// <param name="amount">integer type amount parameter</param> /// <param name="xcor">integer type xCor parameter</param> /// <param name="ycor">integer type yCor parameter</param> public Observation(int obsId, int visitId, Specie specie, ObservationType obsType, int amount, int xcor, int ycor) { ObsId = obsId; VisitId = visitId; Specie = specie; ObsType = obsType; Amount = amount; XCor = xcor; YCor = ycor; }
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); }
private void btnEditObservation_Click(object sender, EventArgs e) { specie = ReturnSpecie(); switch (cbObservationType.Text) { case "Vogel aanwezig": observation = new Observation( observation.ObsId, observation.VisitId, specie, ObservationType.BirdPresent, Convert.ToInt32(nudAmount.Value), observation.XCor, observation.YCor); break; case "Territorium indicerend": observation = new Observation( observation.ObsId, observation.VisitId, specie, ObservationType.TerritoryIndicating, Convert.ToInt32(nudAmount.Value), observation.XCor, observation.YCor); break; case "Nest indicerend": observation = new Observation( observation.ObsId, observation.VisitId, specie, ObservationType.NestIndicating, Convert.ToInt32(nudAmount.Value), observation.XCor, observation.YCor); break; } DialogResult = DialogResult.OK; }
private void cbSpecies_SelectedIndexChanged(object sender, EventArgs e) { specie = (Specie)cbSpecies.SelectedItem; cbObservationType.Enabled = true; }
/// <summary> /// This method will load the specie corresponding to the /// specie code in the observation /// </summary> /// <param name="specieCode">string type specieCode parameter</param> /// <returns>A specie</returns> public Specie LoadSpecie(string specieCode) { using (var connection = Database.Connection) using (var command = connection.CreateCommand()) { try { command.CommandText = "SELECT * " + "FROM SPECIE " + "WHERE SPECIECODE=:specieCode "; command.Parameters.AddWithValue("specieCode", specieCode); using (var reader = command.ExecuteReader()) { Specie specie = null; while (reader.Read()) { specie = new Specie( Convert.ToString(reader["SPECIECODE"]), Convert.ToString(reader["NAME"]), Convert.ToDateTime(reader["BREEDSTART"]), Convert.ToDateTime(reader["BREEDEND"]), Convert.ToInt32(reader["POINTS"])); } return specie; } } catch (Exception) { return null; } finally { connection.Close(); } } }