/// <summary> /// 绑定岗位 /// </summary> public void BindPosition() { //loadbar.Stop(); if (allPositions != null) { foreach (SMT.Saas.Tools.OrganizationWS.T_HR_POST tmpPosition in allPositions) { if (tmpPosition.T_HR_DEPARTMENT == null || string.IsNullOrEmpty(tmpPosition.T_HR_DEPARTMENT.DEPARTMENTID)) { continue; } TreeViewItem parentItem = GetParentItem(OrgTreeItemTypes.Department, tmpPosition.T_HR_DEPARTMENT.DEPARTMENTID); if (parentItem != null) { TreeViewItem item = new TreeViewItem(); item.Header = tmpPosition.T_HR_POSTDICTIONARY.POSTNAME; item.DataContext = tmpPosition; item.HeaderTemplate = Application.Current.Resources["PositionItemStyle"] as DataTemplate; item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; //状态在未生效和撤消中时背景色为红色 SolidColorBrush brush = new SolidColorBrush(); if (tmpPosition.CHECKSTATE != ((int)CheckStates.Approved).ToString()) { brush.Color = Colors.Red; item.Foreground = brush; } else { brush.Color = Colors.Black; item.Foreground = brush; } //标记为岗位 item.Tag = OrgTreeItemTypes.Post; parentItem.Items.Add(item); } } } if (BindOrgTreeCompleted != null) { BingdOrgTreeArg bindArg = new BingdOrgTreeArg(); bindArg.treeOrganization = treeOrganization; this.BindOrgTreeCompleted(this, bindArg); } //树全部展开 // treeOrganization.ExpandAll(); //if (treeOrganization.Items.Count > 0) //{ // TreeViewItem selectedItem = treeOrganization.Items[0] as TreeViewItem; // selectedItem.IsSelected = true; //} }
/// <summary> /// 绑定岗位 /// </summary> public void BindPosition() { //loadbar.Stop(); if (allPositions != null) { foreach (SMT.Saas.Tools.OrganizationWS.T_HR_POST tmpPosition in allPositions) { if (tmpPosition.T_HR_DEPARTMENT == null || string.IsNullOrEmpty(tmpPosition.T_HR_DEPARTMENT.DEPARTMENTID)) continue; TreeViewItem parentItem = GetParentItem(OrgTreeItemTypes.Department, tmpPosition.T_HR_DEPARTMENT.DEPARTMENTID); if (parentItem != null) { TreeViewItem item = new TreeViewItem(); item.Header = tmpPosition.T_HR_POSTDICTIONARY.POSTNAME; item.DataContext = tmpPosition; item.HeaderTemplate = Application.Current.Resources["PositionItemStyle"] as DataTemplate; item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; //状态在未生效和撤消中时背景色为红色 SolidColorBrush brush = new SolidColorBrush(); if (tmpPosition.CHECKSTATE != ((int)CheckStates.Approved).ToString()) { brush.Color = Colors.Red; item.Foreground = brush; } else { brush.Color = Colors.Black; item.Foreground = brush; } //标记为岗位 item.Tag = OrgTreeItemTypes.Post; parentItem.Items.Add(item); } } } if (BindOrgTreeCompleted != null) { BingdOrgTreeArg bindArg = new BingdOrgTreeArg(); bindArg.treeOrganization = treeOrganization; this.BindOrgTreeCompleted(this, bindArg); } //树全部展开 // treeOrganization.ExpandAll(); //if (treeOrganization.Items.Count > 0) //{ // TreeViewItem selectedItem = treeOrganization.Items[0] as TreeViewItem; // selectedItem.IsSelected = true; //} }