// Button 'Save' private void buttonEditHallConfirm_Click(object sender, EventArgs e) { string hallname = textBoxHallname.Text; // Check for null or empty input if (string.IsNullOrWhiteSpace(hallname)) { MessageBox.Show("Hallname field is not filled in"); } if (!string.IsNullOrWhiteSpace(hallname) && comboBoxHallType.SelectedIndex > -1) { // Execute save int halltypeid = Convert.ToInt32(comboBoxHallType.SelectedValue); DBSetData.FloorplanHallEdit(hallid, hallname, halltypeid); // Close form this.Close(); floorplanForm.LoadDataHall(); floorplanForm.Refresh(); new StatusMessage("Hall with name " + hallname + " is updated in the database."); } }
// Button 'Save' private void buttonNewHallConfirm_Click(object sender, EventArgs e) { Boolean hallexists = false; string hallname = textBoxHallname.Text; if (DBGetData.GetFloorplanHallExists(hallname) > 0) { hallexists = true; MessageBox.Show("Hall name already exists, select a different name."); } // Execute save if (!hallexists && !string.IsNullOrWhiteSpace(hallname) && comboBoxHallType.SelectedIndex > -1) { int halltypeid = Convert.ToInt32(comboBoxHallType.SelectedValue); DBSetData.FloorplanHallAdd(hallname, halltypeid); // Close form this.Close(); floorplanForm.LoadDataHall(); floorplanForm.Refresh(); new StatusMessage("Hall with name " + hallname + " is added to the database."); } }