public FormItemQueryResult QueryFormItem(QueryBase query) { var q = query as QueryFormItem; var entityQuery = _context.FormItems.AsQueryable(); var queryResult = new FormItemQueryResult(); if (!string.IsNullOrWhiteSpace(q.Name)) { entityQuery = entityQuery .Where(s => s.Label.Contains(q.Name)); } if (q.Id.HasValue) { entityQuery = entityQuery .Where(s => s.Id == q.Id); } if (q.FormId.HasValue) { entityQuery = entityQuery.Where(s => s.FormId == q.FormId); } queryResult.Count = entityQuery.Count(); entityQuery = entityQuery.OrderBy(s => s.Order); if (q.Skip.HasValue && q.Take.HasValue) entityQuery = entityQuery.Skip(q.Skip.Value).Take(q.Take.Value); queryResult.Result = entityQuery.ToList(); return queryResult; }
public QueryResult Query(QueryBase query) { var q = query as QueryMasterData; var userQuery = _context.Clients.AsQueryable(); var queryResult = new QueryResult(); if (!string.IsNullOrWhiteSpace(q.Name)) { userQuery = userQuery .Where(s => s.Name.Contains(q.Name) || s.Code.Contains(q.Description) ); } queryResult.Count = userQuery.Count(); userQuery = userQuery.OrderBy(s => s.Name); if (q.Skip.HasValue && q.Take.HasValue) userQuery = userQuery.Skip(q.Skip.Value).Take(q.Take.Value); queryResult.Result = userQuery.ToList().OfType<BaseEntity>().ToList(); return queryResult; }
public TranferResponse<FormItemDTO> QueryItem(QueryBase query) { var response = new TranferResponse<FormItemDTO>(); try { var data = _formRepository.QueryFormItem(query); var result = data.Result.Select(Map).ToList(); response.Data.AddRange(result); response.Status = true; response.RecordCount = data.Count; } catch (Exception ex) { response.Info = ex.Message; response.Status = false; } return response; }
public TranferResponse<ReportGroupDTO> Query(QueryBase query) { var response = new TranferResponse<ReportGroupDTO>(); try { var data = _reportGroupRepository.Query(query); var result = data.Result.OfType<ReportGroup>().Select(Map).ToList(); response.Data.AddRange(result); response.Status = true; response.RecordCount = data.Count; } catch (Exception ex) { response.Info = ex.Message; response.Status = false; } return response; }
public QueryResult Query(QueryBase query) { var q = query as QueryReport; var myQuery = _context.ReportGroups.AsQueryable(); var queryResult = new QueryResult(); if (!string.IsNullOrWhiteSpace(q.Name)) { myQuery = myQuery .Where(s => s.Name.Contains(q.Name) || s.Description.Contains(q.Description) ); } if(q.ClientId.HasValue) { myQuery = myQuery.Where(s => s.ClientId == q.ClientId); } queryResult.Count = myQuery.Count(); myQuery = myQuery.OrderBy(s => s.Name); if (q.Skip.HasValue && q.Take.HasValue) myQuery = myQuery.Skip(q.Skip.Value).Take(q.Take.Value); queryResult.Result = myQuery.ToList().OfType<BaseEntity>().ToList(); return queryResult; }