コード例 #1
0
ファイル: DBManager.cs プロジェクト: foxbill/xbase-2018.01
        public List <DataSummary> GetDbSummarise()
        {
            List <DataSummary> summarise = new List <DataSummary>();

            DbConnection conn = db.GetConnection();

            DataTable dt = conn.GetSchema("Tables");
            DataView  dv = dt.DefaultView;

            dv.Sort = "TABLE_NAME";

            conn.Close();
            SchemaContainer <XTableSchema> xtc = XTableSchemaContainer.Instance();

            foreach (DataRowView dr in dv)
            {
                DataSummary tbSummary = new DataSummary();
                tbSummary.Name        = dr["TABLE_NAME"].ToString();
                tbSummary.Description = dr["TABLE_NAME"].ToString();
                tbSummary.Caption     = dr["TABLE_NAME"].ToString();
                tbSummary.Type        = dr["TABLE_TYPE"].ToString();

                XTableSchema ts = xtc.GetItem(tbSummary.Name);
                if (xtc.Contains(tbSummary.Name))
                {
                    tbSummary.Caption     = ts.Title;
                    tbSummary.Description = ts.Description;
                }
                summarise.Add(tbSummary);
            }
            return(summarise);
        }
コード例 #2
0
        private static void loadSubNodes(List <TreeNode> subNodes, string path, ref int id)
        {
            string[] folders = container.GetSchemaFolders(path);

            for (int i = 0; i < folders.Length; i++)
            {
                string   subFolder = folders[i];
                TreeNode node      = new TreeNode();
                node.label    = subFolder;
                node.path     = path;
                node.nodeType = (int)DsExploreNodeType.folder;
                node.id       = id + "";
                node.text     = subFolder;
                subNodes.Add(node);
                id++;
                loadSubNodes(node.children, path + "\\" + subFolder, ref id);
            }
            string[] dataSources = container.GetIDsByFolder(path);
            for (int i = 0; i < dataSources.Count(); i++)
            {
                string           dsId = dataSources[i];
                DataSourceSchema ts   = container.GetItem(path + "\\" + dsId);
                TreeNode         node = new TreeNode();
                node.text  = ts.Title + "(" + dsId + ")";
                node.label = node.text;
                node.title = node.text;
                if (string.IsNullOrEmpty(node.label))
                {
                    node.label = dsId;
                }
                node.name     = node.text;
                node.id       = dsId;
                node.path     = path;
                node.nodeType = (int)DsExploreNodeType.dataSource;
                //node.id = id + "";
                subNodes.Add(node);
                id++;
            }
        }