예제 #1
0
        void orderEntityService_QueryFBEntitiesCompleted(object sender, QueryFBEntitiesCompletedEventArgs e)
        {
            Dictionary <VirtualCompany, TreeViewItem> dictCompany = new Dictionary <VirtualCompany, TreeViewItem>();

            //  this.TreeView.Items.Clear();
            List <OrderEntity> listDepartment = e.Result.ToEntityAdapterList <OrderEntity>().ToList();

            if (currTreeItmes != null)
            {
                currTreeItmes.Items.Clear();
            }
            if (!isInit)
            {
                this.TreeView.Items.Clear();
            }
            listDepartment.ForEach(department =>
            {
                TreeViewItem tvItemCompany          = null;
                VirtualDepartment virtualDepartment = department.Entity as VirtualDepartment;
                if (isInit)
                {
                    tvItemCompany = currTreeItmes.Items.AddObject <OrderEntity>(department, "Entity.Name");
                    tvItemCompany.Items.AddObjectList <VirtualPost>(virtualDepartment.PostCollection.ToList(), "Name");
                    dictDepartment.Add(virtualDepartment, department);
                    AttachEventToSubjectDepartment(department);
                    EntityList.Add(department);
                }
                else
                {
                    if (!dictCompany.ContainsKey(virtualDepartment.VirtualCompany))
                    {
                        tvItemCompany = this.TreeView.Items.AddObject <VirtualCompany>(virtualDepartment.VirtualCompany, "Name");
                        dictCompany.Add(virtualDepartment.VirtualCompany, tvItemCompany);
                    }
                    tvItemCompany = dictCompany[virtualDepartment.VirtualCompany];
                    TreeViewItem tvItemDepartment = tvItemCompany.Items.AddObject <OrderEntity>(department, "Entity.Name");
                    tvItemDepartment.Items.AddObjectList <VirtualPost>(virtualDepartment.PostCollection.ToList(), "Name");
                    //dictDepartment.Add(virtualDepartment, department);
                    // AttachEventToSubjectDepartment(department);
                    // EntityList.Add(department);
                }
                //  tvItemCompany = this.TreeView.Items.AddObject<VirtualCompany>(virtualDepartment.VirtualCompany, "Name");
            });
            //TreeViewItem tvi = this.TreeView.Items.FirstOrDefault() as TreeViewItem;
            //if (tvi != null)
            //{
            //    tvi.IsSelected = true;

            //    RoutedPropertyChangedEventArgs<object> ea = new RoutedPropertyChangedEventArgs<object>(null, tvi);
            //    TreeView_SelectedItemChanged(tvi, ea);
            //}
            isInit = true;
            this.CloseProcess();
        }
예제 #2
0
            public GroupSubject(FBEntity fbEntity)
            {
                innerFBEntity         = fbEntity;
                this.Entity           = innerFBEntity.Entity;
                this.CollectionEntity = innerFBEntity.CollectionEntity;
                this.ReferencedEntity = innerFBEntity.ReferencedEntity;

                VirtualDepartment vd = innerFBEntity.ReferencedEntity[0].FBEntity.Entity as VirtualDepartment;

                this.DepartmentName = vd.Name;
            }
