private TreeViewItem GetParentItemFromChild(TreeViewItem item, OrgTreeItemTypes parentType, string parentID) { TreeViewItem tmpItem = null; ExtOrgObj obj = item.DataContext as ExtOrgObj; if (obj != null && item.Tag != null && item.Tag.ToString() == parentType.ToString()) { switch (parentType) { case OrgTreeItemTypes.Company: T_HR_COMPANY tmpOrg = obj.ObjectInstance as T_HR_COMPANY; if (tmpOrg != null) { if (tmpOrg.COMPANYID == parentID) { return(item); } } break; case OrgTreeItemTypes.Department: T_HR_DEPARTMENT tmpDep = obj.ObjectInstance as T_HR_DEPARTMENT; if (tmpDep != null) { if (tmpDep.DEPARTMENTID == parentID) { return(item); } } break; } } if (item.Items != null && item.Items.Count > 0) { foreach (TreeViewItem childitem in item.Items) { tmpItem = GetParentItemFromChild(childitem, parentType, parentID); if (tmpItem != null) { break; } } } return(tmpItem); }
private TreeViewItem GetParentItemFromChild(TreeViewItem item, OrgTreeItemTypes parentType, string parentID) { TreeViewItem tmpItem = null; if (item.Tag != null && item.Tag.ToString() == parentType.ToString()) { switch (parentType) { case OrgTreeItemTypes.Company: SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY tmpOrg = item.DataContext as SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY; if (tmpOrg != null) { if (tmpOrg.COMPANYID == parentID) { return(item); } } break; case OrgTreeItemTypes.Department: SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT tmpDep = item.DataContext as SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT; if (tmpDep != null) { if (tmpDep.DEPARTMENTID == parentID) { return(item); } } break; } } if (item.Items != null && item.Items.Count > 0) { foreach (TreeViewItem childitem in item.Items) { tmpItem = GetParentItemFromChild(childitem, parentType, parentID); if (tmpItem != null) { break; } } } return(tmpItem); }
private TreeViewItem GetParentItemFromChild(TreeViewItem item, OrgTreeItemTypes parentType, string parentID) { TreeViewItem tmpItem = null; ExtOrgObj obj = item.DataContext as ExtOrgObj; if (obj != null && item.Tag != null && item.Tag.ToString() == parentType.ToString()) { switch (parentType) { case OrgTreeItemTypes.Company: T_HR_COMPANY tmpOrg = obj.ObjectInstance as T_HR_COMPANY; if (tmpOrg != null) { if (tmpOrg.COMPANYID == parentID) return item; } break; case OrgTreeItemTypes.Department: T_HR_DEPARTMENT tmpDep = obj.ObjectInstance as T_HR_DEPARTMENT; if (tmpDep != null) { if (tmpDep.DEPARTMENTID == parentID) return item; } break; } } if (item.Items != null && item.Items.Count > 0) { foreach (TreeViewItem childitem in item.Items) { tmpItem = GetParentItemFromChild(childitem, parentType, parentID); if (tmpItem != null) { break; } } } return tmpItem; }
private TreeViewItem GetParentItemFromChild(TreeViewItem item, OrgTreeItemTypes parentType, string parentID) { TreeViewItem tmpItem = null; if (item.Tag != null && item.Tag.ToString() == parentType.ToString()) { switch (parentType) { case OrgTreeItemTypes.Company: SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY tmpOrg = item.DataContext as SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY; if (tmpOrg != null) { if (tmpOrg.COMPANYID == parentID) return item; } break; case OrgTreeItemTypes.Department: SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT tmpDep = item.DataContext as SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT; if (tmpDep != null) { if (tmpDep.DEPARTMENTID == parentID) return item; } break; } } if (item.Items != null && item.Items.Count > 0) { foreach (TreeViewItem childitem in item.Items) { tmpItem = GetParentItemFromChild(childitem, parentType, parentID); if (tmpItem != null) { break; } } } return tmpItem; }