Esempio n. 1
0
        public List <EMPLOYEE_EX> QueryEmpList(int deptId)
        {
            List <EMPLOYEE_EX> empList = null;

            if (deptId == 0)    //查询所有员工
            {
                empList = _empRepo.QueryAllList();
            }
            else
            {
                List <int> deptIds = new List <int>();
                deptIds.Add(deptId);
                //获取所有大区、区域
                var        groups   = _groupRepo.GetRecursiveAllByParentID(deptId);
                List <int> groupIds = groups.Select(m => m.ID).ToList();
                if (groupIds.Count > 0)
                {
                    deptIds.AddRange(groupIds);
                }
                //else
                //{
                //    groupIds.Add(deptId);
                //}
                //var stores = _storeRepo.GetByGroupID(groupIds.ToArray());
                //if (stores.Count > 0)
                //{
                //    var storeIds = stores.Select(m => m.ID).ToList();
                //    deptIds.AddRange(storeIds);
                //}

                empList = _empRepo.QueryList(deptIds.ToArray());
            }
            if (empList != null)
            {
                List <GROUP_INFO> groupList = _groupRepo.GetAll();

                foreach (var item in empList)
                {
                    string name = "";
                    this.GetParentDeptNames(groupList, item.DeptID, ref name);
                    item.FullDeptName = "/" + AppConfig.Get("QYDeptRootName") + name;
                }
            }

            return(empList);
        }
Esempio n. 2
0
 public List <GROUP_INFO> GetAllGroup()
 {
     return(_groupRepo.GetAll());
 }