public object GetDetails(int page, int rows, string BillNo)
 {
     if (BillNo != "" && BillNo != null)
     {
         IQueryable <MoveBillDetail> MoveBillDetailQuery = MoveSearchDetailRepository.GetQueryable();
         var MoveBillDetail = MoveBillDetailQuery.Where(i => i.BillNo.Contains(BillNo)).OrderBy(i => i.BillNo).AsEnumerable().Select(i => new
         {
             i.ID,
             i.BillNo,
             i.ProductCode,
             i.Product.ProductName,
             i.UnitCode,
             i.Unit.UnitName,
             i.InCellCode,
             PlaceName_In = i.InCell.CellName,
             i.OutCellCode,
             PlaceName_Out = i.OutCell.CellName,
             i.RealQuantity
         });
         int total = MoveBillDetail.Count();
         MoveBillDetail = MoveBillDetail.Skip((page - 1) * rows).Take(rows);
         return(new { total, rows = MoveBillDetail.ToArray() });
     }
     return("");
 }
Beispiel #2
0
        public object GetDetails(int page, int rows, string BillNo)
        {
            IQueryable <MoveBillDetail> moveBillDetailQuery = MoveSearchDetailRepository.GetQueryable();
            var moveBillDetails = moveBillDetailQuery.Where(i => i.BillNo.Contains(BillNo)).OrderBy(i => i.BillNo);
            int total           = moveBillDetails.Count();
            var moveBillDetail  = moveBillDetails.Skip((page - 1) * rows).Take(rows);
            var moveDetail      = moveBillDetail.ToArray().Select(i => new
            {
                i.ID,
                i.BillNo,
                i.ProductCode,
                i.Product.ProductName,
                i.UnitCode,
                i.Unit.UnitName,
                i.InCellCode,
                PlaceName_In = i.InCell.CellName,
                i.OutCellCode,
                PlaceName_Out = i.OutCell.CellName,
                RealQuantity  = i.RealQuantity / i.Unit.Count,
                i.Status
            });

            return(new { total, rows = moveDetail.ToArray() });
        }