private string add_characteristics_numeric() { string msg_error = ""; string name = num.name(); int id = num.id(); int value = 0; if (id == -1) msg_error += "ID value is not correct.\n"; if (name.Equals("")) msg_error += "Name is not correct.\n"; if (id != -1 && name.Equals("") == false) { string msg = "The characteristics will be edited. The software will lose these attributes. Want Continue?"; DialogResult r = MessageBox.Show(msg, "Edit Characteristics", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (r == DialogResult.Yes) { bool rem = Business.ManagementDataBase.remove_characteristics(id); if (rem) { Business.Characteristic c = new Business.NumericCharacteristic(id, name, value); bool b = Business.ManagementDataBase.add_characteristics(c); if (b) { MessageBox.Show("Characteristics edited.", "Characteristics", MessageBoxButtons.OK, MessageBoxIcon.None); } else { msg_error += "Error adding.\nPlease check if the ID does not exist yet.\n"; } } } } return msg_error; }
private string add_characteristics_numeric() { string msg_error = ""; string name = num.name(); int id = num.id(); int value = 0; if (id == -1) msg_error += "ID value is not correct.\n"; if (value == -1) msg_error += "Default Value is not correct.\n"; if (name.Equals("")) msg_error += "Name is not correct.\n"; if (id != -1 && value != -1 && name.Equals("") == false) { Business.Characteristic c = new Business.NumericCharacteristic(id, name, value); bool b = Business.ManagementDataBase.add_characteristics(c); if (b) { MessageBox.Show("Characteristics added.", "Characteristics", MessageBoxButtons.OK, MessageBoxIcon.None); this.Close(); } else { msg_error += "Error adding.\nPlease check if the ID does not exist yet.\n"; } } return msg_error; }