void perclient_GetEmployeePostByPostIDCompleted(object sender, PersonnelWS.GetEmployeePostByPostIDCompletedEventArgs e) { try { List<PersonnelWS.T_HR_EMPLOYEEPOST> eplist = new List<PersonnelWS.T_HR_EMPLOYEEPOST>(); if (e.Result != null) { eplist = e.Result.ToList(); } TreeViewItem parentItem = e.UserState as TreeViewItem; if (eplist == null || eplist.Count == 0 || parentItem == null) { loadbar.Stop(); return; } parentItem.Items.Clear(); string postID = string.Empty; foreach (PersonnelWS.T_HR_EMPLOYEEPOST ep in eplist) { TreeViewItem subItem = new TreeViewItem(); subItem.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; subItem.Header = ep.T_HR_EMPLOYEE.EMPLOYEECNAME; ExtOrgObj obj = new ExtOrgObj(); obj.ObjectInstance = ep.T_HR_EMPLOYEE; subItem.DataContext = obj; //设置父级对像 obj.ParentObject = parentItem.DataContext; #region ExtOrgObj post = (ExtOrgObj)obj.ParentObject; string postName = post.ObjectName; // fromPostLevel=(post as SMT.Saas.Tools.OrganizationWS.T_HR_POST).POSTLEVEL.ToString(); if (string.IsNullOrEmpty(postID)) { postID = post.ObjectID; } ExtOrgObj dept = (ExtOrgObj)post.ParentObject; string deptName = dept.ObjectName; // ExtOrgObj corp = (ExtOrgObj)dept.ParentObject; SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY corp = (dept.ObjectInstance as SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT).T_HR_COMPANY; string corpName = corp.CNAME; obj.ObjectName = ep.T_HR_EMPLOYEE.EMPLOYEECNAME + "-" + postName + "-" + deptName + "-" + corpName; #endregion //标记为岗位 subItem.Tag = OrgTreeItemTypes.Personnel; subItem.HeaderTemplate = treeViewItemTemplate; parentItem.Items.Add(subItem); } postIDsCach.Add(postID, "1"); } catch (Exception ex) { } loadbar.Stop(); }
/// <summary> /// 获取离职员工 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void clientPers_GetLeaveEmployeeViewsPagingCompleted(object sender, PersonnelWS.GetLeaveEmployeeViewsPagingCompletedEventArgs e) { loadbar.Stop(); if (e.Error == null) { dgEmployeeList.ItemsSource = e.Result; } }
void perclient_GetEmployeePostByPostIDCompleted(object sender, PersonnelWS.GetEmployeePostByPostIDCompletedEventArgs e) { List<PersonnelWS.T_HR_EMPLOYEEPOST> eplist = new List<PersonnelWS.T_HR_EMPLOYEEPOST>(); if (e.Result != null) { eplist = e.Result.ToList(); } TreeViewItem parentItem = e.UserState as TreeViewItem; if (eplist == null || eplist.Count == 0 || parentItem == null) return; parentItem.Items.Clear(); foreach (PersonnelWS.T_HR_EMPLOYEEPOST ep in eplist) { TreeViewItem subItem = new TreeViewItem(); subItem.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; subItem.Header = ep.T_HR_EMPLOYEE.EMPLOYEECNAME; ExtOrgObj obj = new ExtOrgObj(); obj.ObjectInstance = ep.T_HR_EMPLOYEE; subItem.DataContext = obj; //设置父级对像 obj.ParentObject = parentItem.DataContext; //标记为岗位 subItem.Tag = OrgTreeItemTypes.Personnel; subItem.HeaderTemplate = treeViewItemTemplate; parentItem.Items.Add(subItem); } }