Beispiel #1
0
        public static SODatabase ToSODatabase(PDModel model)
        {
            if (model == null)
            {
                return(null);
            }

            SODatabase db = new SODatabase();

            db.Name      = model.Code;
            db.Comment   = string.IsNullOrEmpty(model.Comment) ? model.Name : model.Comment;
            db.TableList = new List <SOTable>();
            foreach (PDTable item in model.AllTableList)
            {
                db.TableList.Add(ToSOTable(item));
            }
            db.ViewList = new List <SOView>();
            //foreach (PDView item in model.AllViewList)
            //{
            //    db.ViewList.Add(ToSOView(item));
            //}
            db.CommandList = new List <SOCommand>();
            //foreach (PDProcedure item in model.AllProcedureList)
            //{
            //    db.CommandList.Add(ToSOCommand(item));
            //}

            return(db);
        }
Beispiel #2
0
        void ParseUsers(PDModel m, XmlNode root)
        {
            foreach (XmlNode userNode in root.ChildNodes)
            {
                PDUser user = new PDUser();
                user.Model = m;
                user.ID    = userNode.Attributes["Id"].Value;

                foreach (XmlNode node in userNode.ChildNodes)
                {
                    switch (node.Name)
                    {
                    case "a:Name":
                        user.Name = node.InnerText;
                        break;

                    case "a:Code":
                        user.Code = node.InnerText;
                        break;

                    case "a:Comment":
                        user.Comment = node.InnerText;
                        break;

                    default:
                        user.AddUnparsedNode(node);
                        break;
                    }
                }//end parse user

                m.AddUser(user);
            }//end parse users
        }
Beispiel #3
0
        void ParseDbms(PDModel m, XmlNode root)
        {
            PDDbms  dbms         = new PDDbms();
            XmlNode shortcutNode = root.FirstChild;

            dbms.Model = m;
            dbms.ID    = shortcutNode.Attributes["Id"].Value;

            foreach (XmlNode node in shortcutNode.ChildNodes)
            {
                switch (node.Name)
                {
                case "a:Name":
                    dbms.Name = node.InnerText;
                    break;

                case "a:Code":
                    dbms.Code = node.InnerText;
                    break;

                case "a:Comment":
                    dbms.Comment = node.InnerText;
                    break;

                default:
                    dbms.AddUnparsedNode(node);
                    break;
                }
            }

            m.DBMS = dbms;
        }
        public static SODatabase ToSODatabase(PDModel model)
        {
            if (model == null) return null;

            SODatabase db = new SODatabase();

            db.Name = model.Code;
            db.Comment = string.IsNullOrEmpty(model.Comment) ? model.Name : model.Comment;
            db.TableList = new List<SOTable>();
            foreach (PDTable item in model.AllTableList)
            {
                db.TableList.Add(ToSOTable(item));
            }
            db.ViewList = new List<SOView>();
            //foreach (PDView item in model.AllViewList)
            //{
            //    db.ViewList.Add(ToSOView(item));
            //}
            db.CommandList = new List<SOCommand>();
            //foreach (PDProcedure item in model.AllProcedureList)
            //{
            //    db.CommandList.Add(ToSOCommand(item));
            //}

            return db;
        }
Beispiel #5
0
        void ParseColumns(PDModel m, PDPackage package, PDTable table, XmlNode root)
        {
            foreach (XmlNode columnNode in root.ChildNodes)
            {
                PDColumn column = new PDColumn();
                column.Model   = m;
                column.Package = package;
                column.Table   = table;
                column.ID      = columnNode.Attributes["Id"].Value;

                foreach (XmlNode node in columnNode.ChildNodes)
                {
                    switch (node.Name)
                    {
                    case "a:Name":
                        column.Name = node.InnerText;
                        break;

                    case "a:Code":
                        column.Code = node.InnerText;
                        break;

                    case "a:Comment":
                        column.Comment = node.InnerText;
                        break;

                    case "a:DataType":
                        column.DataType = node.InnerText;
                        break;

                    case "a:Length":
                        column.Length = ConvertUtil.ToInt32(node.InnerText, 0);
                        break;

                    case "a:Precision":
                        column.Precision = ConvertUtil.ToInt32(node.InnerText, 0);
                        break;

                    case "a:Mandatory":
                        column.Mandatory = node.InnerText == "1" ? true : false;
                        break;

                    case "a:DefaultValue":
                        column.DefaultValue = node.InnerText;
                        break;

                    case "a:Identity":
                        column.Identity = node.InnerText == "1";
                        break;

                    default:
                        column.AddUnparsedNode(node);
                        break;
                    }
                }//end parse column

                table.AddColumn(column);
            }//end parse columns
        }
