public ContentResult Errors(List <DataTableKeyValuePair> data) { var dtQuery = new DataTableQuery(data); IList <Error> query = string.IsNullOrEmpty(dtQuery.SearchTerm) ? _errorRepository.Search(dtQuery.iDisplayStart, dtQuery.iDisplayLength, data) : _errorRepository.Search(dtQuery.SearchTerm, data); IList <ErrorModel> items = string.IsNullOrEmpty(dtQuery.SearchTerm) ? query.Select(x => new ErrorModel().MapEntity(x)).ToList() : query.Skip(dtQuery.iDisplayStart) .Take(dtQuery.iDisplayLength) .Select(x => new ErrorModel().MapEntity(x)) .ToList(); var results = new CustomResultSet <ErrorModel> { aaData = items, RecordCount = (int)(string.IsNullOrEmpty(dtQuery.SearchTerm) ? _errorRepository.CountByLogId(data.ToLogId()) :query.Count), CurrentPage = dtQuery.PageSize, PageSize = dtQuery.PageSize, sEcho = dtQuery.sEcho }; return(DataTableContentResult <ErrorModel> .ContentResult(results)); }
public async Task <ActionResult> GetGuests(DataTableQuery query) { IEnumerable <PageQueryItem> getPageQueryItems() { yield return(new PageQueryItem(nameof(Guest.Name), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(Guest.PinYin), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(Guest.IsFemale), BoolLikeStr(nameof(Guest.IsFemale), query.Search.Value), ExpressionOperate.Equal)); yield return(new PageQueryItem(nameof(Guest.Title), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(Guest.Company), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(Guest.Description), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(Guest.Telephone), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(Guest.Guid), query.Search.Value, ExpressionOperate.Equal)); } var input = new GenericPagingInput( query.Start, query.Length, list: getPageQueryItems().ToList()); //input.Sorting = "CreationTime asc"; var page = await _guestAppService.GetAllAsync(input); return(Json(new DataTableResult <GuestDto>(page))); }
public async Task <JsonResult> JsonGetUsersNotInOrganization(int draw, DataTableQuery query, long organizationUnitId, string usernameLike) { IEnumerable <PageQueryItem> getPageQueryItems() { yield return(new PageQueryItem(nameof(Adbp.Zero.Authorization.Users.User.UserName), query.Search.Value, ExpressionOperate.Like)); } var input = new GenericPagingInput(query.Start, query.Length, list: getPageQueryItems().ToList()); var page = await _organizationUnitAppService.GetUsersNotInOrganizationAsync(input, organizationUnitId); return(Json(new DataTableResult <OrganizationUserOuput>(page))); }
public async Task <JsonResult> JsonGetOrganizationUserOuputs(int draw, DataTableQuery query, long organizationUnitId) { IEnumerable <PageQueryItem> getPageQueryItems() { yield return(new PageQueryItem(nameof(OrganizationUnitUserDto.UserName), query.Search.Value, ExpressionOperate.Like)); } var page = await _organizationUnitAppService.GetOrganizationUnitUserPageAsync( new GenericPagingInput(query.Start, query.Length, list : getPageQueryItems().ToList()) { Sorting = "CreationTime desc" }, organizationUnitId); return(Json(new DataTableResult <OrganizationUnitUserDto>(page))); }
public async Task <IHttpActionResult> SearchForLog(object postQuery) { var data = postQuery.ToKeyValuePair(); try { DataTableQuery dtQuery = new DataTableQuery(data); IList <User> query = string.IsNullOrEmpty(dtQuery.SearchTerm) ? _userRepository.SearchForLog(dtQuery.iDisplayStart, dtQuery.iDisplayLength, data) : _userRepository.SearchNotAssignedToLog(dtQuery.SearchTerm, data); IList <UserLogAccessModel> items = string.IsNullOrEmpty(dtQuery.SearchTerm) ? query.Select(x => new UserLogAccessModel().MapEntity(x)).ToList() : query.Skip(dtQuery.iDisplayStart) .Take(dtQuery.iDisplayLength) .Select(x => new UserLogAccessModel().MapEntity(x)).ToList() .ToList(); var logId = data.ToLogId(); var log = await _logRepository.FindByLogIdAsync(logId); if (log.UserAccesses != null && log.UserAccesses.Any()) { FillLogAccess(items, log, logId); } var dto = new DataTableDto <UserLogAccessModel> { aaData = items, RecordCount = query.Count, CurrentPage = dtQuery.PageSize, PageSize = dtQuery.PageSize, sEcho = dtQuery.sEcho }; return(Ok(dto)); } catch (Exception ex) { LogVerbose(ex); return(BadRequest()); } }
public ContentResult LatestErrors(List <DataTableKeyValuePair> data) { var dtQuery = new DataTableQuery(data); var logs = _logRepository.FindAllByUserId(CurrentUserId); List <Error> query = _errorRepository.FindLatestByUserId(CurrentUserId); List <ErrorModel> items = query.Select(x => new ErrorModel().MapEntity(x)).ToList().ResolveLogNames(logs); var results = new CustomResultSet <ErrorModel> { aaData = items, RecordCount = items.Count, CurrentPage = dtQuery.PageSize, PageSize = dtQuery.PageSize, sEcho = dtQuery.sEcho }; return(DataTableContentResult <ErrorModel> .ContentResult(results)); }
public async Task <ActionResult> GetUsers(DataTableQuery query) { IEnumerable <PageQueryItem> getPageQueryItems() { yield return(new PageQueryItem(nameof(Adbp.Zero.Authorization.Users.User.Name), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(Adbp.Zero.Authorization.Users.User.Surname), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(Adbp.Zero.Authorization.Users.User.UserName), query.Search.Value, ExpressionOperate.Like)); } var input = new GenericPagingInput( query.Start, query.Length, list: getPageQueryItems().ToList()); //input.Sorting = "CreationTime asc"; var page = await _userAppService.GetUsers(input); return(Json(new DataTableResult <UserDto>(page))); }
public JsonResult List(DataTableQuery query) { using (var repository = new Repository <Event>()) { var events = repository.GetAll(); var total = events.Count(); var filtered = total; IQueryable <Event> result = events.OrderBy(e => e.Id); if (!string.IsNullOrEmpty(query.sSearch)) { result = result.Where(e => e.Title.Contains(query.sSearch)); filtered = result.Count(); } result = result.Skip(query.iDisplayStart) .Take(query.iDisplayLength); return(Json(new DataTableResponse <Event>(result.ToList(), total, filtered), JsonRequestBehavior.AllowGet)); } }
public async Task <ActionResult> GetUserLoginAttempts(DataTableQuery query) { IEnumerable <PageQueryItem> getPageQueryItems() {//UserLoginAttempt yield return(new PageQueryItem(nameof(UserLoginAttempt.BrowserInfo), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(UserLoginAttempt.ClientName), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(UserLoginAttempt.ClientIpAddress), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(UserLoginAttempt.UserNameOrEmailAddress), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(UserLoginAttempt.Result), EnumLikeStr <AbpLoginResultType>(query.Search.Value), ExpressionOperate.Contains)); } var input = new GenericPagingInput( query.Start, query.Length, list: getPageQueryItems().ToList()); var page = await _analasyAppService.GetUserLoginAttemptsAsync(input); return(Json(new DataTableResult <UserLoginAttemptDto>(page))); }
public async Task <ActionResult> GetAuditLogs(DataTableQuery query) { IEnumerable <PageQueryItem> getPageQueryItems() {//AuditLog if (query.Search.Value?.Trim() == ZeroConsts.SearchCmds.SymbolException) { yield return(new PageQueryItem(nameof(Abp.Auditing.AuditLog.Exception), query.Search.Value, ExpressionOperate.IsNotNull)); yield break; } yield return(new PageQueryItem(nameof(Abp.Auditing.AuditLog.BrowserInfo), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(Abp.Auditing.AuditLog.ClientIpAddress), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(Abp.Auditing.AuditLog.ClientName), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(Abp.Auditing.AuditLog.Exception), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(Abp.Auditing.AuditLog.MethodName), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(Abp.Auditing.AuditLog.Parameters), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(Abp.Auditing.AuditLog.ServiceName), query.Search.Value, ExpressionOperate.Like)); yield return(new PageQueryItem(nameof(Abp.Auditing.AuditLog.UserId), UserLikeStr(_userRepository, query.Search.Value), ExpressionOperate.Contains)); } var input = new GenericPagingInput( query.Start, query.Length, list: getPageQueryItems().ToList()); var page = await _analasyAppService.GetAuditLogsAsync(input); return(Json(new DataTableResult <AuditLogDto>(page))); }
public async Task <DataTableResponse <ExpenditureModel> > GetPaginatedExpenditure(DataTableQuery dataTableQuery) { var skip = dataTableQuery != null && dataTableQuery.Skip.HasValue ? dataTableQuery?.Skip.Value : 0; var take = dataTableQuery != null && dataTableQuery.Take.HasValue ? dataTableQuery?.Take.Value : 10; var expenditure = await Expenditure.GetAllExpenditure(skip.Value, take.Value); return(new DataTableResponse <ExpenditureModel> { data = expenditure, draw = 0, recordsFiltered = expenditure.Count, recordsTotal = expenditure.Count }); }
public async Task <DataTableResponse <ExpenditureModel> > GetExpenditure(DataTableQuery query) { var expenditureService = new ExpenditureService(); return(await expenditureService.GetPaginatedExpenditure(query)); }