コード例 #1
0
        private string add_characteristics_qualitatice()
        {
            string msg_error = "";
            string name = qual.name();
            int id = qual.id();

            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)
                {
                    string result = qual.validateValues();

                    // se houver erros
                    if (result.Equals("") == false) msg_error += result;
                    else
                    {
                        bool rem = Business.ManagementDataBase.remove_characteristics(id);
                        if (rem)
                        {
                            Dictionary<String, Business.Value> value = qual.values();
                            Business.Characteristic c = new Business.QualitativeCharacteristic(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;
        }
コード例 #2
0
        private string add_characteristics_qualitatice()
        {
            string msg_error = "";
            string name = qual.name();
            int id = qual.id();

            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 result = qual.validateValues();

                // se houver erros
                if (result.Equals("") == false) msg_error += result;
                else
                {
                    Dictionary<String, Business.Value> value = qual.values();
                    Business.Characteristic c = new Business.QualitativeCharacteristic(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;
        }