Beispiel #6
0
        /// <summary>
        /// 解析并生成模型实例
        /// </summary>
        /// <returns></returns>
        public PDModel BuildModel()
        {
            PDModel m = new PDModel();

            XmlElement docElement = doc.DocumentElement;
            XmlNode root = docElement.FirstChild.FirstChild.FirstChild;
            if (root == null) return null;

            m.ID = root.Attributes["Id"].Value;
            foreach (XmlNode node in root.ChildNodes)
            {
                switch (node.Name)
                {
                    case "a:Name":
                        m.Name = node.InnerText;
                        break;
                    case "a:Code":
                        m.Code = node.InnerText;
                        break;
                    case "a:Comment":
                        m.Comment = node.InnerText;
                        break;
                    case "c:DBMS":
                        ParseDbms(m, node);
                        break;
                    case "c:Packages":
                        ParsePackages(m, null, node);
                        break;
                    case "c:Users":
                        ParseUsers(m, node);
                        break;
                    case "c:Domains":
                        break;
                    case "c:Tables":
                        ParseTables(m, null, node);
                        break;
                    case "c:Views":
                        ParseViews(m, null, node);
                        break;
                    case "c:Procedures":
                        ParseProcedures(m, null, node);
                        break;
                    case "c:References":
                        ParseReferences(m, null, node);
                        break;
                    default:
                        m.AddUnparsedNode(node);
                        break;
                }
            }

            return m;
        }
        public void LoadModel(PDModel m)
        {
            this.Text = m.Name;

            dgvTable.AutoGenerateColumns = false;
            dgvView.AutoGenerateColumns = false;
            dgvSP.AutoGenerateColumns = false;

            dgvTable.DataSource = m.AllTableList;
            dgvView.DataSource = m.AllViewList;
            dgvSP.DataSource = m.AllProcedureList;

            tpTable.Text = string.Format("表[{0}]", dgvTable.Rows.Count);
            tpView.Text = string.Format("视图[{0}]", dgvView.Rows.Count);
            tpSP.Text = string.Format("存储过程[{0}]", dgvSP.Rows.Count);
        }
Beispiel #8
0
        void ParseIndexes(PDModel m, PDPackage package, PDTable table, XmlNode root)
        {
            foreach (XmlNode indexNode in root.ChildNodes)
            {
                PDIndex index = new PDIndex();
                index.Model   = m;
                index.Package = package;
                index.Table   = table;
                index.ID      = indexNode.Attributes["Id"].Value;

                foreach (XmlNode node in indexNode.ChildNodes)
                {
                    switch (node.Name)
                    {
                    case "a:Name":
                        index.Name = node.InnerText;
                        break;

                    case "a:Code":
                        index.Code = node.InnerText;
                        break;

                    case "a:Comment":
                        index.Comment = node.InnerText;
                        break;

                    case "a:Unique":
                        index.Unique = node.InnerText == "1" ? true : false;
                        break;

                    case "c:IndexColumns":
                        index.ColumnIDList = ParseIndexColumnIDs(node.ChildNodes);
                        break;

                    default:
                        break;
                    }
                }//end parse index

                table.AddIndex(index);
            }//end parse indexes
        }
