protected void Receive_Click(object sender, EventArgs e)
    {
        MessageUserControl.TryRun(() =>
        {
            ReceivingController sysmng = new ReceivingController();

            List <NewReceiveOrderPOCO> receiveNewOrders = new List <NewReceiveOrderPOCO>();

            foreach (GridViewRow row in PODetailsGV.Rows)
            {
                NewReceiveOrderPOCO newOrder   = new NewReceiveOrderPOCO();
                newOrder.PurchaseOrderID       = int.Parse(((Label)row.FindControl("PurchaseOrderID")).Text);
                newOrder.PurchaseOrderDetailID = int.Parse(((Label)row.FindControl("PurchaseOrderDetailID")).Text);
                newOrder.PartID           = int.Parse(((Label)row.FindControl("PartID")).Text);
                newOrder.PartDescription  = (((Label)row.FindControl("Description")).Text);
                newOrder.Outstanding      = int.Parse(((Label)row.FindControl("QuantityOutstanding")).Text);
                newOrder.QuantityReceived = (((TextBox)row.FindControl("txtReceiving")).Text) == "" ? 0 : int.Parse(((TextBox)row.FindControl("txtReceiving")).Text);
                newOrder.QuantityReturned = (((TextBox)row.FindControl("txtReturning")).Text) == "" ? 0 : int.Parse(((TextBox)row.FindControl("txtReturning")).Text);
                newOrder.Notes            = (((TextBox)row.FindControl("txtReason")).Text);

                receiveNewOrders.Add(newOrder);
            }
            sysmng.Add_ReceivedOrders(receiveNewOrders);
            PODetailsGV.DataBind();
        }, "Confirmation", "Order was successfully received.");
    }
 private void RefreshPage()
 {
     PODetailsGV.DataSource = null;
     PODetailsGV.DataBind();
     lblPONumber.Text    = "";
     lblVendorName.Text  = "";
     lblVendorPhone.Text = "";
 }
    protected void ViewOrder_Click(object sender, EventArgs e)
    {
        int poID = 0;
        //int poNumber = 0;

        GridViewRow item = (GridViewRow)((LinkButton)sender).NamingContainer; // gets info from one row.

        poID = int.Parse(((Label)item.FindControl("PurchaseOrderId")).Text);

        ReceivingController           sysmng          = new ReceivingController();
        VendorPurchaseOrderDetailsDTO vendorPODetails = sysmng.GetPODetails(poID);

        lblPONumber.Text    = vendorPODetails.PurchaseOrderNumber.ToString();
        lblVendorName.Text  = vendorPODetails.VendorName;
        lblVendorPhone.Text = vendorPODetails.VendorPhone;
        //DataSource for the GridView
        PODetailsGV.DataSource = vendorPODetails.PODetails;
        PODetailsGV.DataBind();
    }