/// <summary>
        /// 从配置设置构建Xml
        /// </summary>
        /// <param name="xmlDoc"></param>
        /// <param name="root"></param>
        /// <returns></returns>
        private SettingNode BuildXmlFromTreeNode(IJsonTreeNode root)
        {
            //创建对象
            SettingNode xml = new SettingNode(root.JsonNodeName);

            //写属性
            xml.SetAttribute(DbEntityAttributeName, root.DbName);
            xml.SetAttribute(DbTableMultiRelated, root.MultiRelated.ToString());
            xml.SetAttribute(DbDisplayName, root.DisplayName);
            xml.SetAttribute(BuildJsonFile, root.BuildSingleFile.ToString());
            xml.SetAttribute(NodeSelectable, root.Selectable.ToString());
            xml.SetAttribute(DbCustomizedSql, root.Sql.CustomizeSQLString);
            xml.SetAttribute(DbCustomizedSqlParameters, root.Sql.Params.ToString());
            xml.SetAttribute(IsVirtual, root.IsSelectionParameter.ToString());

            //先写实节点
            foreach (String key in root.ChildNodes.Keys)
            {
                if (root.ChildNodes[key].IsDBColumn)
                {
                    xml.AppendChild(BuildXmlFromTreeNode(root.ChildNodes[key]));
                }
            }
            //虚结点做右子节点
            foreach (String key in root.ChildNodes.Keys)
            {
                if (!root.ChildNodes[key].IsDBColumn)
                {
                    xml.AppendChild(BuildXmlFromTreeNode(root.ChildNodes[key]));
                }
            }
            return(xml);
        }
        public override void Update()
        {
            SettingNode root = new SettingNode(RootNodeName);

            root.SetAttribute(DbBaseTableConnectString, DBConnectArgs);

            SettingNode exportTree = new SettingNode(ExportRootNodeName);

            exportTree.SetAttribute(DbBaseTableConnectString, exportEntities.DbConnectStr);

            SettingNode importTree = new SettingNode(ImportRootNodeName);

            importTree.SetAttribute(DbBaseTableConnectString, importEntities.DbConnectStr);

            SettingNode userTable = new SettingNode(UserNodeName);

            userTable.SetAttribute(DbBaseTableConnectString, userRoot.DbConnectStr);
            userTable.SetAttribute(UserNameAttrition, userRoot.UserName);
            userTable.SetAttribute(PasswordAttrition, userRoot.Password);
            userTable.SetAttribute(UserTableName, userRoot.TableName);


            foreach (IJsonTreeNode n in exportEntities.roots)
            {
                exportTree.AppendChild(BuildXmlFromTreeNode(n));
            }

            foreach (IJsonTreeNode n in importEntities.roots)
            {
                importTree.AppendChild(BuildXmlFromTreeNode(n));
            }

            root.AppendChild(exportTree);
            root.AppendChild(importTree);
            root.AppendChild(userTable);

            SaveSettingXML(SettingFolder, SettingFile, root);
        }
Beispiel #3
0
        public override void Update()
        {
            SettingNode root = new SettingNode(Xml_SettingRootName);

            root.SetAttribute(Xml_ActiveUserNodeName, ActiveUser);
            root.SetAttribute(Xml_ExportFolder, exportworkFolder);
            root.SetAttribute(Xml_SimpleMode, SimpleMode.ToString());

            SettingNode window = new SettingNode(Xml_WindowSettingRoot);

            window.SetAttribute(Xml_WindowLocX, WindowLeft.ToString());
            window.SetAttribute(Xml_WindowLocY, WindowTop.ToString());
            window.SetAttribute(Xml_WindowWidth, WindowWidth.ToString());
            window.SetAttribute(Xml_WindowHeight, WindowHeight.ToString());
            window.SetAttribute(Xml_APPName, AppName);

            root.AppendChild(window);

            SaveSettingXML(SettingFile, root);
        }