} //eom

        public ReceivingVendorOrderDetails Get_OrderDetails(int purchaseOrderId)
        {
            using (var context = new eBikesContext())
            {
                ReceivingVendorOrderDetails results = null;

                List <ReceivingOrderDetailsPOCO> orderDetails = null;

                var vendor =
                    context.PurchaseOrders.Where(po => po.PurchaseOrderID == purchaseOrderId).Select(v => new
                {
                    PONumber   = v.PurchaseOrderNumber,
                    Phone      = v.Vendor.Phone,
                    VendorName = v.Vendor.VendorName
                }).FirstOrDefault();

                orderDetails =
                    context.PurchaseOrderDetails.Where(pod => pod.PurchaseOrderID == purchaseOrderId && (pod.Quantity - pod.ReceiveOrderDetails.Sum(rod => rod.QuantityReceived)) != 0)
                    .Select(pod => new ReceivingOrderDetailsPOCO
                {
                    PurchaseOrderId       = pod.PurchaseOrderID,
                    PurchaseOrderDetailId = pod.PurchaseOrderDetailID,
                    PartId          = pod.PartID,
                    PartDescription = pod.Part.Description,
                    QtyOnOrder      = pod.Quantity,
                    QtyOutstanding  = pod.ReceiveOrderDetails.Select(rod => rod.QuantityReceived).Any() ? pod.Quantity - pod.ReceiveOrderDetails.Sum(rod => rod.QuantityReceived) : pod.Quantity
                }).ToList();

                if (vendor != null)
                {
                    results = new ReceivingVendorOrderDetails()
                    {
                        PONumber              = vendor.PONumber,
                        VendorName            = vendor.VendorName,
                        Phone                 = vendor.Phone,
                        ReceivingOrderDetails = orderDetails
                    };
                }

                return(results);
            }
        } //eom
    protected void ViewOrder_Click(object sender, EventArgs e)
    {
        MessageUserControl.TryRun(() =>
        {
            GridViewRow grdRow  = (GridViewRow)((LinkButton)sender).NamingContainer;
            int purchaseOrderId = int.Parse(((Label)grdRow.FindControl("purchaseOrderID")).Text);

            ReceivingOrderController sysmgr         = new ReceivingOrderController();
            ReceivingVendorOrderDetails orderDetail = sysmgr.Get_OrderDetails(purchaseOrderId);

            PONumber.Text   = orderDetail.PONumber.ToString();
            VendorName.Text = orderDetail.VendorName;
            Contact.Text    = orderDetail.Phone;

            OrderDetailGrid.DataSource = orderDetail.ReceivingOrderDetails;
            OrderDetailGrid.DataBind();

            enableButtons();
        });
    }