void Button1Click(object sender, System.EventArgs e)
        {
            Table temp = new Table(txtNomTable.Text);

            //			for (int n = 0; n < arrayTables.Count; n++) {
            //				Table ttemp = (Table) arrayTables[n];
            //				if (ttemp.propNom.ToLower().Equals(temp.propNom.ToLower())) {
            //					MessageBox.Show("Erreur, une table existe déjà sous le même nom", "OracleScriptGenerator", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //					return;
            //				}
            //			}
            arrayTables.Sort(new TableComparer());
            refreshListe();
            if (arrayTables.BinarySearch(temp, new TableComparer()) < 0) {
                if (tableWizard2 == null) {
                    tableWizard2 = new CreateTableWizard2();
                    tableWizard2.propTableWizard1 = this;
                    tableWizard2.propTables = arrayTables;
                    tableWizard2.propListe = liste;
                }
                this.Visible = false;
                tableWizard2.Visible = true;
            } else {
                MessageBox.Show("Erreur, une table existe déjà sous le même nom", "OracleScriptGenerator", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //				if (tableWizard2 == null) {
            //					tableWizard2 = new CreateTableWizard2();
            //					tableWizard2.propTableWizard1 = this;
            //					tableWizard2.propTables = arrayTables;
            //					tableWizard2.propListe = liste;
            //				}
            //				this.Visible = false;
            //				tableWizard2.Visible = true;
            }
        }
 public ContrainteCheck(Table entite, string nomContrainte)
     : this()
 {
     arrayCK = entite.CK;
     arrayAttributs = entite.attributs;
     check = new Check (nomContrainte);
 }
 public ContrainteUnique(Table entite, string nomContrainte)
     : this()
 {
     this.entite = entite;
     arrayAttributs = entite.attributs;
     this.nom = nomContrainte;
     unique = new Unique(nom);
 }
 public ContraintePrimaryKey(Table entite)
     : this()
 {
     arrayAttributs = entite.attributs;
     pk = entite.PK;
     nomTable = entite.propNom;
     this.entite = entite;
 }
        public ContrainteForeignKey(Table entite, ArrayList arrayTables, string nomContrainte)
            : this()
        {
            this.arrayTables = arrayTables;
            this.entite = entite;
            this.nom = nomContrainte;
            this.arrayForeignKey = entite.FK;

            arrayAttributs = new ArrayList();
            arrayAttributsRef = new ArrayList();
        }
        public void initialiser()
        {
            arrayFK = new ArrayList();
            arrayCK = new ArrayList();
            arrayUQ = new ArrayList();
            pk = new PrimaryKey("");

            entite = new Table (tableWizard2.propTableWizard1.nomTable.ToString());
            entite.attributs = arrayAttributs;
            entite.PK = pk;
            entite.FK = arrayFK;
            entite.CK = arrayCK;
            entite.UQ = arrayUQ;
        }
Пример #7
0
        void ListeClick(object sender, System.EventArgs e)
        {
            try {
                Table temp = new Table(liste.SelectedItem.ToString());
                arrayTables.Sort(new TableComparer());
                refreshListe();

                int posi = arrayTables.BinarySearch(temp, new TableComparer());

                if (posi != -1) {

                    temp = (Table) arrayTables[posi];
                    txtCode.Text = temp.ToString();
            //					syntax = new SyntaxHighlighter(txtCode);
            //					this.syntax.formater ();
                }
            } catch (Exception) {
            }
        }
Пример #8
0
        public void ConstruireIndex()
        {
            string contenu = contenuFichier;
            contenu = contenu.ToLower();

            int posi = contenu.IndexOf(CREATE_TABLE_KEYWORD);
            posi += CREATE_TABLE_KEYWORD.Length;
            int posi2 = contenu.IndexOf('(', posi);
            string nomTable;

            while (posi != -1) {
                nomTable = 	contenu.Substring(posi, posi2-posi);
                nomTable = nomTable.Trim();
                nomTable = nomTable.Trim('\n');
                nomTable = nomTable.ToUpper();

                //indexation des attributs de la table
                int posi3 = contenu.IndexOf(");", posi2);
                string contenuTable = contenu.Substring(posi2+1, posi3-posi2);

            //				Console.Out.WriteLine("attributs");
            //				Console.Out.WriteLine(contenu.Substring(posi2, posi3-posi2));

                //ajout des table à la arraylist
                 tempTable = new Table(nomTable);
                 tempTable.CompleteCode = false;
                 tempTable.AutoCode = contenuTable;
                 etablirAttributs(contenuTable);
                listeTables.Add(tempTable);

                posi = contenu.IndexOf(CREATE_TABLE_KEYWORD, posi);
                if (posi == -1) {
                    break;
                }
                posi += CREATE_TABLE_KEYWORD.Length;
                posi2 = contenu.IndexOf("(", posi);
            }
        }
        void ListeTablesSelectedIndexChanged(object sender, System.EventArgs e)
        {
            listeAttributsRef.Items.Clear();
            int i = listeTables.SelectedIndex;
            if (i == -1) {
                i = 0;
            }
            Table t; //table temporaire
            Attribut att; //attribut temporaire

            if (listeTables.Items[i].ToString().Equals(entite.propNom.ToString())) {
                t = entite;
            } else {
                t = new Table(listeTables.Items[i].ToString());
                //if (arrayTables.BinarySearch(temp, new TableComparer()) != -1)
                int j = arrayTables.BinarySearch(t, new TableComparer());
                if (j != -1) {
                    t = (Table) arrayTables[j];
                } else {
                    MessageBox.Show("Erreur d'affichage", "OracleScriptGenerator", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            if (checkAllAttributs.Checked) {
                for (int k = 0; k < t.attributs.Count; k++) {
                    att = (Attribut)t.attributs[k];
                    listeAttributsRef.Items.Add(att.propNom.ToString());
                }
            } else {
                if (t.PK.attributs.Count != 0) {
                    for (int k = 0;  k< t.PK.attributs.Count; k++) {
                        listeAttributsRef.Items.Add(t.PK.attributs[k].ToString());
                    }
                }
            }

            RafraichirAffichage();
        }