private void GetChildSelectedOrgObj(TreeViewItem item, ref List <ExtOrgObj> selObjs) { foreach (TreeViewItem childItem in item.Items) { TreeViewItem myItem = (TreeViewItem)(item.ItemContainerGenerator.ContainerFromItem(childItem)); CheckBox cbx = Helper.UIHelper.FindChildControl <CheckBox>(myItem); if (cbx != null && cbx.IsChecked.GetValueOrDefault(false)) { OrgTreeItemTypes type = (OrgTreeItemTypes)(childItem.Tag); if (type == OrgTreeItemTypes.Post) { ExtOrgObj obj = childItem.DataContext as ExtOrgObj; ExtOrgObj pobj = item.DataContext as ExtOrgObj; if (obj != null && pobj != null) { //附父节点的值 ((T_HR_POST)obj.ObjectInstance).T_HR_DEPARTMENT = pobj.ObjectInstance as T_HR_DEPARTMENT; } } selObjs.Add(childItem.DataContext as ExtOrgObj); } GetChildSelectedOrgObj(childItem, ref selObjs); } }
void client_GetTravleSolutionSetBySolutionIDCompleted(object sender, GetTravleSolutionSetBySolutionIDCompletedEventArgs e) { RefreshUI(RefreshedTypes.HideProgressBar); if (!e.Cancelled) { if (e.Error == null) { if (e.Result.Count() > 0) { IsEdit = true;//z设置为修改 issuanceExtOrgObj.Clear(); ListSet = e.Result.ToList(); foreach (var h in ListSet) { object obj = new object(); SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj extOrgObj = new SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj(); T_HR_COMPANY tmp = new T_HR_COMPANY(); tmp.COMPANYID = h.COMPANYID; tmp.CNAME = Utility.GetCompanyName(tmp.COMPANYID); obj = tmp; extOrgObj.ObjectInstance = obj; issuanceExtOrgObj.Add(extOrgObj); } BindData(); } } } }
/// <summary> /// 选择员工 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LookUp_FindClick(object sender, EventArgs e) { OrganizationLookup lookup = new OrganizationLookup(); lookup.SelectedObjType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel; lookup.SelectedClick += (obj, ev) => { List <SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj> ent = lookup.SelectedObj as List <SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj>; if (ent != null && ent.Count > 0) { SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj userInfo = ent.FirstOrDefault(); SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj post = (SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj)userInfo.ParentObject; postId = post.ObjectID; string postName = post.ObjectName;//岗位 SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj dept = (SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj)post.ParentObject; deptId = dept.ObjectID; string deptName = dept.ObjectName;//部门 SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY corp = (dept.ObjectInstance as SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT).T_HR_COMPANY; corpId = corp.COMPANYID; corpName = corp.CNAME; //公司 SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE emp = userInfo.ObjectInstance as SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE; empId = emp.EMPLOYEEID; T_HR_EMPLOYEEPOST empPost = emp.T_HR_EMPLOYEEPOST.Where(t => t.T_HR_POST.POSTID == postId).FirstOrDefault(); if (empPost == null) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), "检测员工当前岗位异常,请重试", Utility.GetResourceStr("CONFIRM"), MessageIcon.Information); return; } //if (empPost.ISAGENCY == "1") //{ // ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), "请选择员工主岗位", // Utility.GetResourceStr("CONFIRM"), MessageIcon.Information); // return; //} string StrEmployee = userInfo.ObjectName + "-" + post.ObjectName + "-" + dept.ObjectName + "-" + corp.CNAME; lkEmployeeName.TxtLookUp.Text = StrEmployee; lkEmployeeName.DataContext = emp; ToolTipService.SetToolTip(lkEmployeeName.TxtLookUp, StrEmployee); } }; lookup.Show <string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { }); }
private void client_GetDistributeUserListCompleted(object sender, GetDistributeUserListCompletedEventArgs e) { try { if (e.Error == null) { if (e.Result != null) { distributeList = e.Result.ToList(); foreach (var h in distributeList) { object obj = new object(); SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj extOrgObj = new SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj(); if (h.VIEWTYPE == ((int)SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company).ToString()) { StrCompanyIDsList.Add(h.VIEWER); } else if (h.VIEWTYPE == ((int)SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Department).ToString()) { StrDepartmentIDsList.Add(h.VIEWER); } else if (h.VIEWTYPE == ((int)SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Post).ToString()) { StrPositionIDsList.Add(h.VIEWER); } else if (h.VIEWTYPE == ((int)SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel).ToString()) { StrStaffList.Add(h.VIEWER); } } personclient.GetEmployeeDetailByParasAsync(StrCompanyIDsList, StrDepartmentIDsList, StrPositionIDsList, StrStaffList); } } else { //HtmlPage.Window.Alert(e.Error.ToString()); Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), e.Error.Message); } } catch (Exception ex) { //HtmlPage.Window.Alert(ex.ToString()); Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(ex.Message.ToString())); } }
private void AddDistributeObjList(SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj issuanceExtOrgObj, string issuanceID) { SMT.SaaS.OA.UI.SmtOACommonOfficeService.T_OA_DISTRIBUTEUSER distributeTmp = new SMT.SaaS.OA.UI.SmtOACommonOfficeService.T_OA_DISTRIBUTEUSER(); distributeTmp.DISTRIBUTEUSERID = Guid.NewGuid().ToString(); distributeTmp.MODELNAME = "EmployeeSurveyDistribute"; distributeTmp.FORMID = issuanceID; distributeTmp.VIEWTYPE = ((int)GetObjectType(issuanceExtOrgObj)).ToString(); if (distributeTmp.VIEWTYPE == ((int)IssuanceObjectType.Post).ToString()) //如果是选择岗位,则保存岗位级别 { //T_HR_POST hr = (T_HR_POST)issuanceExtOrgObj.ObjectInstance; //if (!string.IsNullOrEmpty(hr.POSTLEVEL.ToString())) // distributeTmp.VIEWER = hr.POSTLEVEL.ToString(); //else // distributeTmp.VIEWER = hr.T_HR_POSTDICTIONARY.POSTLEVEL.ToString(); } else { if (!string.IsNullOrEmpty(issuanceExtOrgObj.ObjectID)) { distributeTmp.VIEWER = issuanceExtOrgObj.ObjectID; } else { distributeTmp.VIEWER = Utility.ReturnIssuranceObjID(issuanceExtOrgObj); } //distributeTmp.VIEWER = issuanceExtOrgObj.ObjectID; } distributeTmp.CREATEDATE = DateTime.Now; distributeTmp.CREATEUSERID = Common.CurrentLoginUserInfo.EmployeeID; distributeTmp.CREATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName; distributeTmp.CREATEPOSTID = Common.CurrentLoginUserInfo.UserPosts[0].PostID; distributeTmp.CREATEDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID; distributeTmp.CREATECOMPANYID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID; distributeTmp.OWNERID = Common.CurrentLoginUserInfo.EmployeeID; distributeTmp.OWNERNAME = Common.CurrentLoginUserInfo.EmployeeName; distributeTmp.OWNERPOSTID = Common.CurrentLoginUserInfo.UserPosts[0].PostID; distributeTmp.OWNERDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID; distributeTmp.OWNERCOMPANYID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID; if (distributeTmp.VIEWTYPE != ((int)IssuanceObjectType.Post).ToString()) //不提供按部门下的岗位发布 { distributeLists.Add(distributeTmp); } //distributeLists.Add(distributeTmp); }
/// <summary> /// 选择员工 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LookUp_FindClick(object sender, EventArgs e) { //lookup.Show<string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) =>{}); OrganizationLookup lookup = new OrganizationLookup(); lookup.SelectedObjType = OrgTreeItemTypes.Personnel; lookup.SelectedClick += (obj, ev) => { List <SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj> ent = lookup.SelectedObj as List <SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj>; if (ent != null && ent.Count > 0) { SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj userInfo = ent.FirstOrDefault(); SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj post = (SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj)userInfo.ParentObject; string postid = post.ObjectID; string postName = post.ObjectName;//岗位 SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj dept = (SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj)post.ParentObject; string deptid = dept.ObjectID; string deptName = dept.ObjectName;//部门 SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY corp = (dept.ObjectInstance as SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT).T_HR_COMPANY; string corpid = corp.COMPANYID; string corpName = corp.CNAME;//公司 SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE emp = userInfo.ObjectInstance as SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE; string StrEmployee = userInfo.ObjectName + "-" + post.ObjectName + "-" + dept.ObjectName + "-" + corp.CNAME; lkEmployeeName.TxtLookUp.Text = StrEmployee; lkEmployeeName.DataContext = emp; ToolTipService.SetToolTip(lkEmployeeName.TxtLookUp, StrEmployee); if (ent != null) { RefreshUI(RefreshedTypes.ShowProgressBar); clientAtt.GetAbnormRecordByEmployeeIDAsync(emp.EMPLOYEEID); } } }; lookup.Show <string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { }); }
private void AddMembersObj() { SMT.SaaS.FrameworkUI.OrganizationControl.OrganizationLookup lookup = new SMT.SaaS.FrameworkUI.OrganizationControl.OrganizationLookup(); lookup.SelectedObjType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel; lookup.SelectedClick += (obj, ev) => { List <ExtOrgObj> ent = lookup.SelectedObj as List <ExtOrgObj>; if (ent != null && ent.Count > 0) { foreach (var h in ent) { V_EMPLOYEEVIEW view = new V_EMPLOYEEVIEW(); SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj userInfo = ent.FirstOrDefault(); SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj post = (SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj)userInfo.ParentObject; view.OWNERPOSTID = post.ObjectID; view.POSTNAME = post.ObjectName;//岗位 SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj dept = (SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj)post.ParentObject; view.OWNERDEPARTMENTID = dept.ObjectID; view.DEPARTMENTNAME = dept.ObjectName;//部门 SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY corp = (dept.ObjectInstance as SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT).T_HR_COMPANY; view.OWNERCOMPANYID = corp.COMPANYID; view.COMPANYNAME = corp.CNAME;//公司 SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE emp = userInfo.ObjectInstance as SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE; view.EMPLOYEEID = emp.EMPLOYEEID; view.EMPLOYEECNAME = emp.EMPLOYEECNAME; listEmpolyeeView.Add(view); } //issuanceExtOrgObj = ent; tmpMeetingMember = ent; // personclient.GetEmployeeDetailByIDsAsync(StrStaffList); BindData(); } }; lookup.MultiSelected = true; lookup.SelectSameGradeOnly = true; lookup.Show(); }
private IssuanceObjectType GetObjectType(SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj issuanceExtOrgObj) { if (issuanceExtOrgObj.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company) { return IssuanceObjectType.Company; } else if (issuanceExtOrgObj.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Department) { return IssuanceObjectType.Department; } else if (issuanceExtOrgObj.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Post) { return IssuanceObjectType.Post; } else if (issuanceExtOrgObj.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel) { return IssuanceObjectType.Employee; } return IssuanceObjectType.Company; }
private void GetOrgInfoByChecked(ref string sType, ref string sValue, ref string strMsg) { List <ExtOrgObj> selObjs = new List <ExtOrgObj>(); foreach (TreeViewItem item in orgTree.treeOrganization.Items) { TreeViewItem myItem = (TreeViewItem)(orgTree.treeOrganization.ItemContainerGenerator.ContainerFromItem(item)); myItem.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; CheckBox cbx = Helper.UIHelper.FindChildControl <CheckBox>(myItem); if (cbx != null && cbx.IsChecked.GetValueOrDefault(false)) { OrgTreeItemTypes type = (OrgTreeItemTypes)(item.Tag); selObjs.Add(item.DataContext as ExtOrgObj); } GetChildSelectedOrgObj(item, ref selObjs); } if (selObjs.Count() == 0) { strMsg = "请选择员工所在的公司再进行查询"; return; } if (selObjs.Count() > 1) { strMsg = "查询员工,只能选择单个机构做为范围查询"; return; } ExtOrgObj selobj = selObjs.FirstOrDefault(); sType = selobj.ObjectType.ToString(); sValue = selobj.ObjectID; }
//void perclient_GetEmployeePostByPostIDViewCompleted(object sender, PersonnelWS.GetEmployeePostByPostIDViewCompletedEventArgs e) //{ // try // { // List<PersonnelWS.T_HR_EMPLOYEE> eplist = new List<PersonnelWS.T_HR_EMPLOYEE>(); // 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_EMPLOYEE ep in eplist) // { // TreeViewItem subItem = new TreeViewItem(); // subItem.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; // subItem.Header = ep.EMPLOYEECNAME; // ExtOrgObj obj = new ExtOrgObj(); // obj.ObjectInstance = ep; // 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.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(); //} 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; ToolTipService.SetToolTip(subItem, ""); //设置父级对像 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="allMenu"></param> private void RemovePost(T_HR_POST delPost) { if (delPost == null) { return; } if (this.DataContext == null) { return; } List<T_HR_POST> entPostList = new List<T_HR_POST>(); if (DtGridPost.ItemsSource != null) { foreach (T_HR_POST post in DtGridPost.ItemsSource) { entPostList.Add(post); } } if (entPostList.Count() == 0) { return; } for (int i = 0; i < entPostList.Count(); i++) { T_HR_POST entPost = entPostList[i] as T_HR_POST; if (entPost.POSTID == delPost.POSTID) { entPostList.Remove(entPost); break; } } ExtOrgObj extPost = new ExtOrgObj(); extPost.ObjectInstance = delPost; RemoveCustomPermissionByExtOrgObj(extPost); }
private void lkSelectObj_FindClick(object sender, EventArgs e) { string userID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID; string perm = (((int)FormTypes.Browse) + 1).ToString(); //zl 3.1 OrganizationLookup ogzLookup = new OrganizationLookup(); ogzLookup.MultiSelected = false; ogzLookup.SelectedObjType = OrgTreeItemTypes.Company; ogzLookup.SelectedClick += (o, ev) => { StrCompanyIDs = ""; List<ExtOrgObj> ent = ogzLookup.SelectedObj as List<ExtOrgObj>; if (ent.Count() == 0) { return; } List<ExtOrgObj> entall = new List<ExtOrgObj>(); if (ent != null && ent.Count > 0) { foreach (var h in ent) { if (h.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company)//公司 { StrCompanyIDs = h.ObjectID; //先添加总公司 ExtOrgObj obj2 = new ExtOrgObj(); obj2.ObjectID = h.ObjectID; obj2.ObjectName = h.ObjectName; obj2.ObjectType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company; entall.Add(obj2); lkSelectObj.DataContext = (SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY)h.ObjectInstance; lkSelectObj.DisplayMemberPath = "CNAME"; } } } }; ogzLookup.Show<string>(DialogMode.ApplicationModal, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { }, true, userID); }
private void BindPosition(string departmentID, TreeViewItem treeItem) { loadbar.Start(); //if (treeItem.Items.Count > 0) //{ // loadbar.Stop(); // return; //} List<T_HR_POST> Positions = Application.Current.Resources["ORGTREESYSPostInfo" + Perm + Entity] as List<T_HR_POST>; if (IsOrganizationHistory) { Positions = Positions.Where(p => p.T_HR_DEPARTMENT != null).Where(s => s.T_HR_DEPARTMENT.DEPARTMENTID == departmentID && s.EDITSTATE != "0").ToList(); } else { Positions = Positions.Where(p => p.T_HR_DEPARTMENT != null).Where(s => s.T_HR_DEPARTMENT.DEPARTMENTID == departmentID && s.EDITSTATE == "1").ToList(); } if (Positions == null) { loadbar.Stop(); return; } if (Positions.Count() == 0) { loadbar.Stop(); return; } foreach (T_HR_POST tmpPosition in Positions) { 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(); SolidColorBrush brush = new SolidColorBrush(); if (tmpPosition.EDITSTATE != ((int)EditStates.Actived).ToString()) { brush.Color = Colors.Red; item.Foreground = brush; } else { brush.Color = Colors.Black; item.Foreground = brush; } item.Header = tmpPosition.T_HR_POSTDICTIONARY.POSTNAME; item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; ExtOrgObj obj = new ExtOrgObj(); obj.ObjectInstance = tmpPosition; item.DataContext = obj; ToolTipService.SetToolTip(item, "岗位"); //设置父级对像 obj.ParentObject = parentItem.DataContext; // item.Style = this.Resources["CheckBoxTreeItemStyle"] as Style; item.HeaderTemplate = treeViewItemTemplate; //标记为岗位 item.Tag = OrgTreeItemTypes.Post; parentItem.Items.Add(item); } } depIDsCach.Add(departmentID, "1"); //树全部展开 // treeOrganization.ExpandAll(); //if (treeOrganization.Items.Count > 0) //{ // TreeViewItem selectedItem = treeOrganization.Items[0] as TreeViewItem; // selectedItem.IsSelected = true; //} loadbar.Stop(); }
void DocDistrbuteClient_GetDocDistrbuteInfosCompleted(object sender, GetDocDistrbuteInfosCompletedEventArgs e) { try { if (e.Error == null) { if (e.Result != null) { distributeList = e.Result; foreach (var h in distributeList) { object obj = new object(); SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj extOrgObj = new SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj(); if (h.VIEWTYPE == ((int)SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company).ToString()) { SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY tmp = new SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY(); tmp.COMPANYID = h.VIEWER; tmp.CNAME = Utility.GetCompanyName(tmp.COMPANYID); obj = tmp; StrCompanyIDsList.Add(h.VIEWER); } else if (h.VIEWTYPE == ((int)SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Department).ToString()) { SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT tmp = new SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT(); tmp.DEPARTMENTID = h.VIEWER; SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENTDICTIONARY tmpdict = new SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENTDICTIONARY(); tmpdict.DEPARTMENTNAME = Utility.GetDepartmentName(h.VIEWER); tmp.T_HR_DEPARTMENTDICTIONARY = tmpdict; obj = tmp; StrDepartmentIDsList.Add(h.VIEWER); } else if (h.VIEWTYPE == ((int)SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Post).ToString()) { SMT.Saas.Tools.OrganizationWS.T_HR_POST tmp = new SMT.Saas.Tools.OrganizationWS.T_HR_POST(); tmp.POSTLEVEL = System.Convert.ToDecimal(h.VIEWER); SMT.Saas.Tools.OrganizationWS.T_HR_POSTDICTIONARY tmpdict = new SMT.Saas.Tools.OrganizationWS.T_HR_POSTDICTIONARY(); tmpdict.POSTNAME = Utility.GetPostName(h.VIEWER); tmp.T_HR_POSTDICTIONARY = tmpdict; obj = tmp; StrPositionIDsList.Add(h.VIEWER); } else if (h.VIEWTYPE == ((int)SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel).ToString()) { SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE tmp = new SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE(); tmp.EMPLOYEEID = h.VIEWER; tmp.EMPLOYEECNAME = Utility.GetDistrbuteUserName(tmp.EMPLOYEEID,vemployeeObj); obj = tmp; if (!(StrStaffList.IndexOf(h.VIEWER) >0)) { StaffList.Add(h.VIEWER); } } extOrgObj.ObjectInstance = obj; issuanceExtOrgObj.Add(extOrgObj); } //personclient.GetEmployeeDetailByParasAsync(StrCompanyIDsList, StrDepartmentIDsList, StrPositionIDsList, StaffList); //RefreshUI(RefreshedTypes.ShowProgressBar); //personclient.GetEmployeeIDsByParasAsync(StrCompanyIDsList,StrDepartmentIDsList,StrPositionIDsList); //StaffList.Clear();//将对象员工清除 //personclient.GetEmployeeIDsWithParasAsync(StrCompanyIDsList, true, StrDepartmentIDsList, true, StrPositionIDsList); BindData(); } } else { //HtmlPage.Window.Alert(e.Error.ToString()); //Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), e.Error.Message); ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation); } } catch (Exception ex) { //HtmlPage.Window.Alert(ex.ToString()); //Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(ex.Message.ToString())); ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); } }
/// <summary> /// 绑定组织架构节点 /// </summary> private void BindCompany() { try { treeOrganization.Items.Clear(); allCompanys = Application.Current.Resources["ORGTREESYSCompanyInfo" + Perm + Entity] as List<T_HR_COMPANY>; allDepartments = Application.Current.Resources["ORGTREESYSDepartmentInfo" + Perm + Entity] as List<T_HR_DEPARTMENT>; if (allCompanys == null) { loadbar.Stop(); return; } //根据传值不同去不同的信息 if (IsOrganizationHistory) { allCompanys = allCompanys.Where(s => s.EDITSTATE != "0").ToList(); allCompanys = allCompanys.OrderBy(s => s.SORTINDEX).ToList(); if (allDepartments != null) { allDepartments = allDepartments.Where(s => s.EDITSTATE != "0").ToList(); allDepartments = allDepartments.OrderBy(s => s.SORTINDEX).ToList(); } } else { allCompanys = allCompanys.Where(s => s.EDITSTATE == "1").ToList(); allCompanys = allCompanys.OrderBy(s => s.SORTINDEX).ToList(); if (allDepartments != null) { allDepartments = allDepartments.Where(s => s.EDITSTATE == "1").ToList(); allDepartments = allDepartments.OrderBy(s => s.SORTINDEX).ToList(); } } List<T_HR_COMPANY> TopCompany = new List<T_HR_COMPANY>(); foreach (T_HR_COMPANY tmpOrg in allCompanys) { //如果当前公司没有父机构的ID,则为顶级公司 if (string.IsNullOrWhiteSpace(tmpOrg.FATHERID)) { TreeViewItem item = new TreeViewItem(); SolidColorBrush brush = new SolidColorBrush(); //没生效的为红色 if (tmpOrg.EDITSTATE != ((int)EditStates.Actived).ToString()) { brush.Color = Colors.Red; item.Foreground = brush; } else { brush.Color = Colors.Black; item.Foreground = brush; } item.Header = tmpOrg.CNAME; // item.Header = tmpOrg.BRIEFNAME; item.HeaderTemplate = treeViewItemTemplate; item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; ToolTipService.SetToolTip(item, "公司"); ExtOrgObj obj = new ExtOrgObj(); obj.ObjectInstance = tmpOrg; item.DataContext = obj; //标记为公司 item.Tag = OrgTreeItemTypes.Company; treeOrganization.Items.Add(item); TopCompany.Add(tmpOrg); } else { //查询当前公司是否在公司集合内有父公司存在 var ent = from c in allCompanys where c.COMPANYID == tmpOrg.FATHERID && tmpOrg.FATHERTYPE == "0" 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(); SolidColorBrush brush = new SolidColorBrush(); if (tmpOrg.EDITSTATE != ((int)EditStates.Actived).ToString()) { brush.Color = Colors.Red; item.Foreground = brush; } else { brush.Color = Colors.Black; item.Foreground = brush; } item.Header = tmpOrg.CNAME; //item.Header = tmpOrg.BRIEFNAME; item.HeaderTemplate = treeViewItemTemplate; ; item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; ToolTipService.SetToolTip(item, "公司"); ExtOrgObj obj = new ExtOrgObj(); obj.ObjectInstance = tmpOrg; item.DataContext = obj; //标记为公司 item.Tag = OrgTreeItemTypes.Company; treeOrganization.Items.Add(item); TopCompany.Add(tmpOrg); } } } //开始递归 foreach (var topComp in TopCompany) { TreeViewItem parentItem = GetParentItem(OrgTreeItemTypes.Company, topComp.COMPANYID); List<T_HR_COMPANY> lsCompany = (from ent in allCompanys where ent.FATHERTYPE == "0" && ent.FATHERID == topComp.COMPANYID select ent).ToList(); List<T_HR_DEPARTMENT> lsDepartment = (from ent in allDepartments where ent.FATHERID == topComp.COMPANYID && ent.FATHERTYPE == "0" select ent).ToList(); AddOrgNode(lsCompany, lsDepartment, parentItem); } } catch (Exception ex) { string ss = ex.ToString(); } }
private void AddChildOrgItems(TreeViewItem item, string companyID) { try { List<T_HR_COMPANY> childs = GetChildORG(companyID); if (childs == null || childs.Count <= 0) return; foreach (T_HR_COMPANY childOrg in childs) { TreeViewItem childItem = new TreeViewItem(); childItem.Header = childOrg.CNAME; //childItem.Header = childOrg.BRIEFNAME; childItem.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; ExtOrgObj obj = new ExtOrgObj(); obj.ObjectInstance = childOrg; childItem.DataContext = obj; //设置父级对像 obj.ParentObject = item.DataContext; // childItem.Style = this.Resources["CheckBoxTreeItemStyle"] as Style; childItem.HeaderTemplate = treeViewItemTemplate; //标记为公司 childItem.Tag = OrgTreeItemTypes.Company; item.Items.Add(childItem); ToolTipService.SetToolTip(item, "公司"); AddChildOrgItems(childItem, childOrg.COMPANYID); } } catch (Exception) { throw; } }
/// <summary> /// 转换为权限范围实体 /// </summary> /// <param name="obj"></param> /// <returns></returns> private OrgObject GetOrgEntity(ExtOrgObj obj) { FrameworkUI.OrgTreeItemTypes nodeType = obj.ObjectType; OrgObject entTemp = new OrgObject(); switch (nodeType) { case FrameworkUI.OrgTreeItemTypes.Company: T_HR_COMPANY tmpOrg = (T_HR_COMPANY)obj.ObjectInstance; if (tmpOrg != null) { entTemp.OrgID = tmpOrg.COMPANYID; entTemp.OrgType = Convert.ToInt32(OrgTreeItemTypes.Company).ToString(); } break; case FrameworkUI.OrgTreeItemTypes.Department: T_HR_DEPARTMENT tmpDep = obj.ObjectInstance as T_HR_DEPARTMENT; if (tmpDep != null) { entTemp.OrgID = tmpDep.DEPARTMENTID; entTemp.OrgType = Convert.ToInt32(OrgTreeItemTypes.Department).ToString(); } break; case FrameworkUI.OrgTreeItemTypes.Post: T_HR_POST tmpPost = obj.ObjectInstance as T_HR_POST; if (tmpPost != null) { entTemp.OrgID = tmpPost.POSTID; entTemp.OrgType = Convert.ToInt32(OrgTreeItemTypes.Post).ToString(); } break; default: entTemp = null; break; } return entTemp; }
private void BindPosition(string departmentID) { loadbar.Start(); List<T_HR_POST> Positions = Application.Current.Resources["SYS_PostInfo"] as List<T_HR_POST>; Positions = Positions.Where(p => p.T_HR_DEPARTMENT != null).Where(s => s.T_HR_DEPARTMENT.DEPARTMENTID == departmentID && s.EDITSTATE == "1").ToList(); if (Positions == null) { loadbar.Stop(); return; } if (Positions.Count() == 0) { loadbar.Stop(); return; } foreach (T_HR_POST tmpPosition in Positions) { 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.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; ExtOrgObj obj = new ExtOrgObj(); obj.ObjectInstance = tmpPosition; item.DataContext = obj; //设置父级对像 obj.ParentObject = parentItem.DataContext; // item.Style = this.Resources["CheckBoxTreeItemStyle"] as Style; item.HeaderTemplate = treeViewItemTemplate; //标记为岗位 item.Tag = OrgTreeItemTypes.Post; parentItem.Items.Add(item); } } depIDsCach.Add(departmentID, "1"); //树全部展开 // treeOrganization.ExpandAll(); //if (treeOrganization.Items.Count > 0) //{ // TreeViewItem selectedItem = treeOrganization.Items[0] as TreeViewItem; // selectedItem.IsSelected = true; //} loadbar.Stop(); }
void client_GetTravleSolutionSetBySolutionIDCompleted(object sender, GetTravleSolutionSetBySolutionIDCompletedEventArgs e) { RefreshUI(RefreshedTypes.HideProgressBar); if (!e.Cancelled) { if (e.Error == null) { if (e.Result.Count() >0) { IsEdit = true;//z设置为修改 issuanceExtOrgObj.Clear(); ListSet = e.Result.ToList(); foreach (var h in ListSet) { object obj = new object(); SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj extOrgObj = new SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj(); T_HR_COMPANY tmp = new T_HR_COMPANY(); tmp.COMPANYID = h.COMPANYID; tmp.CNAME = Utility.GetCompanyName(tmp.COMPANYID); obj = tmp; extOrgObj.ObjectInstance = obj; issuanceExtOrgObj.Add(extOrgObj); } BindData(); } } } }
void personnerClient_GetEmployeesPostBriefByEmployeeIDCompleted(object sender, GetEmployeesPostBriefByEmployeeIDCompletedEventArgs e) { RefreshUI(RefreshedTypes.HideProgressBar); if (e.Error != null && !string.IsNullOrEmpty(e.Error.Message)) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); } else { List<V_EMPLOYEEDETAIL> employees = new List<V_EMPLOYEEDETAIL>(); if (e.Result != null) { employees = e.Result.ToList(); } foreach (var ent in employees) { ExtOrgObj objPerson = new ExtOrgObj(); objPerson.ObjectID = ent.EMPLOYEEID; objPerson.ObjectName = ent.EMPLOYEENAME; objPerson.ObjectType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel; var ExistEnts = from ext in entall where ext.ObjectID == objPerson.ObjectID && ext.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel select ext; if (ExistEnts.Count() == 0) { T_HR_BALANCEPOSTDETAIL detail = new T_HR_BALANCEPOSTDETAIL(); detail.BALANCEPOSTDETAIL = Guid.NewGuid().ToString(); detail.BALANCEPOSTASIGNID = EmployeeAddBalancePost.EMPLOYEESALARYPOSTASIGNID; detail.EMPLOYEEID = ent.EMPLOYEEID; detail.EMPLOYEENAME = ent.EMPLOYEENAME; var ents = from ent1 in ent.EMPLOYEEPOSTS where ent1.ISAGENCY =="0" select ent1; if (ents.Count() > 0) { detail.EMPLOYEEPOSTID = ents.FirstOrDefault().POSTID; detail.EMPLOYEEPOSTNAME = ents.FirstOrDefault().PostName; detail.EMPLOYEEDEPARTMENTID = ents.FirstOrDefault().DepartmentID; detail.EMPLOYEEDEPARTMENTNAME = ents.FirstOrDefault().DepartmentName; detail.EMPLOYEECOMPANYID = ents.FirstOrDefault().CompanyID; detail.EMPLOYEECOMPANYNAME = ents.FirstOrDefault().CompanyName; } //detail.EDITSTATE = "0"; detail.CREATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID; detail.UPDATEDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID; detail.CREATEDATE = DateTime.Now; detail.UPDATEDATE = DateTime.Now; EmployeeBalanceInfoList.Add(detail); objPerson.ObjectName = ent.EMPLOYEENAME + "-"+ detail.EMPLOYEEPOSTNAME+"-"+ detail.EMPLOYEEDEPARTMENTNAME+"-"+ detail.EMPLOYEECOMPANYNAME; entall.Add(objPerson); } } issuanceExtOrgObj = entall; //BindData(); } }
private void btnDelete_Click(object sender, RoutedEventArgs e) { Button delBtn = sender as Button; ExtOrgObj Org = new ExtOrgObj(); Org = delBtn.Tag as ExtOrgObj; issuanceExtOrgObj.Remove(Org); BindData(); }
/// <summary> /// 删除公司项 /// </summary> /// <param name="allMenu"></param> private void RemoveCompany(T_HR_COMPANY delCompany) { if (delCompany == null) { return; } if (this.DataContext == null) { return; } List<T_HR_COMPANY> entCompanyList = new List<T_HR_COMPANY>(); foreach (T_HR_COMPANY com in DtGridCompany.ItemsSource) { entCompanyList.Add(com); } if (entCompanyList.Count() == 0) { return; } for (int i = 0; i < entCompanyList.Count(); i++) { T_HR_COMPANY entCompany = entCompanyList[i] as T_HR_COMPANY; if (entCompany.COMPANYID == delCompany.COMPANYID) { entCompanyList.Remove(entCompany); break; } } ExtOrgObj extCompany = new ExtOrgObj(); extCompany.ObjectInstance = delCompany; RemoveCustomPermissionByExtOrgObj(extCompany); }
/// <summary> /// 移除权限范围(组织架构) /// </summary> /// <param name="ListExtOrgObj"></param> private void RemoveCustomPermissionByExtOrgObj(ExtOrgObj entExtOrgObj) { if (this.DataContext == null) { return; } if (entExtOrgObj == null) { return; } T_SYS_ENTITYMENU entMenu = DaGrMenu.SelectedItems[0] as T_SYS_ENTITYMENU; if (entMenu == null) { return; } T_SYS_PERMISSION entPerm = DtGridPermission.SelectedItems[0] as T_SYS_PERMISSION; if (entPerm == null) { return; } List<CustomerPermission> ListCustomerpermission = this.DataContext as List<CustomerPermission>; var q = from c in ListCustomerpermission where c.EntityMenuId == entMenu.ENTITYMENUID select c; CustomerPermission entCP = q.FirstOrDefault(); if (entCP.PermissionValue == null) { return; } if (entCP.PermissionValue.Count() == 0) { return; } var qp = from p in entCP.PermissionValue where p.Permission == entPerm.PERMISSIONID select p; if (qp.Count() == 0) { return; } PermissionValue entPV = qp.FirstOrDefault(); ObservableCollection<OrgObject> ListOrgObjs = new ObservableCollection<OrgObject>(); if (entPV.OrgObjects == null) { return; } if (entPV.OrgObjects.Count() == 0) { return; } ListOrgObjs = entPV.OrgObjects; List<OrgObject> tmpListOrg = new List<OrgObject>(); tmpListOrg = entPV.OrgObjects.ToList(); OrgObject entOrg = new OrgObject(); for (int i = 0; i < ListOrgObjs.Count(); i++) { entOrg = ListOrgObjs[i]; if (entOrg.OrgID == entExtOrgObj.ObjectID) { ListOrgObjs.Remove(entOrg); break; } } var entpermissions = from ent in qp where ent.Permission == entPV.Permission && tmpListOrg.Contains(entOrg) select ent; if (entpermissions.Count() > 0) entCP.PermissionValue.Remove(entpermissions.FirstOrDefault()); tmpListOrg.Clear(); tmpListOrg = ListOrgObjs.ToList(); ObservableCollection<OrgObject> tmpCollListOrg = new ObservableCollection<OrgObject>(tmpListOrg); //将组织架构的先清掉 再更新 foreach (var aa in entCP.PermissionValue) { aa.OrgObjects.Clear(); aa.OrgObjects = tmpCollListOrg; } entPV.OrgObjects = ListOrgObjs; this.DataContext = ListCustomerpermission; }
private void BindEmployeeByTreeViewItem(TreeViewItem item) { if (item == null) return; ExtOrgObj tmp = new ExtOrgObj(); tmp = item.DataContext as ExtOrgObj; if (tmp.ObjectType == OrgTreeItemTypes.Personnel) { foreach (var h in ((PersonnelWS.T_HR_EMPLOYEE)tmp.ObjectInstance).T_HR_EMPLOYEEPOST) { PersonnelWS.T_HR_POST tmpPost_P = new PersonnelWS.T_HR_POST(); OrganizationWS.T_HR_POST tmpPost_O = new OrganizationWS.T_HR_POST(); tmpPost_O = BindEmployeePost(item); } } }
private void AddIssuanObj() { entall = new List<ExtOrgObj>(); SMT.SaaS.FrameworkUI.OrganizationControl.OrganizationLookup lookup = new SMT.SaaS.FrameworkUI.OrganizationControl.OrganizationLookup(); lookup.SelectedObjType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.All; lookup.SelectedClick += (obj, ev) => { List<ExtOrgObj> ent = lookup.SelectedObj as List<ExtOrgObj>; if (ent != null && ent.Count > 0) { //issuanceExtOrgObj = ent; foreach (var h in ent) { if (h.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company)//公司 { StrCompanyIDsList.Add(h.ObjectID); //先添加总公司 ExtOrgObj obj2 = new ExtOrgObj(); obj2.ObjectID = h.ObjectID; obj2.ObjectName = h.ObjectName; obj2.ObjectType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company; var ExistEnts = from ext in entall where ext.ObjectID == obj2.ObjectID && ext.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company select ext; if (ExistEnts.Count() == 0) { entall.Add(obj2); } //entall.Add(obj2); List<SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY> listcompany = App.Current.Resources["SYS_CompanyInfo"] as List<SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY>; var company= listcompany.Where(t=>t.EDITSTATE=="1");//过滤,选出已生效的公司信息 listcompany = company.ToList(); var ents = from childcompany in listcompany where childcompany.T_HR_COMPANY2 != null && childcompany.T_HR_COMPANY2.COMPANYID == h.ObjectID select childcompany; if (ents != null) { if (ents.Count() > 0) { GetCompanyExtOrgObj(listcompany,ents.ToList()); // ents.ToList().ForEach(item => // { // if (!StrCompanyIDsList.Contains(item.COMPANYID)) // { // StrCompanyIDsList.Add(item.COMPANYID); // //issuanceExtOrgObj.Add(item); // ExtOrgObj obj1 = new ExtOrgObj(); // obj1.ObjectID = item.COMPANYID; // obj1.ObjectName = item.CNAME; // obj1.ObjectType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company; // entall.Add(obj1); // #region 2级子公司 // var entsChilds = from childcompany in listcompany // where childcompany.T_HR_COMPANY2 != null && childcompany.T_HR_COMPANY2.COMPANYID == item.COMPANYID // select childcompany; // if (entsChilds.Count() > 0) // { // entsChilds.ToList().ForEach(child => // { // StrCompanyIDsList.Add(child.COMPANYID); // //issuanceExtOrgObj.Add(item); // ExtOrgObj objSecond = new ExtOrgObj(); // objSecond.ObjectID = child.COMPANYID; // objSecond.ObjectName = child.CNAME; // objSecond.ObjectType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company; // var ExistEnts = from ext in entall // where ext.ObjectID == child.COMPANYID // && ext.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company // select ext; // if (ExistEnts.Count() == 0) // { // entall.Add(objSecond); // } // }); // } // #endregion // } // }); } } } if (h.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Department)//部门 { StrDepartmentIDsList.Add(h.ObjectID); ExtOrgObj objDepart = new ExtOrgObj(); objDepart.ObjectID = h.ObjectID; objDepart.ObjectName = h.ObjectName; objDepart.ObjectType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Department; var ExistEnts = from ext in entall where ext.ObjectID == objDepart.ObjectID && ext.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Department select ext; if (ExistEnts.Count() == 0) { entall.Add(objDepart); } } if (h.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Post)//岗位 { StrPositionIDsList.Add(h.ObjectID); } if (h.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel) { StaffList.Add(h.ObjectID); ExtOrgObj objPerson = new ExtOrgObj(); objPerson.ObjectID = h.ObjectID; objPerson.ObjectName = h.ObjectName; objPerson.ObjectType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel; var ExistEnts = from ext in entall where ext.ObjectID == objPerson.ObjectID && ext.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel select ext; if (ExistEnts.Count() == 0) { entall.Add(objPerson); } } } issuanceExtOrgObj = entall; //personclient.GetEmployeeDetailByParasAsync(StrCompanyIDsList, StrDepartmentIDsList, StrPositionIDsList, StaffList); //personclient.GetEmployeeIDsByParasAsync(StrCompanyIDsList, StrDepartmentIDsList, StrPositionIDsList); //StaffList.Clear(); //personclient.GetEmployeeIDsWithParasAsync(StrCompanyIDsList,true, StrDepartmentIDsList,true, StrPositionIDsList); BindData(); } }; lookup.MultiSelected = true; lookup.SelectSameGradeOnly = true; lookup.Show(); }
//private string parentName = ""; //private void UnCheckChildCheckbox(TreeViewItem item, CheckBox selfCheckbox) //{ // foreach (TreeViewItem childItem in item.Items) // { // TreeViewItem myItem = // (TreeViewItem)(item.ItemContainerGenerator.ContainerFromItem(childItem)); // CheckBox cbx = Helper.UIHelper.FindChildControl<CheckBox>(myItem); // if (cbx == selfCheckbox) // { // UnCheckChildCheckbox(myItem, selfCheckbox); // } // else // { // //if (MultiSelected && parentName == GetParentName(myItem) && cbx.IsChecked==true) // if (MultiSelected && !HaveChildItemChecked(myItem, selfCheckbox)) // { // return; // } // if (cbx != null && cbx.IsChecked.GetValueOrDefault(false)) // { // cbx.IsChecked = false; // } // UnCheckChildCheckbox(childItem, selfCheckbox); // } // } //} private bool IsSameParent(TreeViewItem item, CheckBox selfCheckbox) { if (item == null || item.Parent == null) return false; ExtOrgObj obj = new ExtOrgObj(); TreeViewItem parentItem = new TreeViewItem(); parentItem = item.Parent as TreeViewItem; obj = parentItem.DataContext as ExtOrgObj; //ExtOrgObj obj1 = new ExtOrgObj(); //obj1= selfCheckbox.DataContext as ExtOrgObj; return obj.ObjectName == selfCheckbox.DataContext.ToString(); }
/// <summary> /// 添加子节点 /// </summary> /// <param name="lsCompany"></param> /// <param name="lsDepartment"></param> /// <param name="FatherNode"></param> private void AddOrgNode(List<T_HR_COMPANY> lsCompany, List<T_HR_DEPARTMENT> lsDepartment, TreeViewItem FatherNode) { //绑定公司的子公司 foreach (var childCompany in lsCompany) { TreeViewItem item = new TreeViewItem(); SolidColorBrush brush = new SolidColorBrush(); if (childCompany.EDITSTATE != ((int)EditStates.Actived).ToString()) { brush.Color = Colors.Red; item.Foreground = brush; } else { brush.Color = Colors.Black; item.Foreground = brush; } item.Header = childCompany.CNAME; //item.Header = childCompany.BRIEFNAME; item.HeaderTemplate = treeViewItemTemplate; item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; ToolTipService.SetToolTip(item, "公司"); ExtOrgObj obj = new ExtOrgObj(); obj.ObjectInstance = childCompany; item.DataContext = obj; //标记为公司 item.Tag = OrgTreeItemTypes.Company; FatherNode.Items.Add(item); Utility.log(FatherNode.Header+" 绑定公司:"+item.Header+" 类型"+ item.DataContext.GetType().Name ); if (lsCompany.Count() > 0) { List<T_HR_COMPANY> lsTempCom = (from ent in allCompanys where ent.FATHERID == childCompany.COMPANYID && ent.FATHERTYPE == "0" select ent).ToList(); List<T_HR_DEPARTMENT> lsTempDep = (from ent in allDepartments where ent.FATHERID == childCompany.COMPANYID && ent.FATHERTYPE == "0" select ent).ToList(); AddOrgNode(lsTempCom, lsTempDep, item); } } //绑定公司下的部门 foreach (var childDepartment in lsDepartment) { TreeViewItem item = new TreeViewItem(); SolidColorBrush brush = new SolidColorBrush(); if (childDepartment.EDITSTATE != ((int)EditStates.Actived).ToString()) { brush.Color = Colors.Red; item.Foreground = brush; } else { brush.Color = Colors.Black; item.Foreground = brush; } item.Header = childDepartment.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME; item.HeaderTemplate = treeViewItemTemplate; item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; ToolTipService.SetToolTip(item, "部门"); ExtOrgObj obj = new ExtOrgObj(); obj.ObjectInstance = childDepartment; item.DataContext = obj; //标记为部门 item.Tag = OrgTreeItemTypes.Department; FatherNode.Items.Add(item); Utility.log(FatherNode.Header+" 绑定部门:"+item.Header+" 类型"+ item.DataContext.GetType().Name ); if (lsDepartment.Count() > 0) { List<T_HR_COMPANY> lsTempCom = (from ent in allCompanys where ent.FATHERID == childDepartment.DEPARTMENTID && ent.FATHERTYPE == "1" select ent).ToList(); List<T_HR_DEPARTMENT> lsTempDep = (from ent in allDepartments where ent.FATHERID == childDepartment.DEPARTMENTID && ent.FATHERTYPE == "1" select ent).ToList(); AddOrgNode(lsTempCom, lsTempDep, item); } } if ((int)FatherNode.Tag== (int)OrgTreeItemTypes.Company) { Utility.log(FatherNode.Header + " 绑定公司完成******************************:"); treeOrganization.ExpandAll(); } if ((int)FatherNode.Tag == (int)OrgTreeItemTypes.Department) { Utility.log(FatherNode.Header+" 绑定部门完成----------------------------------------:"); treeOrganization.ExpandAll(); } }
/// <summary> /// 添加子节点 /// </summary> /// <param name="lsCompany"></param> /// <param name="lsDepartment"></param> /// <param name="FatherNode"></param> private void AddOrgNode(List<T_HR_COMPANY> lsCompany, List<T_HR_DEPARTMENT> lsDepartment, TreeViewItem FatherNode) { //绑定公司的子公司 foreach (var childCompany in lsCompany) { TreeViewItem item = new TreeViewItem(); //item.Header = childCompany.CNAME; item.Header = childCompany.BRIEFNAME; item.HeaderTemplate = treeViewItemTemplate; item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; ExtOrgObj obj = new ExtOrgObj(); obj.ObjectInstance = childCompany; item.DataContext = obj; //标记为公司 item.Tag = OrgTreeItemTypes.Company; FatherNode.Items.Add(item); if (lsCompany.Count() > 0) { List<T_HR_COMPANY> lsTempCom = (from ent in allCompanys where ent.FATHERID == childCompany.COMPANYID && ent.FATHERTYPE == "0" select ent).ToList(); List<T_HR_DEPARTMENT> lsTempDep = (from ent in allDepartments where ent.FATHERID == childCompany.COMPANYID && ent.FATHERTYPE == "0" select ent).ToList(); AddOrgNode(lsTempCom, lsTempDep, item); } } //绑定公司下的部门 foreach (var childDepartment in lsDepartment) { TreeViewItem item = new TreeViewItem(); item.Header = childDepartment.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME; item.HeaderTemplate = treeViewItemTemplate; item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; ExtOrgObj obj = new ExtOrgObj(); obj.ObjectInstance = childDepartment; item.DataContext = obj; //标记为部门 item.Tag = OrgTreeItemTypes.Department; FatherNode.Items.Add(item); if (lsDepartment.Count() > 0) { List<T_HR_COMPANY> lsTempCom = (from ent in allCompanys where ent.FATHERID == childDepartment.DEPARTMENTID && ent.FATHERTYPE == "1" select ent).ToList(); List<T_HR_DEPARTMENT> lsTempDep = (from ent in allDepartments where ent.FATHERID == childDepartment.DEPARTMENTID && ent.FATHERTYPE == "1" select ent).ToList(); AddOrgNode(lsTempCom, lsTempDep, item); } } }
//private void BindDepartment() //{ // allDepartments = Application.Current.Resources["ORGTREESYSDepartmentInfo"] as List<T_HR_DEPARTMENT>; // if (allDepartments == null) // { // return; // } // if (allDepartments.Count() == 0) // { // return; // } // foreach (T_HR_DEPARTMENT tmpDep in allDepartments) // { // if (tmpDep.T_HR_COMPANY == null) // continue; // TreeViewItem parentItem = GetParentItem(OrgTreeItemTypes.Company, tmpDep.T_HR_COMPANY.COMPANYID); // if (parentItem != null) // { // TreeViewItem item = new TreeViewItem(); // item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; // item.Header = tmpDep.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME; // ExtOrgObj obj = new ExtOrgObj(); // obj.ObjectInstance = tmpDep; // item.DataContext = obj; // //设置父级对像 // obj.ParentObject = parentItem.DataContext; // item.HeaderTemplate = treeViewItemTemplate; // //标记为部门 // item.Tag = OrgTreeItemTypes.Department; // parentItem.Items.Add(item); // } // } //} private void BindPosition() { allPositions = Application.Current.Resources["ORGTREESYSPostInfo" + Perm + Entity] as List<T_HR_POST>; if (allPositions == null) { loadbar.Stop(); return; } if (allPositions.Count() == 0) { loadbar.Stop(); return; } foreach (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.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; ExtOrgObj obj = new ExtOrgObj(); obj.ObjectInstance = tmpPosition; item.DataContext = obj; //设置父级对像 obj.ParentObject = parentItem.DataContext; // item.Style = this.Resources["CheckBoxTreeItemStyle"] as Style; item.HeaderTemplate = treeViewItemTemplate; //标记为岗位 item.Tag = OrgTreeItemTypes.Post; parentItem.Items.Add(item); } } //树全部展开 // treeOrganization.ExpandAll(); //if (treeOrganization.Items.Count > 0) //{ // TreeViewItem selectedItem = treeOrganization.Items[0] as TreeViewItem; // selectedItem.IsSelected = true; //} }
/// <summary> /// 绑定组织架构节点 /// </summary> private void BindCompany() { treeOrganization.Items.Clear(); allCompanys = Application.Current.Resources["SYS_CompanyInfo"] as List<T_HR_COMPANY>; allDepartments = Application.Current.Resources["SYS_DepartmentInfo"] as List<T_HR_DEPARTMENT>; if (allCompanys == null) { loadbar.Stop(); return; } else { allCompanys = allCompanys.Where(s => s.EDITSTATE == "1").ToList(); allCompanys = allCompanys.OrderBy(s => s.SORTINDEX).ToList(); } if (allDepartments != null) { allDepartments = allDepartments.Where(s => s.EDITSTATE == "1").ToList(); allDepartments = allDepartments.OrderBy(s => s.SORTINDEX).ToList(); } T_HR_COMPANY MOstTopCompany = GetFatherByDepartmentID(SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID); List<T_HR_COMPANY> TopCompany = new List<T_HR_COMPANY>(); //foreach (T_HR_COMPANY tmpOrg in allCompanys) //{ // //如果当前公司没有父机构的ID,则为顶级公司 // if (string.IsNullOrWhiteSpace(tmpOrg.FATHERID)) // { TreeViewItem item = new TreeViewItem(); //item.Header = tmpOrg.CNAME; item.Header = MOstTopCompany.BRIEFNAME; item.HeaderTemplate = treeViewItemTemplate; item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; ExtOrgObj obj = new ExtOrgObj(); obj.ObjectInstance = MOstTopCompany; item.DataContext = obj; //标记为公司 item.Tag = OrgTreeItemTypes.Company; treeOrganization.Items.Add(item); TopCompany.Add(MOstTopCompany); // } // else // { // //查询当前公司是否在公司集合内有父公司存在 // var ent = from c in allCompanys // where c.COMPANYID == tmpOrg.FATHERID && tmpOrg.FATHERTYPE == "0" // 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.Header = tmpOrg.BRIEFNAME; // item.HeaderTemplate = treeViewItemTemplate; ; // item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; // ExtOrgObj obj = new ExtOrgObj(); // obj.ObjectInstance = tmpOrg; // item.DataContext = obj; // //标记为公司 // item.Tag = OrgTreeItemTypes.Company; // treeOrganization.Items.Add(item); // TopCompany.Add(tmpOrg); // } // } //} //开始递归 foreach (var topComp in TopCompany) { TreeViewItem parentItem = GetParentItem(OrgTreeItemTypes.Company, topComp.COMPANYID); List<T_HR_COMPANY> lsCompany = (from ent in allCompanys where ent.FATHERTYPE == "0" && ent.FATHERID == topComp.COMPANYID select ent).ToList(); List<T_HR_DEPARTMENT> lsDepartment = (from ent in allDepartments where ent.FATHERID == topComp.COMPANYID && ent.FATHERTYPE == "0" select ent).ToList(); AddOrgNode(lsCompany, lsDepartment, parentItem); } }
protected void lookUpTree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e) { try { //return; if (treeOrganization.SelectedItem == null) { return; } if (treeOrganization.SelectedItem.GetType() != typeof(TreeViewItem)) return; TreeViewItem item = (TreeViewItem)treeOrganization.SelectedItem; //TODO: 这个方法在单选时选择有bug,可能是Selected事件与Checked事件有冲突 //CheckBox cbx = Helper.UIHelper.FindChildControl<CheckBox>(item); //if (cbx != null) // cbx.IsChecked = true; if (item == null || item.DataContext == null) return; if (item.IsExpanded == true) item.IsExpanded = false; else item.IsExpanded = true; OrgTreeItemTypes type = (OrgTreeItemTypes)(item.Tag); if ((SelectedObjType == OrgTreeItemTypes.All || SelectedObjType == OrgTreeItemTypes.Personnel) && type == OrgTreeItemTypes.Post) { //TODO:多选 ExtOrgObj obj = new ExtOrgObj(); obj = item.DataContext as ExtOrgObj; if (type == OrgTreeItemTypes.Post && obj != null) { //加载员工 BindEmployee(item, obj.ObjectID); } } else if (type == OrgTreeItemTypes.Department) { ExtOrgObj obj = new ExtOrgObj(); obj = item.DataContext as ExtOrgObj; if (depIDsCach.ContainsKey(obj.ObjectID)) return; BindPosition(obj.ObjectID, item); } else { string sss = string.Empty; } } catch (Exception ex) { string ss = ex.ToString(); } }
void DocDistrbuteClient_GetDocDistrbuteInfosCompleted(object sender, GetDocDistrbuteInfosCompletedEventArgs e) { try { if (e.Error == null) { if (e.Result != null) { List<SMT.SaaS.OA.UI.SmtOACommonOfficeService.T_OA_DISTRIBUTEUSER> distributeList = e.Result.ToList(); foreach (var h in distributeList) { object obj = new object(); SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj extOrgObj = new SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj(); if (h.VIEWTYPE == ((int)SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company).ToString()) { T_HR_COMPANY tmp = new T_HR_COMPANY(); tmp.COMPANYID = h.VIEWER; tmp.CNAME = ""; obj = tmp; } else if (h.VIEWTYPE == ((int)SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Department).ToString()) { T_HR_DEPARTMENT tmp = new T_HR_DEPARTMENT(); tmp.DEPARTMENTID = h.VIEWER; T_HR_DEPARTMENTDICTIONARY tmpdict = new T_HR_DEPARTMENTDICTIONARY(); tmpdict.DEPARTMENTNAME = ""; tmp.T_HR_DEPARTMENTDICTIONARY = tmpdict; obj = tmp; } else if (h.VIEWTYPE == ((int)SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Post).ToString()) { T_HR_POST tmp = new T_HR_POST(); tmp.POSTLEVEL = System.Convert.ToDecimal(h.VIEWER); T_HR_POSTDICTIONARY tmpdict = new T_HR_POSTDICTIONARY(); tmpdict.POSTNAME = ""; tmp.T_HR_POSTDICTIONARY = tmpdict; obj = tmp; } else if (h.VIEWTYPE == ((int)SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel).ToString()) { T_HR_EMPLOYEE tmp = new T_HR_EMPLOYEE(); tmp.EMPLOYEEID = h.VIEWER; tmp.EMPLOYEECNAME = ""; obj = tmp; } extOrgObj.ObjectInstance = obj; issuanceExtOrgObj.Add(extOrgObj); } BindData(); } } else Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), e.Error.Message); } catch (Exception ex) { //HtmlPage.Window.Alert(ex.ToString()); Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(ex.Message.ToString())); } }
private void GetCompanyExtOrgObj(List<SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY> LstOldCompanys, List<SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY> LstCompanys) { if (LstCompanys.Count() > 0) { LstCompanys.ToList().ForEach(child => { StrCompanyIDsList.Add(child.COMPANYID); //issuanceExtOrgObj.Add(item); ExtOrgObj objSecond = new ExtOrgObj(); objSecond.ObjectID = child.COMPANYID; objSecond.ObjectName = child.CNAME; objSecond.ObjectType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company; var ExistEnts = from ext in entall where ext.ObjectID == child.COMPANYID && ext.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company select ext; if (ExistEnts.Count() == 0) { entall.Add(objSecond); } var ents = from childcompany in LstOldCompanys where childcompany.T_HR_COMPANY2 != null && childcompany.T_HR_COMPANY2.COMPANYID == child.COMPANYID select childcompany; if (ents.Count() > 0) { GetCompanyExtOrgObj(LstOldCompanys,ents.ToList()); } }); } }
/// <summary> /// 删除部门项 /// </summary> /// <param name="allMenu"></param> private void RemoveDepartment(T_HR_DEPARTMENT delDepartment) { if (delDepartment == null) { return; } if (this.DataContext == null) { return; } if (DtGridDepartment.ItemsSource == null) { return; } List<T_HR_DEPARTMENT> entDepartmentList = new List<T_HR_DEPARTMENT>(); foreach (T_HR_DEPARTMENT dt in DtGridDepartment.ItemsSource) { entDepartmentList.Add(dt); } if (entDepartmentList.Count() == 0) { return; } for (int i = 0; i < entDepartmentList.Count(); i++) { T_HR_DEPARTMENT entDepartment = entDepartmentList[i] as T_HR_DEPARTMENT; if (entDepartment.DEPARTMENTID == delDepartment.DEPARTMENTID) { entDepartmentList.Remove(entDepartment); break; } } ExtOrgObj extDepartment = new ExtOrgObj(); extDepartment.ObjectInstance = delDepartment; RemoveCustomPermissionByExtOrgObj(extDepartment); }
private void lkSelectObj_FindClick(object sender, EventArgs e) { string userID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID; string perm = (((int)FormTypes.Browse) + 1).ToString(); //zl 3.1 //string entity = "MonthlyBudgetAnalysis"; //OrganizationLookup ogzLookup = new OrganizationLookup(userID, perm, entity); OrganizationLookup ogzLookup = new OrganizationLookup(); ogzLookup.MultiSelected = true; ogzLookup.SelectedObjType = OrgTreeItemTypes.Company; //ogzLookup.ShowMessageForSelectOrganization(); ogzLookup.SelectedClick += (o, ev) => { StrCompanyIDsList.Clear(); List<ExtOrgObj> ent = ogzLookup.SelectedObj as List<ExtOrgObj>; if (ent.Count() == 0) { return; } List<ExtOrgObj> entall = new List<ExtOrgObj>(); if (ent != null && ent.Count > 0) { //issuanceExtOrgObj = ent; string StrCompanyName = ""; foreach (var h in ent) { if (h.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company)//公司 { StrCompanyIDsList.Add(h.ObjectID); //先添加总公司 ExtOrgObj obj2 = new ExtOrgObj(); obj2.ObjectID = h.ObjectID; obj2.ObjectName = h.ObjectName; obj2.ObjectType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company; entall.Add(obj2); lkSelectObj.DataContext = (SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY)h.ObjectInstance; lkSelectObj.DisplayMemberPath = "CNAME"; StrCompanyName += h.ObjectName + ","; } } if (!string.IsNullOrEmpty(StrCompanyName)) { StrCompanyName = StrCompanyName.Substring(0,StrCompanyName.Length-1); } ToolTipService.SetToolTip(lkSelectObj.TxtLookUp,StrCompanyName); } }; ogzLookup.Show<string>(DialogMode.ApplicationModal, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { }, true, userID); }
IssuanceObjectType GetObjectType(ExtOrgObj objExt)//判断过滤LookUp { switch (objExt.ObjectType) { case FrUi.OrgTreeItemTypes.Company: return IssuanceObjectType.Company; case FrUi.OrgTreeItemTypes.Department: return IssuanceObjectType.Department; case FrUi.OrgTreeItemTypes.Post: return IssuanceObjectType.Post; default: return IssuanceObjectType.Employee; } }
//获取发布对象 void DocDistrbuteClient_GetDocDistrbuteInfosCompleted(object sender, GetDocDistrbuteInfosCompletedEventArgs e) { try { if (e.Error == null) { if (e.Result != null) { List<SMT.SaaS.OA.UI.SmtOACommonOfficeService.T_OA_DISTRIBUTEUSER> distributeList = e.Result.ToList(); foreach (var h in distributeList) { object obj = new object(); SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj extOrgObj = new SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj(); if (h.VIEWTYPE == ((int)SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company).ToString()) { T_HR_COMPANY tmp = new T_HR_COMPANY(); tmp.COMPANYID = h.VIEWER; //tmp.CNAME = ""; tmp.CNAME = Utility.GetCompanyName(tmp.COMPANYID); obj = tmp; } else if (h.VIEWTYPE == ((int)SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Department).ToString()) { T_HR_DEPARTMENT tmp = new T_HR_DEPARTMENT(); tmp.DEPARTMENTID = h.VIEWER; T_HR_DEPARTMENTDICTIONARY tmpdict = new T_HR_DEPARTMENTDICTIONARY(); //tmpdict.DEPARTMENTNAME = ""; tmpdict.DEPARTMENTNAME = Utility.GetDepartmentName(h.VIEWER); tmp.T_HR_DEPARTMENTDICTIONARY = tmpdict; obj = tmp; } else if (h.VIEWTYPE == ((int)SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Post).ToString()) { T_HR_POST tmp = new T_HR_POST(); tmp.POSTLEVEL = System.Convert.ToDecimal(h.VIEWER); T_HR_POSTDICTIONARY tmpdict = new T_HR_POSTDICTIONARY(); //tmpdict.POSTNAME = ""; tmpdict.POSTNAME = Utility.GetPostName(h.VIEWER); tmp.T_HR_POSTDICTIONARY = tmpdict; obj = tmp; } else if (h.VIEWTYPE == ((int)SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel).ToString()) { T_HR_EMPLOYEE tmp = new T_HR_EMPLOYEE(); tmp.EMPLOYEEID = h.VIEWER; tmp.EMPLOYEECNAME = ""; obj = tmp; } extOrgObj.ObjectInstance = obj; issuanceExtOrgObj.Add(extOrgObj); } BindData(); } } else Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), e.Error.Message); } catch (Exception ex) { //HtmlPage.Window.Alert(ex.ToString()); Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(ex.Message.ToString())); } }
private void LookUp_FindClick(object sender, EventArgs e) { //Dictionary<string, string> cols = new Dictionary<string, string>(); //cols.Add("EMPLOYEECODE", "T_HR_EMPLOYEE.EMPLOYEECODE"); //cols.Add("EMPLOYEECNAME", "T_HR_EMPLOYEE.EMPLOYEECNAME"); //cols.Add("EMPLOYEEENAME", "T_HR_EMPLOYEE.EMPLOYEEENAME"); //LookupForm lookup = new LookupForm(SMT.Saas.Tools.OrganizationWS.EntityNames.Employee, // typeof(SMT.Saas.Tools.OrganizationWS.V_EMPLOYEEPOST[]), cols); //lookup.SelectedClick += (o, ev) => //{ // SMT.Saas.Tools.OrganizationWS.V_EMPLOYEEPOST ent = lookup.SelectedObj as SMT.Saas.Tools.OrganizationWS.V_EMPLOYEEPOST;; // if (ent != null) // { // lkEmployeeName.DataContext = ent.T_HR_EMPLOYEE; // client.GetEmployeeEntryByEmployeeIDAsync(ent.T_HR_EMPLOYEE.EMPLOYEEID); // } //}; //lookup.Show<string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) =>{}); OrganizationLookup lookup = new OrganizationLookup(); lookup.SelectedObjType = OrgTreeItemTypes.Personnel; lookup.SelectedClick += (obj, ev) => { List <SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj> ent = lookup.SelectedObj as List <SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj>; if (ent != null && ent.Count > 0) { SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj userInfo = ent.FirstOrDefault(); SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj post = (SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj)userInfo.ParentObject; string postid = post.ObjectID; string postName = post.ObjectName;//岗位 SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj dept = (SMT.SaaS.FrameworkUI.OrganizationControl.ExtOrgObj)post.ParentObject; string deptid = dept.ObjectID; string deptName = dept.ObjectName;//部门 SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY corp = (dept.ObjectInstance as SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT).T_HR_COMPANY; string corpid = corp.COMPANYID; string corpName = corp.CNAME;//公司 SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE emp = userInfo.ObjectInstance as SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE; T_HR_EMPLOYEEPOST empPost = emp.T_HR_EMPLOYEEPOST.Where(t => t.T_HR_POST.POSTID == postid).FirstOrDefault(); if (empPost == null) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), "检测员工当前岗位异常,请重试", Utility.GetResourceStr("CONFIRM"), MessageIcon.Information); return; } if (empPost.ISAGENCY == "1") { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), "员工兼职岗位不能转正", Utility.GetResourceStr("CONFIRM"), MessageIcon.Information); return; } string StrEmployee = userInfo.ObjectName + "-" + post.ObjectName + "-" + dept.ObjectName + "-" + corp.CNAME; lkEmployeeName.TxtLookUp.Text = StrEmployee; lkEmployeeName.DataContext = emp; ToolTipService.SetToolTip(lkEmployeeName.TxtLookUp, StrEmployee); if (ent != null) { //client.GetEmployeeEntryByEmployeeIDAsync(ent.EMPLOYEEID); client.GetEmployeeEntryByEmployeeIDAndCOMPANYIDAsync(emp.EMPLOYEEID, emp.OWNERCOMPANYID); client.GetEmployeePostByEmployeeIDAsync(emp.EMPLOYEEID); } } //SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE ent = lookup.SelectedObj[0].ObjectInstance as SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE; //if (ent != null) //{ // lkEmployeeName.DataContext = ent; // //client.GetEmployeeEntryByEmployeeIDAsync(ent.EMPLOYEEID); // client.GetEmployeeEntryByEmployeeIDAndCOMPANYIDAsync(ent.EMPLOYEEID, ent.OWNERCOMPANYID); // client.GetEmployeePostByEmployeeIDAsync(ent.EMPLOYEEID); //} }; lookup.Show <string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { }); }