Example #1
0
        public PagerResultSet <Department> GetList(PagerParameter pageParameter, Action <IDepartmentDataLeave> option = null)
        {
            string sql            = "select * from Department";
            var    departmentList = _dbHelper.GetModelList <Department>(sql, null, pageParameter);

            DepartmentDataLeval dataLeval = new DepartmentDataLeval();

            if (option != null)
            {
                option(dataLeval);
                if (dataLeval.HasUser)
                {
                    var users = new List <UserInfo>(userInfoDataService.GetListAtCache());
                    foreach (var department in departmentList.Rows)
                    {
                        department.CreateUser  = users.Where(x => x.ID.Equals(department.CreateBy)).FirstOrDefault();
                        department.ManagerUser = users.Where(x => x.ID.Equals(department.Manager)).FirstOrDefault();
                    }
                }
                if (dataLeval.HasRotes)
                {
                    var roles = roleDataService.GetListByCatch();
                    foreach (var department in departmentList.Rows)
                    {
                        department.Roles = roles.Where(x => x.DepartmentID.Equals(department.ID)).ToList();
                    }
                }
            }
            return(departmentList);
        }
Example #2
0
 public override IEnumerable <UserInfo> GetData()
 {
     return(userInfoDataService.GetListAtCache());
 }