public VisitForm(Project project, Visit visit) { InitializeComponent(); _currentVisit = visit; _project = project; this.Text = project.Name; // putting the project title _observations = new List<Observation>(); var currentdir = AppDomain.CurrentDomain.BaseDirectory + @"../../"; pbMap.ImageLocation = currentdir + project.FilePath; // Loading comboboxes cmbBirds.Items.Clear(); cmbObservationType.Items.Clear(); foreach (var bird in LogicCollection.BirdLogic.GetAll()) { cmbBirds.Items.Add(bird); } foreach (var observationType in LogicCollection.ObservationTypeLogic.GetAll()) { cmbObservationType.Items.Add(observationType); } }
/// <summary> /// Opening the form to visit project /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnVisitProject_Click(object sender, EventArgs e) { if (cmbProjectList.SelectedIndex != -1) { var selectedProject = (Project) cmbProjectList.SelectedItem; var newVisit = new Visit(0, selectedProject.ID, null, DateTime.Now, new DateTime(1999, 01, 01)); var visitForm = new VisitForm(selectedProject, newVisit); visitForm.ShowDialog(); } else { MessageBox.Show("Uw heeft geen keuze voor een project gemaakt."); } }
/// <summary> /// Constructor /// </summary> /// <param name="visit"></param> /// <param name="observations"></param> public Xml(Visit visit, List<Observation> observations) { Visit = visit; Observations = observations; }
/// <summary> /// Insert visit in database /// </summary> /// <param name="entity"></param> /// <returns></returns> public Visit Insert(Visit entity) { return _context.Insert(entity); }
public void InsertVisit() { var visit = new Visit(0, 2, "Dino Spong", DateTime.Now, DateTime.Now.AddHours(3)); var insertVisit = LogicCollection.VisitLogic.Insert(visit); Assert.IsNotNull(insertVisit, "Inserting an visit failed"); }