public static void SendWorkCompleteNotification()
        {
            //Assemble
            BusinessObjects _businessObjects = new BusinessObjects();
            BusinessLayer.Order order = _businessObjects.GetOrder(new Guid("7F70F68B-E942-4D20-AC40-E017B0CF4892"));

            //Act
            order.OrderStatus = OrderStatus.WorkComplete;
            int returnValue = _businessObjects.UpdateOrder(order);

            //Assert
            if (returnValue == 1)
            {
                throw new CustomException("SendWorkCompleteNotification() failed to set order status to Work Complete and insert new notification.");
            }
        }
        // MARK AS SOLD submit button click event
        private void btn_SubmitRequest_Click(object sender, EventArgs e)
        {
            int updateReturnValue;
            int notificationReturnValue;
            BusinessObjects _businessObjects = new BusinessObjects();

            // Verify that user enterd an order Id, and that they had an inventory item selected in the search result combobox
            if ((tbx_OrderSold.Text == null) || (cbx_ResultsList.SelectedItem == null))
            {
                MessageBox.Show("Invalid input.  Please make sure you have selected an inventory item & entered an Order ID and try again", "Invalid Stock Request",
                                    MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }
            // Verify that the item that has been selected is not already marked as SOLD
            else if (inventoryItems[cbx_ResultsList.SelectedIndex].InventoryItemStatus != InventoryItemStatus.Stock)
            {
                MessageBox.Show("You have selected an inventory item that is not in stock.  Please try again", "Invalid Item Status",
                                    MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }

            // If user input appears to be valid, continue
            else
            {
                try
                {
                    // Try to convert user input to a Guid
                    Order order = _businessObjects.GetOrder(new Guid(tbx_OrderSold.Text.ToString()));

                    // Verify that an Order was found
                    if (order == null)
                    {
                        MessageBox.Show("We were unable to find an order with the ID that you entered.  Please try again", "No Order Found",
                                    MessageBoxButtons.OK, MessageBoxIcon.Hand);
                        return;
                    }

                    // Add order ID to inventory item
                    InventoryItem inventoryItem = inventoryItems[cbx_ResultsList.SelectedIndex];
                    inventoryItem.OrderId = order.OrderId;

                    // Change inventory item status to SOLD
                    inventoryItem.InventoryItemStatus = InventoryItemStatus.Sold;

                    //Update inventory and populate result value variable
                    updateReturnValue = _businessObjects.UpdateInventoryItem(inventoryItem);

                    // Display message based on success or failue of database update
                    if (updateReturnValue == 0)
                    {
                        BusinessObjects _notificationBusinessObject = new BusinessObjects();
                        // Populate notification fields manually
                        Notification notification = new Notification();
                        notification.OrderId = order.OrderId;
                        notification.NotificationId = Guid.NewGuid();
                        notification.NotificationMessage = ("Please pull inventory item : " +
                                                            inventoryItem.InventoryItemId.ToString());
                        notification.NotificationType = NotificationType.MediaPull;
                        notification.IsRead = false;
                        notification.PermissionScope = Permission.StockClerk;

                        // Insert notification into database table
                        notificationReturnValue = _notificationBusinessObject.InsertNotification(notification);

                        // Database insert success message
                        MessageBox.Show("Your inventory update request was successful.", "Inventory Update",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);

                    }
                    else
                    {
                        // Database insert failure message
                        MessageBox.Show("Your inventory update request has failed, Please try again.", "Inventory Update",
                                    MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }

                    // After transaction is complete, re-run original search and refresh search results.
                    btn_SearchSubmit.PerformClick();
                    tbx_OrderSold.Text = "";
                 }

                 // Show error if user didn't enter an INT
                catch (Exception)
                {
                    MessageBox.Show("You entered an invalid order ID.  Please try again", "Invalid Number",
                                    MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    return;
                }
            }
        }
 public static Order GetOrder(Guid orderId)
 {
     BusinessObjects _businessObjects = new BusinessObjects();
     return _businessObjects.GetOrder(orderId);
 }