/// <summary> /// 查询文件。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void btn_search_ClickAsync(object sender, RoutedEventArgs e) { MemberFileSearch mfsearch = new MemberFileSearch() { UserId = AppSet.LoginUser.Id, MemberId = _CurUcViewModel.MemberId, ContentType = _CurUcViewModel.ContentType, SearchNameOrDesc = _CurUcViewModel.SearchValues, }; await _CurUcViewModel.SearchMemberFiles(mfsearch); }
public async System.Threading.Tasks.Task SearchMemberFiles(MemberFileSearch mfsearch) { if (mfsearch != null) { mfsearch.UserId = AppSet.LoginUser.Id; IEnumerable <Lib.MemberFile> MemberPayTemps = await DataMemberFileRepository.ReadFiles(mfsearch); MFiles.Clear(); MemberPayTemps?.ToList().ForEach(e => { MFiles.Add(e); }); } }
public async System.Threading.Tasks.Task Init_MemberFileVMAsync(string PMemberId, string PContentType, bool ReadFlag = true) { MemberId = PMemberId; ContentType = PContentType; if (!ReadFlag) { return; } MemberFileSearch mfsearch = new MemberFileSearch() { MemberId = MemberId, ContentType = PContentType, UserId = AppSet.LoginUser.Id }; await SearchMemberFiles(mfsearch); }
/// <summary> /// 按指定的条件查询数据 /// </summary> /// <returns></returns> public async Task <IEnumerable <MemberFileEntity> > GetEntitiesAsync(MemberFileSearch mSearchFile) { IQueryable <MemberFileEntity> Items = _GhDbContext.dsMemberFiles.AsNoTracking() as IQueryable <MemberFileEntity>; //需要连同该文件的Plan信息一同读取,在操作文件时需使用之。 if (mSearchFile != null && !string.IsNullOrWhiteSpace(mSearchFile.UserId)) { //判断请求用户是否有权限(必须对该文件所属计划有读取权限) Items = Items.Where(e => e.CanReadUserIds == null || e.UserId.Equals(mSearchFile.UserId, System.StringComparison.Ordinal) || e.CanReadUserIds.Contains(mSearchFile.UserId, System.StringComparison.Ordinal)); if (!string.IsNullOrWhiteSpace(mSearchFile.Id)) { Items = Items.Where(e => e.Id.Equals(mSearchFile.Id, System.StringComparison.Ordinal)); } if (!string.IsNullOrWhiteSpace(mSearchFile.Name)) { Items = Items.Where(e => e.Name.Equals(mSearchFile.Name, System.StringComparison.Ordinal)); } if (!string.IsNullOrWhiteSpace(mSearchFile.MemberId)) { Items = Items.Where(e => e.MemberId.Equals(mSearchFile.MemberId, System.StringComparison.Ordinal)); } if (!string.IsNullOrWhiteSpace(mSearchFile.ContentType)) { Items = Items.Where(e => e.ContentType.Equals(mSearchFile.ContentType, System.StringComparison.Ordinal)); } if (!string.IsNullOrWhiteSpace(mSearchFile.DispatchUnit)) { Items = Items.Where(e => e.DispatchUnit.Contains(mSearchFile.DispatchUnit, System.StringComparison.Ordinal)); } if (!string.IsNullOrWhiteSpace(mSearchFile.FileNumber)) { Items = Items.Where(e => e.FileNumber.Contains(mSearchFile.FileNumber, System.StringComparison.Ordinal)); } if (!string.IsNullOrWhiteSpace(mSearchFile.SearchNameOrDesc)) { Items = Items.Where(e => e.Name.Contains(mSearchFile.SearchNameOrDesc, System.StringComparison.Ordinal) || e.Describe.Contains(mSearchFile.SearchNameOrDesc, System.StringComparison.Ordinal)); } return(await Items.ToListAsync().ConfigureAwait(false)); } return(new List <MemberFileEntity>()); }
public async Task <IEnumerable <MemberFileEntity> > GetFilesAsync([FromQuery] MemberFileSearch mSearchFile) { return(await _FileRepository.GetEntitiesAsync(mSearchFile).ConfigureAwait(false)); }