Beispiel #9
0
        void ParseProcedures(PDModel m, PDPackage package, XmlNode root)
        {
            foreach (XmlNode procedureNode in root.ChildNodes)
            {
                PDProcedure procedure = new PDProcedure();
                procedure.Model   = m;
                procedure.Package = package;
                procedure.ID      = procedureNode.Attributes["Id"].Value;

                foreach (XmlNode node in procedureNode.ChildNodes)
                {
                    switch (node.Name)
                    {
                    case "a:Name":
                        procedure.Name = node.InnerText;
                        break;

                    case "a:Code":
                        procedure.Code = node.InnerText;
                        break;

                    case "a:Comment":
                        procedure.Comment = node.InnerText;
                        break;

                    default:
                        break;
                    }
                }//end parse procedure

                if (package == null)
                {
                    m.AddProcedure(procedure);
                }
                else
                {
                    package.AddProcedure(procedure);
                }
            }//end parse procedures
        }
Beispiel #10
0
        void ParseViews(PDModel m, PDPackage package, XmlNode root)
        {
            foreach (XmlNode viewNode in root.ChildNodes)
            {
                PDView view = new PDView();
                view.Model   = m;
                view.Package = package;
                view.ID      = viewNode.Attributes["Id"].Value;

                foreach (XmlNode node in viewNode.ChildNodes)
                {
                    switch (node.Name)
                    {
                    case "a:Name":
                        view.Name = node.InnerText;
                        break;

                    case "a:Code":
                        view.Code = node.InnerText;
                        break;

                    case "a:Comment":
                        view.Comment = node.InnerText;
                        break;

                    default:
                        break;
                    }
                }//end parse view

                if (package == null)
                {
                    m.AddView(view);
                }
                else
                {
                    package.AddView(view);
                }
            }//end parse views
        }
Beispiel #11
0
        void ParseKeys(PDModel m, PDPackage package, PDTable table, XmlNode root)
        {
            foreach (XmlNode keyNode in root.ChildNodes)
            {
                PDKey key = new PDKey();
                key.Model   = m;
                key.Package = package;
                key.Table   = table;
                key.ID      = keyNode.Attributes["Id"].Value;

                foreach (XmlNode node in keyNode.ChildNodes)
                {
                    switch (node.Name)
                    {
                    case "a:Name":
                        key.Name = node.InnerText;
                        break;

                    case "a:Code":
                        key.Code = node.InnerText;
                        break;

                    case "a:Comment":
                        key.Comment = node.InnerText;
                        break;

                    case "c:Key.Columns":
                        key.ColumnIDList = ParseKeyColumnIDs(node.ChildNodes);
                        break;

                    default:
                        break;
                    }
                }//end parse key

                table.AddKey(key);
            }//end parse keys
        }
Beispiel #12
0
        void ParseProcedures(PDModel m, PDPackage package, XmlNode root)
        {
            foreach (XmlNode procedureNode in root.ChildNodes)
            {
                PDProcedure procedure = new PDProcedure();
                procedure.Model = m;
                procedure.Package = package;
                procedure.ID = procedureNode.Attributes["Id"].Value;

                foreach (XmlNode node in procedureNode.ChildNodes)
                {
                    switch (node.Name)
                    {
                        case "a:Name":
                            procedure.Name = node.InnerText;
                            break;
                        case "a:Code":
                            procedure.Code = node.InnerText;
                            break;
                        case "a:Comment":
                            procedure.Comment = node.InnerText;
                            break;
                        default:
                            break;
                    }
                }//end parse procedure

                if (package == null)
                {
                    m.AddProcedure(procedure);
                }
                else
                {
                    package.AddProcedure(procedure);
                }
            }//end parse procedures
        }
Beispiel #13
0
        void ParseViews(PDModel m, PDPackage package, XmlNode root)
        {
            foreach (XmlNode viewNode in root.ChildNodes)
            {
                PDView view = new PDView();
                view.Model = m;
                view.Package = package;
                view.ID = viewNode.Attributes["Id"].Value;

                foreach (XmlNode node in viewNode.ChildNodes)
                {
                    switch (node.Name)
                    {
                        case "a:Name":
                            view.Name = node.InnerText;
                            break;
                        case "a:Code":
                            view.Code = node.InnerText;
                            break;
                        case "a:Comment":
                            view.Comment = node.InnerText;
                            break;
                        default:
                            break;
                    }
                }//end parse view

                if (package == null)
                {
                    m.AddView(view);
                }
                else
                {
                    package.AddView(view);
                }
            }//end parse views
        }
