예제 #1
0
        //int nb_lignes=1;
        public AttributRelation(Relation r)
        {
            InitializeComponent();
            NomRelation.Text = "Relation";
            GridChamps.Rows.Add(1);
            int ligne = 0;
            foreach (Champ ch in r.Champs)
            {
                if (ligne > 0)
                    GridChamps.Rows.Add(1);

                GridChamps.Rows[ligne].SetValues(ch.Nom, ch.TypetoString(), ch.Taille.ToString(), ch.CléPrimaire, ch.Auto, ch.NotNull, ch.IndexChamp.ToString());
                ligne++;
            }
            relation = r;
        }
예제 #2
0
        public EditionContrainte(Contrainte c,  Relation relationS,  Relation relationD)
        {
            InitializeComponent();
            contrainte = c;
            relationSource = relationS;
            relationDestination = relationD;
            foreach (Champ ch in relationSource.Champs)
                cléRelation1.Items.Add(ch.ToString());

            foreach (Champ ch in relationDestination.Champs)
                cléRelation2.Items.Add(ch.ToString());

            if (contrainte.Nom != null)
            {
                cléRelation1.Text = contrainte.ChampSource.Nom;
                cléRelation2.Text = contrainte.ChampDestination.Nom;
                NomRelation.Text = contrainte.Nom;
            }
        }
예제 #3
0
        private void ReverseEngineer(string baseSQL)
        {
            base_données = baseSQL;
            this.Text = baseSQL;

            AccèsSQL AccSQL = new AccèsSQL(baseSQL);

            Point point = new Point(10, 23);
            foreach (DataTable d in AccSQL.Tables)
            {
                if (d.TableName != "sysdiagrams")
                {
                    Relation r = new Relation(point, option.Taille_Noeud, option.Couleur_Noeud, option.Épaisseur_Noeud, d);
                    noeuds.Add(r);
                }
            }
            //foreach (DataTable d in AccSQL.ForeignKeys)
            //{
            //    Contrainte c = new
            //}
            Relation r1 = null, r2 = null;
            Champ chSource = null, chDest = null;
            for (int i = 0; i < AccSQL.ForeignKeys.Rows.Count; i++)
            {
               foreach(Relation r in noeuds)
               {
                   if(r.Texte == AccSQL.ForeignKeys.Rows[i].ItemArray[2].ToString())
                       r1 = r;
                   if(r.Texte == AccSQL.ForeignKeys.Rows[i].ItemArray[8].ToString())
                       r2 = r;
               }
                foreach(Champ ch in r1.Champs)
                {
                    if(ch.Nom == AccSQL.ForeignKeys.Rows[i].ItemArray[3].ToString())
                        chSource = ch;
                }
                foreach(Champ ch in r2.Champs)
                {
                    if(ch.Nom == AccSQL.ForeignKeys.Rows[i].ItemArray[9].ToString())
                        chDest = ch;
                }
                Contrainte c = new Contrainte(r1, r2, Color.Black, 2,chSource,chDest);
                traits.Add(c);
            }
        }
예제 #4
0
        private Noeud NoeudParDéfaut(Point point, TypeSchéma typeschéma)
        {
            Noeud noeud = null;
            switch (typeSchéma)
            {
                case TypeSchéma.Graphe:
                    noeud = new Noeud(point, option.Taille_Noeud, option.Couleur_Noeud, option.Épaisseur_Noeud);
                    noeuds.Add(noeud);
                    break;

                case TypeSchéma.Relationnel:
                    noeud = new Relation(point, option.Taille_Noeud, option.Couleur_Noeud, option.Épaisseur_Noeud);                  
                    AttributRelation pa = new AttributRelation((Relation)noeud);
                    if (pa.ShowDialog() == DialogResult.OK)
                        noeuds.Add(noeud);
                    break;

                case TypeSchéma.EntitéAssociation:
                    noeud = new Entité(point, option.Taille_Noeud, option.Couleur_Noeud, option.Épaisseur_Noeud);
                    EditionEntité ed = new EditionEntité((Entité)noeud);
                    if (ed.ShowDialog() == DialogResult.OK)
                        noeuds.Add(noeud);
                    break;
           }
            return noeud;
        }