public void GetAllUsers(Action <PageResultDTO <UserDTOWithActions>, Exception> action, int pageSize, int pageIndex, Dictionary <string, string> sortBy, UserCriteria criteria) { var url = baseAddressUsers + "?PageSize=" + pageSize + "&PageIndex=" + pageIndex + getFilterUser(criteria); if (sortBy.Count > 0) { url += "&SortBy=" + QueryConditionHelper.GetSortByQueryString(sortBy); } WebClientHelper.Get(new Uri(url, UriKind.Absolute), action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void GetAllCustomFieldes(Action <PageResultDTO <CustomFieldDTOWithActions>, Exception> action, int pageSize, int pageIndex, Dictionary <string, string> sortBy, CustomFieldCriteria criteria) { var url = string.Format(apiCustomFieldAddress + "?PageSize={0}&PageIndex={1}&EntityId={2}", pageSize, pageIndex, criteria.EntityId, UriKind.Absolute); if (criteria.EntityId != null && criteria.EntityId != 0) { url += "&Filter=" + GetFilterQueryString(criteria); } if (sortBy.Count > 0) { url += "&SortBy=" + QueryConditionHelper.GetSortByQueryString(sortBy); } WebClientHelper.Get(new Uri(url), action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public PageResultDTO <AbstractUnitIndexDTOWithActions> GetAllUnitIndexCategoriesWithPagination(int pageSize, int pageIndex, QueryStringConditions queryStringConditions) { var fs = new ListFetchStrategy <UnitIndexCategory>(Enums.FetchInUnitOfWorkOption.NoTracking); var sortBy = QueryConditionHelper.GetSortByDictionary(queryStringConditions.SortBy); foreach (var item in sortBy) { fs.SortCriterias.Add(new StringSortCriteria <UnitIndexCategory>(item.Key, (item.Value.ToUpper() == "ASC") ? Enums.SortOrder.Ascending : Enums.SortOrder.Descending)); } fs.OrderBy(x => x.Id); fs.WithPaging(pageSize, pageIndex); unitIndexRep.GetAllUnitIndexCategory(fs); var res = new PageResultDTO <AbstractUnitIndexDTOWithActions>(); res.InjectFrom(fs.PageCriteria.PageResult); res.Result = fs.PageCriteria.PageResult.Result.Select(r => unitIndexWithActionsMapper.MapToModel(r)); return(res); }
public PageResultDTO <ClaimDTOWithAction> GetClaimsWithActions(long periodId, string employeeNo, int pageSize, int pageIndex, QueryStringConditions queryStringConditions) { var fs = new ListFetchStrategy <Claim>(Enums.FetchInUnitOfWorkOption.NoTracking); var sortBy = QueryConditionHelper.GetSortByDictionary(queryStringConditions.SortBy); foreach (var item in sortBy) { fs.SortCriterias.Add(new StringSortCriteria <Claim>(item.Key, (item.Value.ToUpper() == "ASC") ? Enums.SortOrder.Ascending : Enums.SortOrder.Descending)); } fs.OrderBy(x => x.Id); fs.WithPaging(pageSize, pageIndex); claimRep.FindBy(fs, employeeNo, new PeriodId(periodId)); var res = new PageResultDTO <ClaimDTOWithAction>(); res.InjectFrom(fs.PageCriteria.PageResult); res.Result = fs.PageCriteria.PageResult.Result.Select(r => claimDTOWithActionsMapper.MapToModel(r)).ToList(); return(res); }
public PageResultDTO <JobInPeriodDTOWithActions> GetAllJobs(long periodId, int pageSize, int pageIndex, QueryStringConditions queryStringConditions, string selectedColumns) { var fs = new ListFetchStrategy <Job>(Enums.FetchInUnitOfWorkOption.NoTracking); var sortBy = QueryConditionHelper.GetSortByDictionary(queryStringConditions.SortBy); foreach (var item in sortBy) { fs.SortCriterias.Add(new StringSortCriteria <Job>(item.Key, (item.Value.ToUpper() == "ASC") ? Enums.SortOrder.Ascending : Enums.SortOrder.Descending)); } fs.OrderBy(x => x.Id); fs.WithPaging(pageSize, pageIndex); jobRep.Find(e => e.Id.PeriodId == new PeriodId(periodId), fs); var res = new PageResultDTO <JobInPeriodDTOWithActions>(); res.InjectFrom(fs.PageCriteria.PageResult); res.Result = fs.PageCriteria.PageResult.Result.Select(r => jobInPeriodDTOWithActionsMapper.MapToModel(r, selectedColumns.Split(','))).ToList(); return(res); }
public PageResultDTO <CustomFieldDTOWithActions> GetAllCustomFieldes(int pageSize, int pageIndex, QueryStringConditions queryStringConditions) { var fs = new ListFetchStrategy <CustomFieldType>(Enums.FetchInUnitOfWorkOption.NoTracking); var sortBy = QueryConditionHelper.GetSortByDictionary(queryStringConditions.SortBy); foreach (var item in sortBy) { fs.SortCriterias.Add(new StringSortCriteria <CustomFieldType>(item.Key, (item.Value.ToUpper() == "ASC") ? Enums.SortOrder.Ascending : Enums.SortOrder.Descending)); } fs.OrderBy(x => x.Id); fs.WithPaging(pageSize, pageIndex); var entityId = getEntityIdFromQueryString(queryStringConditions.Filter); customFieldRep.GetAll( entityId != null ? Enumeration.FromValue <EntityTypeEnum>(entityId.ToString()) : null, fs); var res = new PageResultDTO <CustomFieldDTOWithActions>(); res.InjectFrom(fs.PageCriteria.PageResult); res.Result = fs.PageCriteria.PageResult.Result.Select(r => customFieldWithActionMapper.MapToModel(r)).ToList(); return(res); }