Beispiel #14
0
        void ParsePackages(PDModel m, PDPackage parent, XmlNode root)
        {
            foreach (XmlNode packageNode in root.ChildNodes)
            {
                PDPackage package = new PDPackage();
                package.Model  = m;
                package.Parent = parent;
                package.ID     = packageNode.Attributes["Id"].Value;

                foreach (XmlNode node in packageNode.ChildNodes)
                {
                    switch (node.Name)
                    {
                    case "a:Name":
                        package.Name = node.InnerText;
                        break;

                    case "a:Code":
                        package.Code = node.InnerText;
                        break;

                    case "a:Comment":
                        package.Comment = node.InnerText;
                        break;

                    case "c:Packages":
                        ParsePackages(m, package, node);
                        break;

                    case "c:Tables":
                        ParseTables(m, package, node);
                        break;

                    case "c:Views":
                        ParseViews(m, package, node);
                        break;

                    case "c:Procedures":
                        ParseProcedures(m, package, node);
                        break;

                    case "c:References":
                        ParseReferences(m, package, node);
                        break;

                    default:
                        package.AddUnparsedNode(node);
                        break;
                    }
                }//end parse package

                if (parent == null)
                {
                    m.AddPackage(package);
                }
                else
                {
                    parent.AddPackage(package);
                }
            }//end parse packages
        }
Beispiel #15
0
        void ParseIndexes(PDModel m, PDPackage package, PDTable table, XmlNode root)
        {
            foreach (XmlNode indexNode in root.ChildNodes)
            {
                PDIndex index = new PDIndex();
                index.Model = m;
                index.Package = package;
                index.Table = table;
                index.ID = indexNode.Attributes["Id"].Value;

                foreach (XmlNode node in indexNode.ChildNodes)
                {
                    switch (node.Name)
                    {
                        case "a:Name":
                            index.Name = node.InnerText;
                            break;
                        case "a:Code":
                            index.Code = node.InnerText;
                            break;
                        case "a:Comment":
                            index.Comment = node.InnerText;
                            break;
                        case "a:Unique":
                            index.Unique = node.InnerText == "1" ? true : false;
                            break;
                        case "c:IndexColumns":
                            index.ColumnIDList = ParseIndexColumnIDs(node.ChildNodes);
                            break;
                        default:
                            break;
                    }
                }//end parse index

                table.AddIndex(index);
            }//end parse indexes
        }
Beispiel #16
0
        void ParseKeys(PDModel m, PDPackage package, PDTable table, XmlNode root)
        {
            foreach (XmlNode keyNode in root.ChildNodes)
            {
                PDKey key = new PDKey();
                key.Model = m;
                key.Package = package;
                key.Table = table;
                key.ID = keyNode.Attributes["Id"].Value;

                foreach (XmlNode node in keyNode.ChildNodes)
                {
                    switch (node.Name)
                    {
                        case "a:Name":
                            key.Name = node.InnerText;
                            break;
                        case "a:Code":
                            key.Code = node.InnerText;
                            break;
                        case "a:Comment":
                            key.Comment = node.InnerText;
                            break;
                        case "c:Key.Columns":
                            key.ColumnIDList = ParseKeyColumnIDs(node.ChildNodes);
                            break;
                        default:
                            break;
                    }
                }//end parse key

                table.AddKey(key);
            }//end parse keys
        }
