private void numberInput_ValueChanged(object sender, EventArgs e) { try { floor f = context.floor.Find(numberInput.Value); if (f != null) { numberInput.Value = f.number; departmentInput.Text = f.department_name; changeButton.Enabled = true; addButton.Enabled = false; } else { departmentInput.Text = ""; changeButton.Enabled = false; addButton.Enabled = true; } } catch (Exception) { departmentInput.Text = ""; changeButton.Enabled = false; addButton.Enabled = true; } }
public void Update(floor f) { this.number = f.number; this.department_name = f.department_name; }