Example #1
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;
        }
Example #2
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);
            }
        }
Example #3
0
        internal List<VirtualPost> GetVirtualPost(QueryExpression qe)
        {
            List<VirtualPost> listPost = new List<VirtualPost>();
            string action = ((int)Utility.Permissions.Browse).ToString();
            //if (listPost.Count == 0)
            //{
                List<OrganizationWS.T_HR_POST> postList = organizationService.GetPostByEntityPerm(qe.VisitUserID, action, qe.VisitModuleCode).ToList();

                postList.ForEach(postHR =>
                {
                    VirtualPost vp = new VirtualPost();
                    vp.ID = postHR.POSTID;
                    vp.Name = postHR.T_HR_POSTDICTIONARY.POSTNAME;
                    listPost.Add(vp);
                });
            //}
            return listPost;
        }