void orgClient_GetDepartmentActivedCompleted(object sender, SMT.Saas.Tools.OrganizationWS.GetDepartmentActivedCompletedEventArgs e) { if (e.Error != null && e.Error.Message != "") { Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(e.Error.Message)); } else { if (e.Result == null) { return; } ObservableCollection <SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT> entTemps = e.Result; allDepartments = new List <SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT>(); allDepartments.Clear(); var ents = entTemps.OrderBy(c => c.FATHERID); ents.ForEach(item => { allDepartments.Add(item); }); UICache.CreateCache("SYS_DepartmentInfo", allDepartments); BindCompany(); orgClient.GetPostActivedAsync(SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID); } }
void orgClient_GetDepartmentActivedCompleted(object sender, SMT.Saas.Tools.OrganizationWS.GetDepartmentActivedCompletedEventArgs e) { if (e.Error != null && e.Error.Message != "") { loadbar.Stop();//有错误停止转圈 SMT.SAAS.Main.CurrentContext.AppContext.logAndShow("Views/SysUserManagement--GetDepartmentActived"); ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); return; } else { if (e.Result == null) { return; } ObservableCollection <SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT> entTemps = e.Result; allDepartments = new List <SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT>(); allDepartments.Clear(); var ents = entTemps.OrderBy(c => c.FATHERID); ents.ForEach(item => { allDepartments.Add(item); }); UICache.CreateCache("SYS_DepartmentInfo", allDepartments); BindCompany(); orgClient.GetPostActivedAsync(SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID); } }
void client_GetDepartmentActivedCompleted(object sender, GetDepartmentActivedCompletedEventArgs e) { if (e.Result != null) { allDepartments = e.Result.ToList(); } BindDepartment(); client.GetPostActivedAsync(Common.CurrentLoginUserInfo.SysUserID); }
void client_GetDepartmentActivedCompleted(object sender, GetDepartmentActivedCompletedEventArgs e) { if (e.Result != null) { allDepartments = e.Result.ToList(); } BindDepartment(); if (SelectedObjType != OrgTreeItemTypes.Department) { client.GetPostActivedAsync(Common.CurrentLoginUserInfo.EmployeeID); } }
void orgClient_GetDepartmentActivedCompleted(object sender, GetDepartmentActivedCompletedEventArgs e) { if (e.Error == null) { if (e.Result != null) { allDepartments = e.Result.ToList(); } BindDepartment(); orgClient.GetPostActivedAsync(SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID); } else { Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), e.Error.Message); } }
void organClient_GetDepartmentActivedCompleted(object sender, GetDepartmentActivedCompletedEventArgs e) { if (e.Error == null) { if (e.Result != null) { App.Current.Resources.Add("SYS_DepartmentInfo", e.Result.ToList()); string strEmployeeID = string.Empty; if (CurrentContext.Common.CurrentLoginUserInfo != null) { strEmployeeID = CurrentContext.Common.CurrentLoginUserInfo.EmployeeID; } organClient.GetPostActivedAsync(strEmployeeID); } } }
void organClient_GetDepartmentActivedCompleted(object sender, GetDepartmentActivedCompletedEventArgs e) { if (e.Error == null) { if (e.Result != null) { App.Current.Resources.Add("SYS_DepartmentInfo", e.Result.ToList()); string strOwnerId = string.Empty; if (Common.CurrentLoginUserInfo != null) { strOwnerId = Common.CurrentLoginUserInfo.EmployeeID; } loadbar.setloadingMessage("获取部门信息完毕,开始获取岗位公司信息......"); organClient.GetPostActivedAsync(strOwnerId); } } }
private void BindCompany() { treeOrganization.Items.Clear(); allCompanys = Application.Current.Resources["SYS_CompanyInfo"] as List <SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY>; allDepartments = Application.Current.Resources["SYS_DepartmentInfo"] as List <SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT>; if (allCompanys == null) { return; } if (allDepartments == null) { return; } List <SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY> TopCompany = new List <SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY>(); foreach (SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY tmpOrg in allCompanys) { //如果当前公司没有父机构的ID,则为顶级公司 if (string.IsNullOrWhiteSpace(tmpOrg.FATHERID)) { TreeViewItem item = new TreeViewItem(); item.Header = tmpOrg.CNAME; item.HeaderTemplate = Application.Current.Resources["OrganizationItemStyle"] as DataTemplate; item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; item.DataContext = tmpOrg; //状态在未生效和撤消中时背景色为红色 SolidColorBrush brush = new SolidColorBrush(); if (tmpOrg.CHECKSTATE != ((int)CheckStates.Approved).ToString()) { brush.Color = Colors.Red; item.Foreground = brush; } else { brush.Color = Colors.Black; item.Foreground = brush; } //标记为公司 item.Tag = OrgTreeItemTypes.Company; treeOrganization.Items.Add(item); TopCompany.Add(tmpOrg); } else { //查询当前公司是否在公司集合内有父公司存在 if (allCompanys != null && allDepartments != null) { var ent = from c in allCompanys where tmpOrg.FATHERTYPE == "0" && c.COMPANYID == tmpOrg.FATHERID select c; var ent2 = from c in allDepartments where tmpOrg.FATHERTYPE == "1" && tmpOrg.FATHERID == c.DEPARTMENTID select c; //如果不存在,则为顶级公司 if (ent.Count() == 0 && ent2.Count() == 0) { TreeViewItem item = new TreeViewItem(); item.Header = tmpOrg.CNAME; item.HeaderTemplate = Application.Current.Resources["OrganizationItemStyle"] as DataTemplate; item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; item.DataContext = tmpOrg; //状态在未生效和撤消中时背景色为红色 SolidColorBrush brush = new SolidColorBrush(); if (tmpOrg.CHECKSTATE != ((int)CheckStates.Approved).ToString()) { brush.Color = Colors.Red; item.Foreground = brush; } else { brush.Color = Colors.Black; item.Foreground = brush; } //标记为公司 item.Tag = OrgTreeItemTypes.Company; treeOrganization.Items.Add(item); TopCompany.Add(tmpOrg); } } } } //开始递归 foreach (var topComp in TopCompany) { TreeViewItem parentItem = GetParentItem(OrgTreeItemTypes.Company, topComp.COMPANYID); List <SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY> lsCompany = (from ent in allCompanys where ent.FATHERTYPE == "0" && ent.FATHERID == topComp.COMPANYID select ent).ToList(); List <SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT> lsDepartment = (from ent in allDepartments where ent.FATHERID == topComp.COMPANYID && ent.FATHERTYPE == "0" select ent).ToList(); AddOrgNode(lsCompany, lsDepartment, parentItem); } allPositions = Application.Current.Resources["SYS_PostInfo"] as List <SMT.Saas.Tools.OrganizationWS.T_HR_POST>; if (allPositions == null) { orgClient.GetPostActivedAsync(SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID); } }