예제 #3
0
        public List <VirtualCompany> InitData()
        {
            string userID = "";

            List <OrganizationWS.T_HR_COMPANY>    comList  = organizationService.GetCompanyActived(userID).ToList();
            List <OrganizationWS.T_HR_DEPARTMENT> deptList = organizationService.GetDepartmentActived(userID).ToList();
            List <OrganizationWS.T_HR_POST>       postList = organizationService.GetPostActived(userID).ToList();

            List <VirtualCompany> listCompany = new List <VirtualCompany>();

            comList.ForEach(comHR =>
            {
                List <VirtualDepartment> listDepartment = new List <VirtualDepartment>();

                VirtualCompany vc       = new VirtualCompany();
                vc.ID                   = comHR.COMPANYID;
                vc.Name                 = comHR.CNAME;
                vc.DepartmentCollection = listDepartment;
                listCompany.Add(vc);

                List <OrganizationWS.T_HR_DEPARTMENT> deptListPart = deptList.FindAll(item =>
                {
                    return(item.T_HR_COMPANY.COMPANYID == comHR.COMPANYID);
                });

                deptListPart.ForEach(deptHR =>
                {
                    List <VirtualPost> listPost = new List <VirtualPost>();

                    VirtualDepartment vd = new VirtualDepartment();
                    vd.ID             = deptHR.DEPARTMENTID;
                    vd.Name           = deptHR.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME;
                    vd.VirtualCompany = vc;
                    vd.PostCollection = listPost;
                    listDepartment.Add(vd);

                    List <OrganizationWS.T_HR_POST> postListPart = postList.FindAll(item =>
                    {
                        return(item.T_HR_DEPARTMENT.DEPARTMENTID == deptHR.DEPARTMENTID);
                    });
                    postListPart.ForEach(postHR =>
                    {
                        VirtualPost vp       = new VirtualPost();
                        vp.ID                = postHR.POSTID;
                        vp.Name              = postHR.T_HR_POSTDICTIONARY.POSTNAME;
                        vp.VirtualCompany    = vc;
                        vp.VirtualDepartment = vd;
                        listPost.Add(vp);
                    });
                });
            });
            return(listCompany);
        }
예제 #4
0
        internal List <VirtualDepartment> GetVirtualDepartment(QueryExpression qe)
        {
            List <VirtualDepartment> listDepartment = new List <VirtualDepartment>();
            string action = ((int)Utility.Permissions.Browse).ToString();
            //if (listDepartment.Count == 0)
            //{
            List <OrganizationWS.V_DEPARTMENT> deptList = organizationService.GetDepartmentView(qe.VisitUserID, action, qe.VisitModuleCode).ToList();

            deptList.ForEach(deptHR =>
            {
                VirtualDepartment vd = new VirtualDepartment();
                vd.ID   = deptHR.DEPARTMENTID;
                vd.Name = deptHR.DEPARTMENTNAME;
                listDepartment.Add(vd);
            });
            //}
            return(listDepartment);
        }
예제 #5
0
        public List <FBEntity> GetCompany(QueryExpression qe)
        {
            //string strType=qe.QueryType;
            //switch (strType)
            //{
            //    case "T_FB_SUBJECTDEPTMENT":
            //        listC = InnerGetCompany(qe);
            //        break;
            //    case "T_FB_SUBJECTCOMPANY":
            //        listC = InnerGetCompany(qe);
            //        break;
            //    case "T_FB_SUBJECTPOST":
            //        listC = InnerGetCompany(qe);
            //        break;
            //    case "T_FB_SUBJECTCOMPANYSET":
            //        listC = InnerGetCompany(qe);
            //        break;
            //    default:
            //        break;
            //}
            List <VirtualCompany> listC      = InnerGetCompany(qe);
            List <FBEntity>       listResult = listC.ToFBEntityList();

            listResult.ForEach(company =>
            {
                VirtualCompany vcCompany       = company.Entity as VirtualCompany;
                List <FBEntity> listDepartMent = vcCompany.DepartmentCollection.ToFBEntityList();
                RelationManyEntity rme         = new RelationManyEntity();
                rme.EntityType = typeof(VirtualDepartment).Name;
                rme.FBEntities = listDepartMent;
                company.CollectionEntity.Add(rme);

                listDepartMent.ForEach(department =>
                {
                    VirtualDepartment virtualDepartment = department.Entity as VirtualDepartment;
                    List <FBEntity> listPost            = virtualDepartment.PostCollection.ToFBEntityList();
                    RelationManyEntity rmePost          = new RelationManyEntity();
                    rmePost.EntityType = typeof(VirtualPost).Name;
                    rmePost.FBEntities = listPost;
                    department.CollectionEntity.Add(rmePost);
                });
            });
            return(listResult);
        }
