private void BtnOK_Click(object sender, EventArgs e) { try { if (Dialog_Basic.ModifyOrAdd == 0) { int RefBrand = int.Parse(TextRefBrand.Text); string BrandName = TextBox.Text; if (!ControllerManagement.ModifyBrand(RefBrand, BrandName)) { MessageBox.Show("Fail to modify the brand ! "); } else { if (MessageBox.Show("Successfully modified the brand !") == DialogResult.OK) { Close(); } } } else if (Dialog_Basic.ModifyOrAdd == 1) { ControllerManagement.AddBrand(TextBox.Text); if (MessageBox.Show("Successfully added the brand !") == DialogResult.OK) { Close(); } } ControllerManagement.RefreshListViewBrand(); ControllerFurniture.RefreshListView(-1); } catch (Exception Exception) { MessageBox.Show("Error during the operation ! " + Exception.Message); } }