示例#1
0
        private void ShowTree()
        {
            var ds = new CompanyDataSet();
            var cda = new linqToDataSet.CompanyDataSetTableAdapters.CompanyTableAdapter();
            cda.Fill(ds.Company);

            var tvCompanyItem = new TreeViewItem
            {
                Header = ds.Company.FirstOrDefault().Name
            };
            this.treeCompany.Items.Add(tvCompanyItem);

            var dda = new linqToDataSet.CompanyDataSetTableAdapters.DepartmentTableAdapter();
            dda.Fill(ds.Department);

            var eda = new linqToDataSet.CompanyDataSetTableAdapters.EmployeeTableAdapter();
            eda.Fill(ds.Employee);

            var pda = new linqToDataSet.CompanyDataSetTableAdapters.PersonTableAdapter();
            pda.Fill(ds.Person);

            foreach (var dept in ds.Department.Where(d=>d.Isparent_idNull()))
            {
                var tv = new TreeViewItem
                {
                    Header = dept.Name,
                    Tag = new DepartmentDetailsPage(dept.department_id)
                };
                tvCompanyItem.Items.Add(tv);
                GetSubTree(ref tv, dept);
            }
        }
示例#2
0
        private void ShowTree()
        {
            var ds  = new CompanyDataSet();
            var cda = new linqToDataSet.CompanyDataSetTableAdapters.CompanyTableAdapter();

            cda.Fill(ds.Company);

            var tvCompanyItem = new TreeViewItem
            {
                Header = ds.Company.FirstOrDefault().Name
            };

            this.treeCompany.Items.Add(tvCompanyItem);

            var dda = new linqToDataSet.CompanyDataSetTableAdapters.DepartmentTableAdapter();

            dda.Fill(ds.Department);

            var eda = new linqToDataSet.CompanyDataSetTableAdapters.EmployeeTableAdapter();

            eda.Fill(ds.Employee);

            var pda = new linqToDataSet.CompanyDataSetTableAdapters.PersonTableAdapter();

            pda.Fill(ds.Person);

            foreach (var dept in ds.Department.Where(d => d.Isparent_idNull()))
            {
                var tv = new TreeViewItem
                {
                    Header = dept.Name,
                    Tag    = new DepartmentDetailsPage(dept.department_id)
                };
                tvCompanyItem.Items.Add(tv);
                GetSubTree(ref tv, dept);
            }
        }