Beispiel #17
0
        void ParseColumns(PDModel m, PDPackage package,PDTable table,XmlNode root)
        {
            foreach (XmlNode columnNode in root.ChildNodes)
            {
                PDColumn column = new PDColumn();
                column.Model = m;
                column.Package = package;
                column.Table = table;
                column.ID = columnNode.Attributes["Id"].Value;

                foreach (XmlNode node in columnNode.ChildNodes)
                {
                    switch (node.Name)
                    {
                        case "a:Name":
                            column.Name = node.InnerText;
                            break;
                        case "a:Code":
                            column.Code = node.InnerText;
                            break;
                        case "a:Comment":
                            column.Comment = node.InnerText;
                            break;
                        case "a:DataType":
                            column.DataType = node.InnerText;
                            break;
                        case "a:Length":
                            column.Length = ConvertUtil.ToInt32(node.InnerText, 0);
                            break;
                        case "a:Precision":
                            column.Precision = ConvertUtil.ToInt32(node.InnerText, 0);
                            break;
                        case "a:Mandatory":
                            column.Mandatory = node.InnerText == "1" ? true : false;
                            break;
                        case "a:DefaultValue":
                            column.DefaultValue = node.InnerText;
                            break;
                        case "a:Identity":
                            column.Identity = node.InnerText == "1";
                            break;
                        default:
                            column.AddUnparsedNode(node);
                            break;
                    }
                }//end parse column

                table.AddColumn(column);
            }//end parse columns
        }
Beispiel #18
0
        void ParseUsers(PDModel m, XmlNode root)
        {
            foreach (XmlNode userNode in root.ChildNodes)
            {
                PDUser user = new PDUser();
                user.Model = m;
                user.ID = userNode.Attributes["Id"].Value;

                foreach (XmlNode node in userNode.ChildNodes)
                {
                    switch (node.Name)
                    {
                        case "a:Name":
                            user.Name = node.InnerText;
                            break;
                        case "a:Code":
                            user.Code = node.InnerText;
                            break;
                        case "a:Comment":
                            user.Comment = node.InnerText;
                            break;
                        default:
                            user.AddUnparsedNode(node);
                            break;
                    }
                }//end parse user

                m.AddUser(user);
            }//end parse users
        }
Beispiel #19
0
        void ParsePackages(PDModel m,PDPackage parent, XmlNode root)
        {
            foreach (XmlNode packageNode in root.ChildNodes)
            {
                PDPackage package = new PDPackage();
                package.Model = m;
                package.Parent = parent;
                package.ID = packageNode.Attributes["Id"].Value;

                foreach (XmlNode node in packageNode.ChildNodes)
                {
                    switch (node.Name)
                    {
                        case "a:Name":
                            package.Name = node.InnerText;
                            break;
                        case "a:Code":
                            package.Code = node.InnerText;
                            break;
                        case "a:Comment":
                            package.Comment = node.InnerText;
                            break;
                        case "c:Packages":
                            ParsePackages(m, package, node);
                            break;
                        case "c:Tables":
                            ParseTables(m, package, node);
                            break;
                        case "c:Views":
                            ParseViews(m, package, node);
                            break;
                        case "c:Procedures":
                            ParseProcedures(m, package, node);
                            break;
                        case "c:References":
                            ParseReferences(m, package, node);
                            break;
                        default:
                            package.AddUnparsedNode(node);
                            break;
                    }
                }//end parse package

                if (parent == null)
                {
                    m.AddPackage(package);
                }
                else
                {
                    parent.AddPackage(package);
                }
            }//end parse packages
        }
Beispiel #20
0
        void ParseTables(PDModel m, PDPackage package, XmlNode root)
        {
            foreach (XmlNode tableNode in root.ChildNodes)
            {
                PDTable table = new PDTable();
                table.Model   = m;
                table.Package = package;
                table.ID      = tableNode.Attributes["Id"].Value;

                foreach (XmlNode node in tableNode.ChildNodes)
                {
                    switch (node.Name)
                    {
                    case "a:Name":
                        table.Name = node.InnerText;
                        break;

                    case "a:Code":
                        table.Code = node.InnerText;
                        break;

                    case "a:Comment":
                        table.Comment = node.InnerText;
                        break;

                    case "c:Owner":
                        table.UserID = node["o:User"].Attributes["Ref"].Value;
                        break;

                    case "c:PrimaryKey":
                        table.PrimaryKeyID = node["o:Key"].Attributes["Ref"].Value;
                        break;

                    case "c:ClusterObject":
                        table.ClusterObjectID = node.FirstChild.Attributes["Ref"].Value;
                        break;

                    case "c:Columns":
                        ParseColumns(m, package, table, node);
                        break;

                    case "c:Keys":
                        ParseKeys(m, package, table, node);
                        break;

                    case "c:Indexes":
                        ParseIndexes(m, package, table, node);
                        break;

                    default:
                        table.AddUnparsedNode(node);
                        break;
                    }
                }//end parse table

                if (package == null)
                {
                    m.AddTable(table);
                }
                else
                {
                    package.AddTable(table);
                }
            }//end parse tables
        }
