void BoutonAjouterClick(object sender, System.EventArgs e) { if (!txtNomContrainte.Text.ToString().Equals("")) { //vérifier taille de la contrainte if (txtNomContrainte.Text.ToString().Length > Contrainte.TAILLE_MAX) { txtNomContrainte.Text = txtNomContrainte.Text.ToString().Substring(0, Contrainte.TAILLE_MAX); } //vérifier contrainte similaire if (VerifierExistence(txtNomContrainte.Text)) { MessageBox.Show("Nom de contrainte existant", "OracleScriptGenerator", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //primary key if (comboType.SelectedItem.ToString().Equals(Contrainte.PK)) { pk.nom = txtNomContrainte.Text.ToString(); contraintePK = new ContraintePrimaryKey(entite); contraintePK.propTable = this.table; contraintePK.Show(); } else if (comboType.SelectedItem.ToString().Equals(Contrainte.FK)) { contrainteFK = new ContrainteForeignKey(entite, arrayTables, txtNomContrainte.Text.ToString()); contrainteFK.propTable = this.table; contrainteFK.Show(); } else if (comboType.SelectedItem.ToString().Equals(Contrainte.CK)) { contrainteCK = new ContrainteCheck(entite, txtNomContrainte.Text.ToString()); contrainteCK.propTable = this.table; contrainteCK.Show(); } else if (comboType.SelectedItem.ToString().Equals(Contrainte.UQ)) { contrainteUQ = new ContrainteUnique(entite, txtNomContrainte.Text.ToString()); contrainteUQ.propTable = this.table; contrainteUQ.Show(); } } else { MessageBox.Show("Nom de contrainte invalide", "OracleScriptGenerator", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
void BoutonAjouterClick(object sender, System.EventArgs e) { if (!txtNomContrainte.Text.ToString().Equals("")) { //vérifier taille de la contrainte if (txtNomContrainte.Text.ToString().Length > Contrainte.TAILLE_MAX) { txtNomContrainte.Text = txtNomContrainte.Text.ToString().Substring(0, Contrainte.TAILLE_MAX); } //vérifier contrainte similaire if (VerifierExistence (txtNomContrainte.Text)) { MessageBox.Show("Nom de contrainte existant", "OracleScriptGenerator", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //primary key if (comboType.SelectedItem.ToString().Equals(Contrainte.PK)) { pk.nom = txtNomContrainte.Text.ToString(); contraintePK = new ContraintePrimaryKey(entite); contraintePK.propTable = this.table; contraintePK.Show(); } else if (comboType.SelectedItem.ToString().Equals(Contrainte.FK)) { contrainteFK = new ContrainteForeignKey(entite, arrayTables, txtNomContrainte.Text.ToString()); contrainteFK.propTable = this.table; contrainteFK.Show(); } else if (comboType.SelectedItem.ToString().Equals(Contrainte.CK)) { contrainteCK = new ContrainteCheck(entite, txtNomContrainte.Text.ToString()); contrainteCK.propTable = this.table; contrainteCK.Show(); } else if (comboType.SelectedItem.ToString().Equals(Contrainte.UQ)) { contrainteUQ = new ContrainteUnique(entite, txtNomContrainte.Text.ToString()); contrainteUQ.propTable = this.table; contrainteUQ.Show(); } } else { MessageBox.Show("Nom de contrainte invalide", "OracleScriptGenerator", MessageBoxButtons.OK, MessageBoxIcon.Information); } }