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); } }
private void PageLoaded(object sender, RoutedEventArgs e) { var dda = new linqToDataSet.CompanyDataSetTableAdapters.DepartmentTableAdapter(); var ds = new CompanyDataSet(); dda.FillBy(ds.Department, _departmentId); var eda = new linqToDataSet.CompanyDataSetTableAdapters.EmployeeTableAdapter(); eda.Fill(ds.Employee); var manager = ds.Employee.Where(emp => (emp.department_id == _departmentId) && emp.IsManager).Single(); var pda = new linqToDataSet.CompanyDataSetTableAdapters.PersonTableAdapter(); pda.FillBy(ds.Person, manager.person_id); var dept = ds.Department.Where(d => d.department_id == _departmentId).Single(); WindowsTitle = dept.Name; Total = Features.SubTotalForDept(_departmentId); DataContext = new { Name = manager.PersonRow.Name }; }
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); } }