Beispiel #21
0
        /// <summary>
        /// 解析并生成模型实例
        /// </summary>
        /// <returns></returns>
        public PDModel BuildModel()
        {
            PDModel m = new PDModel();

            XmlElement docElement = doc.DocumentElement;
            XmlNode    root       = docElement.FirstChild.FirstChild.FirstChild;

            if (root == null)
            {
                return(null);
            }

            m.ID = root.Attributes["Id"].Value;
            foreach (XmlNode node in root.ChildNodes)
            {
                switch (node.Name)
                {
                case "a:Name":
                    m.Name = node.InnerText;
                    break;

                case "a:Code":
                    m.Code = node.InnerText;
                    break;

                case "a:Comment":
                    m.Comment = node.InnerText;
                    break;

                case "c:DBMS":
                    ParseDbms(m, node);
                    break;

                case "c:Packages":
                    ParsePackages(m, null, node);
                    break;

                case "c:Users":
                    ParseUsers(m, node);
                    break;

                case "c:Domains":
                    break;

                case "c:Tables":
                    ParseTables(m, null, node);
                    break;

                case "c:Views":
                    ParseViews(m, null, node);
                    break;

                case "c:Procedures":
                    ParseProcedures(m, null, node);
                    break;

                case "c:References":
                    ParseReferences(m, null, node);
                    break;

                default:
                    m.AddUnparsedNode(node);
                    break;
                }
            }

            return(m);
        }
Beispiel #22
0
        void ParseReferences(PDModel m, PDPackage package, XmlNode root)
        {
            foreach (XmlNode referenceNode in root.ChildNodes)
            {
                PDReference reference = new PDReference();
                reference.Model   = m;
                reference.Package = package;
                reference.ID      = referenceNode.Attributes["Id"].Value;

                foreach (XmlNode node in referenceNode.ChildNodes)
                {
                    switch (node.Name)
                    {
                    case "a:Name":
                        reference.Name = node.InnerText;
                        break;

                    case "a:Code":
                        reference.Code = node.InnerText;
                        break;

                    case "a:Comment":
                        reference.Comment = node.InnerText;
                        break;

                    case "a:Cardinality":
                        reference.Cardinality = node.InnerText;
                        break;

                    case "a:UpdateConstraint":
                        reference.UpdateConstraint = node.InnerText == "1" ? true : false;
                        break;

                    case "a:DeleteConstraint":
                        reference.DeleteConstraint = node.InnerText == "1" ? true : false;
                        break;

                    case "c:ParentTable":
                        reference.ParentTableID = node.FirstChild.Attributes["Ref"].Value;
                        break;

                    case "c:ChildTable":
                        reference.ChildTableID = node.FirstChild.Attributes["Ref"].Value;
                        break;

                    case "c:ParentKey":
                        reference.ParentKeyID = node.FirstChild.Attributes["Ref"].Value;
                        break;

                    case "c:Joins":
                        reference.JoinList = ParseJoins(node.ChildNodes);
                        break;

                    default:
                        break;
                    }
                }//end parse reference

                if (package == null)
                {
                    m.AddReference(reference);
                }
                else
                {
                    package.AddReference(reference);
                }
            }//end parse references
        }
