private void btnFindProperty_Click(object sender, EventArgs e)
        {
            InputDialog id = new InputDialog("Property ID:");

            id.onDispose += (pID) =>
            {
                if (!Int32.TryParse(pID, out int pIDint))
                {
                    MessageBox.Show("Value has to be integer");
                }
                else
                {
                    Property p = this.PropertyList.FindProperty(new Property(pIDint));
                    if (p != null)
                    {
                        PropertyView pv = new PropertyView(p);
                        pv.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("This property does not exists");
                    }
                }
            };
            id.ShowDialog();
        }
 private void label4_Click(object sender, EventArgs e)
 {
     if (this.Person.Property != null)
     {
         PropertyView pv = new PropertyView(this.Person.Property);
         pv.onDispose += (prop) => this.inputAddress.Text = prop.Address;
         pv.ShowDialog();
     }
 }
        private void btnAddProperty_Click(object sender, EventArgs e)
        {
            PropertyView pv = new PropertyView(new Property(-1, "", "", this.PropertyList));

            pv.onDispose += (p) =>
            {
                if (p.ID >= 0 && this.PropertyList.AddProperty(p))
                {
                    MessageBox.Show("Property was added");
                }
                else
                {
                    MessageBox.Show("Property was not added");
                }
            };
            pv.ShowDialog();
        }
        private void dataGridProperties_RowClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex != -1)
            {
                Property p =
                    this.Properties != null?
                    this.Properties.Where(po => po.ID == Int32.Parse(dataGridProperties.Rows[e.RowIndex].Cells[0].Value.ToString())).FirstOrDefault()
                        :
                        this.GetProperty(Int32.Parse(dataGridProperties.Rows[e.RowIndex].Cells[0].Value.ToString()));

                if (p != null)
                {
                    PropertyView pv = new PropertyView(p);
                    pv.onDispose += (ret) => this.ReloadData();
                    pv.ShowDialog();
                }
            }
        }