private void ButtonRemoveColour_Click(object sender, EventArgs e) { if (comboBoxRemoveColour.SelectedItem.ToString() != null) { string messageToRemove = "Дійсно видалити колір " + comboBoxRemoveColour.SelectedItem.ToString() + " ?"; string caption = "Видалення з бази данних!"; DialogResult result = MessageBox.Show(messageToRemove, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { ColourDTO removeColour = new ColourDTO(); string message = removeColour.RemoveColour(comboBoxRemoveColour.SelectedItem.ToString()); MessageBox.Show(message); this.CleareAllComponent(); this.FillAlComponent(); } else { MessageBox.Show("Ви відмінили операцію видалення!"); } } else { MessageBox.Show("Потрібно вибрати назву Кольру!"); } this.CleareAllComponent(); this.FillAlComponent(); }
//додати новий колір до бази даних private void Add_NewColour_Click(object sender, EventArgs e) { if (textBoxAddColour.Text.Trim() != "") { ColourDTO newColour = new ColourDTO(); string message = newColour.AddColour(textBoxAddColour.Text.Trim()); MessageBox.Show(message); } else { MessageBox.Show("Потрібно написати назву Кольору!"); } this.CleareAllComponent(); this.FillAlComponent(); }