Example #1
0
        public IHttpActionResult GetTotalCountOacy([FromBody] OacyDataFilter criteria)
        {
            UprdOACYRepository uprdOACYRepository = new UprdOACYRepository();
            int totalRecords = uprdOACYRepository.GetTotalCountOACYList(criteria.PipelineDuns, criteria.keyword, criteria.postStartDate, criteria.EffectiveStartDate, criteria.Cycle);

            return(Ok(totalRecords));
        }
Example #2
0
        public IHttpActionResult GetOACYByCriteria([FromBody] OacyDataFilter criteria)
        {
            SortingPagingInfo sortingPagingInfo = new SortingPagingInfo();

            sortingPagingInfo.SortField        = criteria.sort;
            sortingPagingInfo.SortDirection    = criteria.SortDirection;
            sortingPagingInfo.PageSize         = criteria.size;
            sortingPagingInfo.CurrentPageIndex = criteria.page;
            UprdOACYRepository uprdOACYRepository = new UprdOACYRepository();

            criteria.postStartDate = criteria.postStartDate.Value.Date + criteria.postTime.Value.TimeOfDay;
            var source = uprdOACYRepository.GetOACYListWithPaging(criteria.PipelineDuns, criteria.keyword, criteria.postStartDate, criteria.EffectiveStartDate, criteria.Cycle, sortingPagingInfo);

            //int count = sortingPagingInfo.PageCount;
            //int CurrentPage = sortingPagingInfo.CurrentPageIndex;
            //int PageSize = sortingPagingInfo.PageSize;
            //int TotalCount = count;

            //int TotalPages = (int)Math.Ceiling(count / (double)PageSize);

            //// if CurrentPage is greater than 1 means it has previousPage
            //var previousPage = CurrentPage > 1 ? "Yes" : "No";

            //// if TotalPages is greater than CurrentPage means it has nextPage
            //var nextPage = CurrentPage < TotalPages ? "Yes" : "No";

            //// Object which we are going to send in header
            //var paginationMetadata = new
            //{
            //    totalCount = TotalCount,
            //    pageSize = PageSize,
            //    currentPage = CurrentPage,
            //    totalPages = TotalPages,
            //    previousPage,
            //    nextPage
            //};

            // Setting Header
            //HttpContext.Current.Response.Headers.Add("Paging-Headers", JsonConvert.SerializeObject(paginationMetadata));
            //if (source == null)
            //{
            //    var resp = new HttpResponseMessage(HttpStatusCode.NotFound)
            //    {
            //        ReasonPhrase = "Records Not Found."
            //    };
            //    throw new HttpResponseException(resp);
            //}
            return(Ok(source));
        }