private List <Transformer> ConvertReceiptToTransformer(IList <ReceiptDetail> receiptDetails) { var query = from r in receiptDetails group r by r.OrderLocationTransaction into g select new { g.Key, Qty = g.Sum(r => r.ShippedQty), CurrentQty = g.Sum(r => r.ReceivedQty), Details = g.Where(r => r.OrderLocationTransaction == g.Key) }; List <Transformer> transformers = new List <Transformer>(); foreach (var item in query) { Transformer transformer = TransformerHelper.ConvertOrderLocationTransactionToTransformer(item.Key); transformer.Qty = transformer.OrderedQty; // transformer.Qty = item.Qty.HasValue ? item.Qty.Value : 0; transformer.CurrentQty = item.CurrentQty.HasValue ? item.CurrentQty.Value : 0; transformer.TransformerDetails = TransformerHelper.ConvertReceiptsToTransformerDetails(new List <ReceiptDetail>(item.Details)); transformers.Add(transformer); } return(transformers); }
public void InitPageParameter(Receipt receipt) { this.TransformerDetailList = TransformerHelper.ConvertReceiptsToTransformerDetails(receipt.ReceiptDetails); this.GV_List.DataSource = this.TransformerDetailList; this.GV_List.DataBind(); }