예제 #6
0
        public List <VirtualCompany> InnerGetCompany(QueryExpression qe)
        {
            try
            {
                string action = ((int)Utility.Permissions.Browse).ToString();

                List <OrganizationWS.T_HR_COMPANY> comList   = organizationService.GetCompanyByEntityPerm(qe.VisitUserID, action, qe.VisitModuleCode).ToList();
                List <OrganizationWS.V_DEPARTMENT> deptList  = organizationService.GetDepartmentView(qe.VisitUserID, action, qe.VisitModuleCode).ToList();
                List <OrganizationWS.V_POST>       vpostList = organizationService.GetPostView(qe.VisitUserID, action, qe.VisitModuleCode).ToList();
                //有效的部门和岗位
                deptList  = deptList.Where(s => s.EDITSTATE == "1").ToList();
                vpostList = vpostList.Where(s => s.EDITSTATE == "1").ToList();
                List <OrganizationWS.T_HR_POST> postList = new List <OrganizationWS.T_HR_POST>();
                try
                {
                    foreach (var ent in vpostList)
                    {
                        OrganizationWS.T_HR_POST pt = new OrganizationWS.T_HR_POST();
                        pt.POSTID       = ent.POSTID;
                        pt.FATHERPOSTID = ent.FATHERPOSTID;
                        pt.CHECKSTATE   = ent.CHECKSTATE;
                        pt.EDITSTATE    = ent.EDITSTATE;

                        pt.T_HR_POSTDICTIONARY = new OrganizationWS.T_HR_POSTDICTIONARY();
                        pt.T_HR_POSTDICTIONARY.POSTDICTIONARYID = Guid.NewGuid().ToString();
                        pt.T_HR_POSTDICTIONARY.POSTNAME         = ent.POSTNAME;

                        pt.T_HR_DEPARTMENT = new OrganizationWS.T_HR_DEPARTMENT();
                        try
                        {
                            string strDepartmentid = deptList.Where(s => s.DEPARTMENTID == ent.DEPARTMENTID).FirstOrDefault().DEPARTMENTID;
                            pt.T_HR_DEPARTMENT.DEPARTMENTID = strDepartmentid;
                            postList.Add(pt);
                        }
                        catch (Exception ex)
                        {
                            SystemBLL.Debug("当前员工:" + qe.VisitUserID + "查询岗位所属部门错误,岗位名称 " + ent.POSTNAME + "岗位id" + ent.POSTID + "没找到所属部门,可能是权限不足导致");
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }


                List <VirtualCompany> listCompany = new List <VirtualCompany>();
                try
                {
                    comList.ForEach(comHR =>
                    {
                        List <VirtualDepartment> listDepartment = new List <VirtualDepartment>();


                        VirtualCompany vc       = new VirtualCompany();
                        vc.ID                   = comHR.COMPANYID;
                        vc.Name                 = comHR.CNAME;
                        vc.DepartmentCollection = listDepartment;
                        listCompany.Add(vc);

                        List <OrganizationWS.V_DEPARTMENT> deptListPart = deptList.FindAll(item =>
                        {
                            if (item.COMPANYID == null)
                            {
                                return(false);
                            }
                            return(item.COMPANYID == comHR.COMPANYID);
                        });
                        deptListPart.ForEach(deptHR =>
                        {
                            try
                            {
                                List <VirtualPost> listPost = new List <VirtualPost>();

                                VirtualDepartment vd = new VirtualDepartment();
                                vd.ID             = deptHR.DEPARTMENTID;
                                vd.Name           = deptHR.DEPARTMENTNAME;
                                vd.VirtualCompany = vc;
                                vd.PostCollection = listPost;
                                listDepartment.Add(vd);

                                List <OrganizationWS.T_HR_POST> postListPart = postList.FindAll(item =>
                                {
                                    if (item.T_HR_DEPARTMENT.DEPARTMENTID == null)
                                    {
                                        return(false);
                                    }
                                    return(item.T_HR_DEPARTMENT.DEPARTMENTID == deptHR.DEPARTMENTID);
                                });
                                postListPart.ForEach(postHR =>
                                {
                                    try
                                    {
                                        VirtualPost vp       = new VirtualPost();
                                        vp.ID                = postHR.POSTID;
                                        vp.Name              = postHR.T_HR_POSTDICTIONARY.POSTNAME;
                                        vp.VirtualCompany    = vc;
                                        vp.VirtualDepartment = vd;
                                        listPost.Add(vp);
                                    }
                                    catch (Exception ex)
                                    {
                                        throw ex;
                                    }
                                });
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                        });
                    });
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                return(listCompany);
            }
            catch (Exception ex)
            {
                SystemBLL.Debug(ex.ToString());
                throw new Exception("调用HR服务异常", ex);
            }
        }
예제 #7
0
        /// <summary>
        /// 处理 部门项目actived 改变时,相应的增减对应的岗位项目
        ///
        /// </summary>
        /// <remarks>
        ///     1. 去除 SubjectPost的所有关联,如有跟其他实体有关联,再提交服务端时,可能会出错
        ///     2. 从 RelationCollection中去掉 SubjectPost
        ///     3. 根据 SubjectDepartment 是否启用,对SubjectPost进行相应处理
        ///        Y.新增SubjectPost 到集合中
        ///        N.从集合中去除SubjectPost
        /// </remarks>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void SubjectDepartment_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "ACTIVED" || e.PropertyName == "ISPERSON")
            {
                T_FB_SUBJECTDEPTMENT subjectDepartment = sender as T_FB_SUBJECTDEPTMENT;

                VirtualDepartment vd             = this.currentOrderEntity.Entity as VirtualDepartment;
                OrderEntity       curOrderEntity = this.dictDepartment[vd];

                // 3.如果是不启用的部门科目,则从各个岗位项目对象中去除 SubjectPost, 否则,添加相应的subjectPost

                foreach (TreeViewItem item in this.currentTreeViewItem.Items)
                {
                    OrderEntity oe = item.DataContext as OrderEntity;
                    if (oe != null)
                    {
                        VirtualPost virtualPost = oe.Entity as VirtualPost;
                        // 启用科目,添加新subjectpost.
                        if (subjectDepartment.ACTIVED == 1)
                        {
                            if (e.PropertyName == "ACTIVED")//启用科目
                            {
                                //FBEntity fbEntityPostNew = CreateSubjectPost(subjectDepartment, virtualPost, "ACTIVED");
                                //oe.FBEntity.AddFBEntities<T_FB_SUBJECTPOST>(new List<FBEntity> { fbEntityPostNew });

                                CreatePostEntity(virtualPost, item, "ACTIVED");
                            }
                            else if (e.PropertyName == "ISPERSON")//修改科目
                            {
                                oe = IsPersonChanged(oe, subjectDepartment);
                            }
                        }
                        else // 从集合中去除相应的subjectPost
                        {
                            if (subjectDepartment.T_FB_SUBJECTPOST != null)
                            {
                                foreach (var postEnt in subjectDepartment.T_FB_SUBJECTPOST)
                                {
                                    CreateNonActionSubjectPost(subjectDepartment, postEnt, virtualPost);
                                }
                            }
                            ObservableCollection <FBEntity> fbEntities = oe.GetRelationFBEntities(typeof(T_FB_SUBJECTPOST).Name);
                            fbEntities.RemoveAll(entity =>
                            {
                                return((entity.Entity as T_FB_SUBJECTPOST).T_FB_SUBJECTDEPTMENT.SUBJECTDEPTMENTID == subjectDepartment.SUBJECTDEPTMENTID);
                            });
                        }
                    }
                    else //处理修改部门数据后,默认处理岗位数据
                    {
                        VirtualPost virtualPost = item.DataContext as VirtualPost;
                        if (virtualPost == null)
                        {
                            continue;
                        }

                        // 启用科目,添加新subjectpost.
                        if (subjectDepartment.ACTIVED == 1)
                        {
                            if (e.PropertyName == "ACTIVED")//启用科目
                            {
                                //  FBEntity fbEntityPostNew = CreateSubjectPost(subjectDepartment, virtualPost, "ACTIVED");
                                //  curOrderEntity.FBEntity.AddFBEntities<T_FB_SUBJECTPOST>(new List<FBEntity> { fbEntityPostNew });

                                CreatePostEntity(virtualPost, item, "ACTIVED");
                            }
                            else if (e.PropertyName == "ISPERSON")//修改科目
                            {
                                curOrderEntity = IsPersonChanged(curOrderEntity, subjectDepartment);
                            }
                        }
                        else // 从集合中去除相应的subjectPost
                        {
                            if (subjectDepartment.T_FB_SUBJECTPOST != null)
                            {
                                foreach (var postEnt in subjectDepartment.T_FB_SUBJECTPOST)
                                {
                                    CreateNonActionSubjectPost(subjectDepartment, postEnt, virtualPost);
                                }
                            }
                            ObservableCollection <FBEntity> fbEntities = curOrderEntity.GetRelationFBEntities(typeof(T_FB_SUBJECTPOST).Name);
                            fbEntities.RemoveAll(entity =>
                            {
                                return((entity.Entity as T_FB_SUBJECTPOST).T_FB_SUBJECTDEPTMENT.SUBJECTDEPTMENTID == subjectDepartment.SUBJECTDEPTMENTID);
                            });
                        }
                    }
                }
            }
        }
예제 #8
0
        /// <summary>
        /// 可用额度汇总
        /// </summary>
        /// <param name="qe"></param>
        /// <returns></returns>
        public List <FBEntity> QueryQueryBudgetAccount(QueryExpression qe)
        {
            // qe.VisitModuleCode = typeof(T_FB_BUDGETACCOUNT).Name;
            qe.Include = new string[] { "T_FB_SUBJECT" };

            qe.QueryType = "T_FB_BUDGETACCOUNT";
            if (qe.RightType != "QueryBudgetAccount")
            {
                qe.RightType = "QueryBudgetAccount";
            }

            List <T_FB_BUDGETACCOUNT> listBudgetAccount = GetEntities <T_FB_BUDGETACCOUNT>(qe);

            List <T_FB_BUDGETACCOUNT> listBAPerson = listBudgetAccount.FindAll(item =>
            {
                return(!string.IsNullOrEmpty(item.OWNERID));
            });
            List <string> listUserIDs = listBAPerson.CreateList(item =>
            {
                return(item.OWNERID);
            });
            OrganizationBLL          orgbll         = new OrganizationBLL();
            List <VirtualUser>       listUser       = orgbll.GetVirtualUser(listUserIDs);
            List <VirtualCompany>    listCompany    = orgbll.GetVirtualCompany(qe);
            List <VirtualDepartment> listDepartment = orgbll.GetVirtualDepartment(qe);
            List <VirtualPost>       listPost       = orgbll.GetVirtualPost(qe);


            listBudgetAccount.ForEach(item =>
            {
                VirtualCompany vc = listCompany.FirstOrDefault(item2 =>
                {
                    return(item2.ID == item.OWNERCOMPANYID);
                });
                item.OWNERCOMPANYID = vc == null ? "" : vc.Name;

                VirtualDepartment vd = listDepartment.FirstOrDefault(item2 =>
                {
                    return(item2.ID == item.OWNERDEPARTMENTID);
                });
                item.OWNERDEPARTMENTID = vd == null ? "" : vd.Name;

                VirtualPost vp = listPost.FirstOrDefault(item2 =>
                {
                    return(item2.ID == item.OWNERPOSTID);
                });
                item.OWNERPOSTID = vp == null ? "" : vp.Name;

                VirtualUser vu = listUser.FirstOrDefault(item2 =>
                {
                    return(item2.ID == item.OWNERID);
                });
                item.OWNERID = vu == null ? "" : vu.Name;
            });
            listBudgetAccount = listBudgetAccount.OrderByDescending(item => item.BUDGETYEAR)
                                .ThenByDescending(item => item.BUDGETMONTH)
                                .ThenBy(item => item.ACCOUNTOBJECTTYPE)
                                .ThenBy(item => item.OWNERCOMPANYID)
                                .ThenBy(item => item.OWNERDEPARTMENTID)
                                .ThenBy(item => item.OWNERPOSTID)
                                .ThenBy(item => item.OWNERID).ToList();
            return(listBudgetAccount.ToFBEntityList());
        }
예제 #9
0
파일: DataCore.cs 프로젝트: jjg0519/OA
        //public static void InitHR()
        //{
        //    try
        //    {
        //        IList<CompanyData> listCData = new List<CompanyData>();
        //        IList<DepartmentData> ListDData = new List<DepartmentData>();
        //        IList<PostData> ListPData = new List<PostData>();

        //        List<OrganizationWS.T_HR_COMPANY> comList = (List<OrganizationWS.T_HR_COMPANY>)App.Current.Resources["SYS_CompanyInfo"];
        //        List<OrganizationWS.T_HR_DEPARTMENT> deptList = (List<OrganizationWS.T_HR_DEPARTMENT>)App.Current.Resources["SYS_DepartmentInfo"];
        //        List<OrganizationWS.T_HR_POST> postList = (List<OrganizationWS.T_HR_POST>)App.Current.Resources["SYS_PostInfo"];


        //        comList.ForEach(comHR =>
        //        {
        //            ObservableCollection<VirtualDepartment> listDepartment = new ObservableCollection<VirtualDepartment>();

        //            VirtualCompany vc = new VirtualCompany();
        //            vc.ID = comHR.COMPANYID;
        //            vc.Name = comHR.CNAME;
        //            vc.DepartmentCollection = listDepartment;


        //            CompanyData cData = CreateItem<CompanyData>(vc);
        //            List<DepartmentData> listDepartmentData = new List<DepartmentData>();

        //            List<OrganizationWS.T_HR_DEPARTMENT> deptListPart = deptList.FindAll(item =>
        //            {
        //                if (item.T_HR_COMPANY == null)
        //                {
        //                    return false;
        //                }
        //                return item.T_HR_COMPANY.COMPANYID == comHR.COMPANYID;

        //            });

        //            deptListPart.ForEach(deptHR =>
        //            {
        //                ObservableCollection<VirtualPost> listPost = new ObservableCollection<VirtualPost>();

        //                VirtualDepartment vd = new VirtualDepartment();
        //                vd.ID = deptHR.DEPARTMENTID;
        //                vd.Name = deptHR.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME;
        //                vd.VirtualCompany = vc;
        //                vd.PostCollection = listPost;
        //                listDepartment.Add(vd);


        //                DepartmentData dData = CreateItem<DepartmentData>(vd);
        //                List<PostData> listPostData = new List<PostData>();

        //                List<OrganizationWS.T_HR_POST> postListPart = postList.FindAll(item =>
        //                {
        //                    if (item.T_HR_DEPARTMENT == null)
        //                    {
        //                        return false;
        //                    }
        //                    return item.T_HR_DEPARTMENT.DEPARTMENTID == deptHR.DEPARTMENTID;
        //                });

        //                postListPart.ForEach(postHR =>
        //                {
        //                    VirtualPost vp = new VirtualPost();
        //                    vp.ID = postHR.POSTID;
        //                    vp.Name = postHR.T_HR_POSTDICTIONARY.POSTNAME;
        //                    vp.VirtualCompany = vc;
        //                    vp.VirtualDepartment = vd;
        //                    listPost.Add(vp);


        //                    PostData pData = CreateItem<PostData>(vp);
        //                    pData.Company = cData;
        //                    pData.Department = dData;
        //                    listPostData.Add(pData);
        //                    ListPData.Add(pData);

        //                });

        //                dData.Company = cData;
        //                dData.PostCollection = listPostData;
        //                listDepartmentData.Add(dData);
        //                ListDData.Add(dData);
        //            });

        //            cData.DepartmentCollection = listDepartmentData;
        //            listCData.Add(cData);
        //            CompanyList.Add(vc);
        //        });

        //        ReferencedData<CompanyData>.RefData = listCData;
        //        ReferencedData<DepartmentData>.RefData = ListDData;
        //        ReferencedData<PostData>.RefData = ListPData;
        //    }
        //    catch (Exception ex)
        //    {
        //        System.Diagnostics.Debug.WriteLine(ex);
        //        throw new Exception("调用HR服务异常", ex);
        //    }
        //}

        #endregion

        /// <summary>
        /// 新的,从平台组织架构缓存中加载。
        /// </summary>
        public static void InitHR()
        {
            try
            {
                IList <CompanyData>    listCData = new List <CompanyData>();
                IList <DepartmentData> ListDData = new List <DepartmentData>();
                IList <PostData>       ListPData = new List <PostData>();


                List <OrganizationWS.T_HR_COMPANY> comList
                    = App.Current.Resources["SYS_CompanyInfo"] as List <OrganizationWS.T_HR_COMPANY> ?? new List <OrganizationWS.T_HR_COMPANY>();
                List <OrganizationWS.T_HR_DEPARTMENT> deptList
                    = App.Current.Resources["SYS_DepartmentInfo"] as List <OrganizationWS.T_HR_DEPARTMENT> ?? new List <OrganizationWS.T_HR_DEPARTMENT>();
                List <OrganizationWS.T_HR_POST> postList
                    = App.Current.Resources["SYS_PostInfo"] as List <OrganizationWS.T_HR_POST> ?? new List <OrganizationWS.T_HR_POST>();


                comList.ForEach(comHR =>
                {
                    ObservableCollection <VirtualDepartment> listDepartment = new ObservableCollection <VirtualDepartment>();

                    VirtualCompany vc       = new VirtualCompany();
                    vc.ID                   = comHR.COMPANYID;
                    vc.Name                 = comHR.CNAME;
                    vc.DepartmentCollection = listDepartment;


                    CompanyData cData = CreateItem <CompanyData>(vc);
                    List <DepartmentData> listDepartmentData = new List <DepartmentData>();

                    List <OrganizationWS.T_HR_DEPARTMENT> deptListPart = deptList.FindAll(item =>
                    {
                        if (item.T_HR_COMPANY == null)
                        {
                            return(false);
                        }
                        return(item.T_HR_COMPANY.COMPANYID == comHR.COMPANYID);
                    });

                    deptListPart.ForEach(deptHR =>
                    {
                        ObservableCollection <VirtualPost> listPost = new ObservableCollection <VirtualPost>();

                        VirtualDepartment vd = new VirtualDepartment();
                        vd.ID             = deptHR.DEPARTMENTID;
                        vd.Name           = deptHR.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME;
                        vd.VirtualCompany = vc;
                        vd.PostCollection = listPost;
                        listDepartment.Add(vd);


                        DepartmentData dData         = CreateItem <DepartmentData>(vd);
                        List <PostData> listPostData = new List <PostData>();

                        List <OrganizationWS.T_HR_POST> postListPart = postList.FindAll(item =>
                        {
                            if (item.T_HR_DEPARTMENT == null)
                            {
                                return(false);
                            }
                            return(item.T_HR_DEPARTMENT.DEPARTMENTID == deptHR.DEPARTMENTID);
                        });

                        postListPart.ForEach(postHR =>
                        {
                            VirtualPost vp       = new VirtualPost();
                            vp.ID                = postHR.POSTID;
                            vp.Name              = postHR.T_HR_POSTDICTIONARY.POSTNAME;
                            vp.VirtualCompany    = vc;
                            vp.VirtualDepartment = vd;
                            listPost.Add(vp);


                            PostData pData   = CreateItem <PostData>(vp);
                            pData.Company    = cData;
                            pData.Department = dData;
                            listPostData.Add(pData);
                            ListPData.Add(pData);
                        });

                        dData.Company        = cData;
                        dData.PostCollection = listPostData;
                        listDepartmentData.Add(dData);
                        ListDData.Add(dData);
                    });

                    cData.DepartmentCollection = listDepartmentData;
                    listCData.Add(cData);
                    CompanyList.Add(vc);
                });

                ReferencedData <CompanyData> .RefData    = listCData;
                ReferencedData <DepartmentData> .RefData = ListDData;
                ReferencedData <PostData> .RefData       = ListPData;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
                throw new Exception("调用HR服务异常", ex);
            }
        }