public void button2_Click(object sender, EventArgs e) // Retrieve Button on click event
        {
            // selecting or typing a valid order id and displaying the results
            try
            {
                int    orderID = Convert.ToInt32(cborderId.Text);
                Orders myOrder = OrdersDB.GetOrders(orderID);
                List <OrderDetails> myOrderDetails = OrderDetailsDB.GetOrderDetails(orderID);

                if (Object.Equals(myOrder, null)) // if ordr id not valid, show the follofing message
                {
                    MessageBox.Show("No matching Order Id's found, please provide a valid Order ID", "Order ID Error");
                }
                else // else display all the fields and read only order details data grid form
                {
                    displayOrder(myOrder);
                    displayOrderDetails(myOrderDetails);
                    calculateTotalprice();
                }
            }
            catch (FormatException) // catching the wrong format order id exception, in case user types an alphabet or anything other than the valid id
            {
                MessageBox.Show("Select from the drop down list and Retrieve.", "Input Error");
            }
        }
        public void UpdateShipDate(object sender, EventArgs e) // update ship date method
        {
            try
            {
                // setting the orderid to accept null values by using nullable datetime values
                int      orderID = Convert.ToInt32(cborderId.Text);
                DateTime?NewShippedDate;
                if (String.IsNullOrEmpty(txtShipDate.Text))
                {
                    NewShippedDate = null;
                }
                else
                {
                    NewShippedDate = DateTime.Parse(txtShipDate.Text);
                }

                // adding validation for new shipped date to be between order date and requird date
                DateTime?RequiredDate = Convert.ToDateTime(txtReqDate.Text);
                DateTime?Orderdate    = Convert.ToDateTime(txtOrderDate.Text);
                if (RequiredDate >= NewShippedDate && Orderdate <= NewShippedDate)
                {
                    OrdersDB.UpdateShippingDate(NewShippedDate, orderID); // method to update shipping value
                    MessageBox.Show("Shipped Date Updated", "Update");
                }
                else if (RequiredDate < NewShippedDate)
                {
                    MessageBox.Show("Shipped Date can not be ahead of Required Date.", "Date Error");
                    Form1_Load(sender, e);
                }
                else if (Orderdate > NewShippedDate)
                {
                    MessageBox.Show("Shipped Date can not be earlier than the Order Date", "Date Error");
                }
                else if (NewShippedDate == null)          //method to update new shipped date with null values
                {
                    OrdersDB.UpdateShippingDate(orderID); // using the same method name with different signatures
                    MessageBox.Show("Null value Added.", "Null Value");
                }
                else
                {
                    MessageBox.Show("Shipped Date not acceptable.", "Incorrect Syntax");
                }
            }
            catch (FormatException) // catching the shipped date format exception incase it's in a wrong format
            {
                MessageBox.Show("Select from the drop down list and Retrieve. Use the correct format for date MM/DD/YYYY.", "Input Error");
            }
        }