Пример #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;
        }
Пример #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);
            }
        }
Пример #3
0
        internal List<VirtualCompany> GetVirtualCompany(QueryExpression qe)
        {
            List<VirtualCompany> listCompany = new List<VirtualCompany>();
            string action = ((int)Utility.Permissions.Browse).ToString();
            string ModuleCode = qe.VisitModuleCode;
            if (qe.VisitModuleCode == "T_FB_SUBJECTCOMPANY_COMPANY")
            {
                ModuleCode = "T_FB_SUBJECTCOMPANY";
            }
            List<string> CompanyIds = new List<string>();
            //在公司科目维护中去掉以下2个公司
            CompanyIds.Add("427eb67d-35b4-47a9-9609-baf5355d2ed5");//深圳市神州通投资集团有限公司
            CompanyIds.Add("7cd6c0a4-9735-476a-9184-103b962d3383");//初始化公司
            List<OrganizationWS.T_HR_COMPANY> comList = organizationService.GetCompanyByEntityPerm(qe.VisitUserID, action, ModuleCode).ToList();

            comList.ForEach(comHR =>
            {
                VirtualCompany vc = new VirtualCompany();
                vc.ID = comHR.COMPANYID;
                vc.Name = comHR.CNAME;
                if (ModuleCode == "T_FB_SUBJECTCOMPANY" || ModuleCode == "T_FB_SUBJECTCOMPANYSET")
                {
                    if (!(CompanyIds.IndexOf(vc.ID) > -1))
                    {
                        listCompany.Add(vc);
                    }
                }
                else
                {
                    listCompany.Add(vc);
                }
                
            });
            return listCompany;
        }