public async Task <CartonOverviewDto> GetCartonOverview(int cartonNo) { CartonOverviewDto cartonOverView = new CartonOverviewDto(); List <SqlParameter> parms = _searchManager.Search("cartonInquiry", cartonNo.ToString(), SearchStoredProcedure.PageIndex, SearchStoredProcedure.PageSize, out SqlParameter outParam); var cartonList = await _tcContext.Set <CartonInquiry>().FromSqlRaw(SearchStoredProcedure.Sql, parms.ToArray()).ToListAsync(); cartonOverView.CartonHeader = cartonList.FirstOrDefault(); cartonOverView.RequestHeader = _tcContext.InvoiceConfirmations.Where(x => x.CartonNo == cartonNo.ToString()).OrderBy(x => x.TrackingId).ToList(); var cartonLocationList = _tcContext.CartonLocations.Where(x => x.CartonNo == cartonNo).OrderBy(x => x.Id).ToList(); cartonOverView.LocationDetail = _mapper.Map <List <CartonLocationDto> >(cartonLocationList); var pickList = _tcContext.PickLists.Where(x => x.CartonNo == cartonNo).OrderBy(x => x.TrackingId).ToList(); cartonOverView.PickList = _mapper.Map <List <PickListDto> >(pickList); List <SqlParameter> parameters = new List <SqlParameter> { new SqlParameter { ParameterName = InquiryDocketByCartonStoredProcedure.StoredProcedureParameters[0].ToString(), Value = cartonNo.AsDbValue() } }; cartonOverView.PrintedDockets = await _tcContext.Set <DocketPrintDetail>().FromSqlRaw(InquiryDocketByCartonStoredProcedure.Sql, parameters.ToArray()).ToListAsync(); cartonOverView.CartonOwnership = _tcContext.CartonOwnerShips.Where(x => x.CartonNo == cartonNo).OrderBy(x => x.OwnershipChangedDate).ToList(); return(cartonOverView); }
public async Task <PagedResponse <CartonStorageSearchDto> > SearchCarton(string columnValue, int pageIndex, int pageSize) { List <SqlParameter> parms = _searchManager.Search("cartonSearch", columnValue, pageIndex, pageSize, out SqlParameter outParam); var cartonList = await _tcContext.Set <CartonStorageSearch>().FromSqlRaw(SearchStoredProcedure.Sql, parms.ToArray()).ToListAsync(); var totalRows = (int)outParam.Value; #region paging var postResponse = _mapper.Map <List <CartonStorageSearchDto> >(cartonList); var paginationResponse = new PagedResponse <CartonStorageSearchDto> { Data = postResponse, pageNumber = pageIndex, pageSize = pageSize, totalCount = totalRows, totalPages = (int)Math.Ceiling(totalRows / (double)pageSize), }; #endregion if (postResponse == null) { throw new ServiceException(new ErrorMessage[] { new ErrorMessage() { Code = string.Empty, Message = $"Unable to find cartons" } }); } return(paginationResponse); }
public async Task <PagedResponse <RequestSearchDto> > SearchRequest(string requestType, string searchText, int pageIndex, int pageSize) { List <SqlParameter> parms = _searchManager.Search("requestSearch", requestType, searchText, pageIndex, pageSize, out SqlParameter outParam); var cartonList = await _tcContext.Set <RequestSearch>().FromSqlRaw(SearchStoredProcedureByType.Sql, parms.ToArray()).ToListAsync(); var totalRows = (int)outParam.Value; #region paging var postResponse = _mapper.Map <List <RequestSearchDto> >(cartonList); var paginationResponse = new PagedResponse <RequestSearchDto> { Data = postResponse, pageNumber = pageIndex, pageSize = pageSize, totalCount = totalRows, totalPages = (int)Math.Ceiling(totalRows / (double)pageSize), }; #endregion return(paginationResponse); }
public PagedResponse <ViewPrintedDocket> SearchDockets(string printStatus, string searchText, int pageIndex, int pageSize) { List <SqlParameter> parms = _searchManager.Search("docketPrintSearch", printStatus, searchText, pageIndex, pageSize, out SqlParameter outParam); var docketList = _tcContext.Set <ViewPrintedDocket>().FromSqlRaw(SearchStoredProcedureByType.Sql, parms.ToArray()).ToList(); var totalRows = (int)outParam.Value; var paginationResponse = new PagedResponse <ViewPrintedDocket>(docketList, pageIndex, pageSize, totalRows); if (paginationResponse == null) { throw new ServiceException(new ErrorMessage[] { new ErrorMessage() { Code = string.Empty, Message = $"Unable to find dockets" } }); } return(paginationResponse); }