Beispiel #1
0
        private void BindlistViewTab(string Dbname, string treeNodeSelectedType)
        {
            // SetListViewMenu("table");

            this.listView1.Columns.Clear();
            this.listView1.Items.Clear();
            this.listView1.LargeImageList = imglistView;
            this.listView1.SmallImageList = imglistView;
            this.listView1.View           = View.Details;
            this.listView1.FullRowSelect  = true;
            listView1.Columns.Add("名称", 250, HorizontalAlignment.Left);
            listView1.Columns.Add("所有者", 100, HorizontalAlignment.Left);
            listView1.Columns.Add("类型", 60, HorizontalAlignment.Left);
            listView1.Columns.Add("创建日期", 200, HorizontalAlignment.Left);

            List <TableInfo> tablist = null;

            switch (treeNodeSelectedType)
            {
            case "db":
                tablist = dbObject.GetTabViewsInfo(Dbname);
                break;

            case "tableroot":
                tablist = dbObject.GetTablesInfo(Dbname);
                break;

            case "viewroot":
                tablist = dbObject.GetVIEWsInfo(Dbname);
                break;

            case "procroot":
                tablist = dbObject.GetProcInfo(Dbname);
                break;
            }

            if ((tablist != null) && (tablist.Count > 0))
            {
                foreach (var tab in tablist)
                {
                    var name  = tab.TabName;
                    var item1 = new ListViewItem(name, 0);

                    var user = tab.TabUser;
                    item1.SubItems.Add(user);

                    var type = tab.TabType;
                    switch (type.Trim())
                    {
                    case "S":
                        type = "系统";
                        break;

                    case "U":
                        type             = "用户";
                        item1.ImageIndex = 2;
                        break;

                    case "TABLE":
                        type             = "表";
                        item1.ImageIndex = 2;
                        break;

                    case "V":
                    case "VIEW":
                        type             = "视图";
                        item1.ImageIndex = 3;
                        break;

                    case "P":
                        type             = "存储过程";
                        item1.ImageIndex = 5;
                        break;

                    default:
                        type = "系统";
                        break;
                    }
                    item1.SubItems.Add(type);
                    var time = tab.TabDate;
                    item1.SubItems.Add(time);
                    listView1.Items.AddRange(new ListViewItem[] { item1 });
                }
            }
        }