Esempio n. 1
0
        public SummaryOrderByIndividualPVModel SearchSummaryOrderByIndividualPVModels(
            [FromUri] OrderAdminSearchCriteria searchCriteria, [FromUri] PaginationOptions paginationOptions)
        {
            var tbl = _orderReportService.SearchSummaryOrderByIndividualPV(_workContext.User, paginationOptions,
                                                                           searchCriteria);

            var dataRows = tbl.AsEnumerable().Skip((paginationOptions.PageIndex - 1) * paginationOptions.PageSize).Take(paginationOptions.PageSize);

            var model = dataRows.Select(Mapper.Map <DataRow, SummaryOrderByIndividualPVRowModel>).ToList();

            var     summaryTotalAmount = 0;
            decimal summaryTotalPV     = 0;
            decimal summaryTotalPrice  = 0;

            if (model.Count > 0)
            {
                summaryTotalAmount = Convert.ToInt32(tbl.Compute("Sum(Quantity)", ""));
                summaryTotalPV     = Convert.ToDecimal(tbl.Compute("Sum(TotalPV)", ""));
                summaryTotalPrice  = Convert.ToDecimal(tbl.Compute("Sum(TotalPrice)", ""));
            }


            return(new SummaryOrderByIndividualPVModel()
            {
                Data = model,
                TotalItems = tbl.Rows.Count,
                SummaryTotalAmount = summaryTotalAmount,
                SummaryTotalPV = summaryTotalPV,
                SummaryTotalPrice = summaryTotalPrice
            });
        }