Example #1
0
        public void savePhysicalToXML(String fpath, MetaDataPhysical obj)
        {
            serializer = new XmlSerializer(typeof(MetaDataPhysical));
            FileStream fs = new FileStream(fpath, FileMode.Create);

            serializer.Serialize(fs, obj);
            fs.Close();
        }
Example #2
0
        public MetaDataPhysical loadPhysicalFromXML(String fpath)
        {
            serializer = new XmlSerializer(typeof(MetaDataPhysical));
            FileStream       fs  = new FileStream(fpath, FileMode.Open);
            MetaDataPhysical obj = (MetaDataPhysical)serializer.Deserialize(fs);

            fs.Close();

            return(obj);
        }
Example #3
0
        private void LoadDDLForm()
        {
            LoadPhyicalForm();
            if (ActiveMdiChild != null && ActiveMdiChild.GetType().Name == "frmPhysicalDrawBoard")
            {
                MetaDataPhysical mdp = ((frmPhysicalDrawBoard)ActiveMdiChild).pnlPhysical.getMetaDataPhysical();

                string formName = ActiveMdiChild.Text.Substring(0, ActiveMdiChild.Text.IndexOf("Physical")) + " Generate DDL";
                Form   f        = findForm(formName);

                if (f != null)
                {
                    f.Close();
                }

                GenerateScriptSQL gpm = new GenerateScriptSQL(this, mdp);
                gpm.Text      = formName;
                gpm.MdiParent = this;
                gpm.Show();
            }
        }
Example #4
0
        public void drawMetaDataPhysical(MetaDataPhysical mdp)
        {
            //Vẽ MetaDataPhysical lên this Panel
            foreach (Table t in mdp.Tables)
            {
                TableShape ts = new TableShape(t);
                ts.Location = new Point(t.x, t.y);
                this.Controls.Add(ts);
            }
            foreach (ForeignKey fk in mdp.ForeignKeys)
            {
                TableShape shapePrimary   = searchShapeInPannel(fk.ParentTable);
                TableShape shapeReference = searchShapeInPannel(fk.ChildTable);
                FKShape    fkShape        = new FKShape();
                fkShape.fkName         = fk.Name;
                fkShape.tableReference = shapeReference;
                fkShape.childColumn    = fk.ChildColumn;
                fkShape.parentColumn   = fk.ParentColumn;
                shapePrimary.listFK.Add(fkShape);
            }

            this.Invalidate();
        }
Example #5
0
        //My Method
        public MetaDataPhysical getMetaDataPhysical()
        {
            //Convert tất cả shape qua MetaDataPhysical
            MetaDataPhysical mdp = new MetaDataPhysical();

            //Duyệt tất cả controls trên Panel
            foreach (Control ctr in this.Controls)
            {
                TableShape tShape = (TableShape)ctr;
                mdp.Tables.Add(tShape.table);
                foreach (FKShape fkShape in tShape.listFK)
                {
                    ForeignKey fk = new ForeignKey();
                    fk.Name         = fkShape.fkName;
                    fk.ParentTable  = tShape.table.name;
                    fk.ParentColumn = fkShape.parentColumn;
                    fk.ChildTable   = fkShape.tableReference.table.name;
                    fk.ChildColumn  = fkShape.childColumn;
                    mdp.ForeignKeys.Add(fk);
                }
            }
            return(mdp);
        }
Example #6
0
 public ScriptMySql(MetaDataPhysical mdp, string dbName)
 {
     this.mdp    = mdp;
     this.dbName = dbName;
 }
Example #7
0
 //Constructor
 public GenerateScriptSQL(MainForm f, MetaDataPhysical mdPhysical)
 {
     InitializeComponent();
     frmMain = f;
     mdp     = mdPhysical;
 }
Example #8
0
 /// <summary>
 /// Phương thức khởi tạo GenerateDDL
 /// </summary>
 /// <param name="mdp">Meta data physical</param>
 /// <param name="nameDBMS">Loại Database Manage System</param>
 /// <param name="dbName">Tên Database</param>
 public GenerateDDL(MetaDataPhysical mdp, DBMS nameDBMS, string dbName)
 {
     this.mdp      = mdp;
     this.nameDBMS = nameDBMS;
     this.dbName   = dbName;
 }