Exemple #1
0
        public OperationResult FindByPageWithFullInfo(Expression <Func <Module, bool> > where, Func <IQueryable <Module>, IOrderedQueryable <Module> > orderBy, PageArgs pageArgs)
        {
            OperationResult result = new OperationResult();

            try
            {
                var modulePaged = _moduleRepository.FindByPage(where, orderBy, pageArgs);
                var query       = from module in modulePaged
                                  join parent in _moduleRepository.Entities on module.ParentId equals parent.Id into parentQuery
                                  from p in parentQuery.DefaultIfEmpty()
                                  join creator in _usrRepository.Entities on module.Creator equals creator.Id into creatorQuery
                                  from c in creatorQuery.DefaultIfEmpty()
                                  join lastmodifier in _usrRepository.Entities on module.LastModifier equals lastmodifier.Id into lastmodifierQuery
                                  from l in lastmodifierQuery.DefaultIfEmpty()
                                  select new
                {
                    Id               = module.Id,
                    Code             = module.Code,
                    Name             = module.Name,
                    LinkUrl          = module.LinkUrl,
                    Icon             = module.Icon,
                    SortOrder        = module.SortOrder,
                    ParentId         = module.ParentId,
                    ParentName       = (p == null) ? "" : (p.Code + "|" + p.Name),
                    Enabled          = module.Enabled,
                    IsSystem         = module.IsSystem,
                    Remark           = module.Remark,
                    Creator          = module.Creator,
                    CreatorName      = c.UserName,
                    CreateTime       = module.CreateTime,
                    LastModifier     = module.LastModifier,
                    LastModifierName = l.UserName,
                    LastModifyTime   = module.LastModifyTime
                };
                result.ResultType = OperationResultType.Success;
                result.AppendData = query.ToList();
            }
            catch (Exception ex)
            {
                base.ProcessException(ref result, string.Format("分页获取{0}模块详细信息失败", EntityType), ex);
            }
            return(result);
        }