public ListResultDto <ActualOutlayListDto> LoadLinkedOutlays(ActualAuditQueryDto request) { if (!request.PrincipalKey.HasValue) { throw new UserFriendlyException("请输入凭证关联对象"); } var result = (from a in this._actualOutlayRepository.GetAll() join r in this._relationshipRepository.GetAll() on a.Id equals r.ForeignKey where r.PrincipalKey == request.PrincipalKey.Value && (string.IsNullOrEmpty(request.Text) || a.VoucherNo.Contains(request.Text) || a.Note.Contains(request.Text)) select a).OrderByDescending(r => r.VoucherNo); var count = result.Count(); var list = result.AsQueryable().PageBy(request).ToList().MapTo <List <ActualOutlayListDto> >(); return(new PagedResultDto <ActualOutlayListDto>(count, list)); }
public ListResultDto <ActualOutlayListDto> LoadUnLinkOutlays(ActualAuditQueryDto request) { var currentYearItem = this._sysDictionaryRepository.FirstOrDefault(r => r.Value4 == true.ToString() && r.Category == DictionaryCategory.Budget_Year); if (currentYearItem == null) { throw new UserFriendlyException("预算年度不存在"); } var year = int.Parse(currentYearItem.Value); var rIds = (from r in this._relationshipRepository.GetAll() where r.Type == request.Type select r.ForeignKey).ToList(); var result = (from a in this._actualOutlayRepository.GetAll() where !rIds.Contains(a.Id) && a.Year == year && (string.IsNullOrEmpty(request.Text) || a.VoucherNo.Contains(request.Text) || a.Note.Contains(request.Text)) select a).OrderByDescending(r => r.VoucherNo); var count = result.Count(); var list = result.AsQueryable().PageBy(request).ToList().MapTo <List <ActualOutlayListDto> >(); return(new PagedResultDto <ActualOutlayListDto>(count, list)); }