Beispiel #23
0
        void ParseReferences(PDModel m, PDPackage package, XmlNode root)
        {
            foreach (XmlNode referenceNode in root.ChildNodes)
            {
                PDReference reference = new PDReference();
                reference.Model = m;
                reference.Package = package;
                reference.ID = referenceNode.Attributes["Id"].Value;

                foreach (XmlNode node in referenceNode.ChildNodes)
                {
                    switch (node.Name)
                    {
                        case "a:Name":
                            reference.Name = node.InnerText;
                            break;
                        case "a:Code":
                            reference.Code = node.InnerText;
                            break;
                        case "a:Comment":
                            reference.Comment = node.InnerText;
                            break;
                        case "a:Cardinality":
                            reference.Cardinality = node.InnerText;
                            break;
                        case "a:UpdateConstraint":
                            reference.UpdateConstraint = node.InnerText == "1" ? true : false;
                            break;
                        case "a:DeleteConstraint":
                            reference.DeleteConstraint = node.InnerText == "1" ? true : false;
                            break;
                        case "c:ParentTable":
                            reference.ParentTableID = node.FirstChild.Attributes["Ref"].Value;
                            break;
                        case "c:ChildTable":
                            reference.ChildTableID = node.FirstChild.Attributes["Ref"].Value;
                            break;
                        case "c:ParentKey":
                            reference.ParentKeyID = node.FirstChild.Attributes["Ref"].Value;
                            break;
                        case "c:Joins":
                            reference.JoinList = ParseJoins(node.ChildNodes);
                            break;
                        default:
                            break;
                    }
                }//end parse reference

                if (package == null)
                {
                    m.AddReference(reference);
                }
                else
                {
                    package.AddReference(reference);
                }
            }//end parse references
        }
Beispiel #24
0
        void ParseDbms(PDModel m, XmlNode root)
        {
            PDDbms dbms = new PDDbms();
            XmlNode shortcutNode = root.FirstChild;

            dbms.Model = m;
            dbms.ID = shortcutNode.Attributes["Id"].Value;

            foreach (XmlNode node in shortcutNode.ChildNodes)
            {
                switch (node.Name)
                {
                    case "a:Name":
                        dbms.Name = node.InnerText;
                        break;
                    case "a:Code":
                        dbms.Code = node.InnerText;
                        break;
                    case "a:Comment":
                        dbms.Comment = node.InnerText;
                        break;
                    default:
                        dbms.AddUnparsedNode(node);
                        break;
                }
            }

            m.DBMS = dbms;
        }
Beispiel #25
0
        void ParseTables(PDModel m, PDPackage package, XmlNode root)
        {
            foreach (XmlNode tableNode in root.ChildNodes)
            {
                PDTable table = new PDTable();
                table.Model = m;
                table.Package = package;
                table.ID = tableNode.Attributes["Id"].Value;

                foreach (XmlNode node in tableNode.ChildNodes)
                {
                    switch (node.Name)
                    {
                        case "a:Name":
                            table.Name = node.InnerText;
                            break;
                        case "a:Code":
                            table.Code = node.InnerText;
                            break;
                        case "a:Comment":
                            table.Comment = node.InnerText;
                            break;
                        case "c:Owner":
                            table.UserID = node["o:User"].Attributes["Ref"].Value;
                            break;
                        case "c:PrimaryKey":
                            table.PrimaryKeyID = node["o:Key"].Attributes["Ref"].Value;
                            break;
                        case "c:ClusterObject":
                            table.ClusterObjectID = node.FirstChild.Attributes["Ref"].Value;
                            break;
                        case "c:Columns":
                            ParseColumns(m, package, table, node);
                            break;
                        case "c:Keys":
                            ParseKeys(m, package, table, node);
                            break;
                        case "c:Indexes":
                            ParseIndexes(m, package, table, node);
                            break;
                        default:
                            table.AddUnparsedNode(node);
                            break;
                    }
                }//end parse table

                if (package == null)
                {
                    m.AddTable(table);
                }
                else
                {
                    package.AddTable(table);
                }
            }//end parse tables
        }