public static CatalogItem GetCatalogItemByCatalogItemId(Guid catalogItemId)
 {
     BusinessObjects _businessObjects = new BusinessObjects();
     return (catalogItemId != Guid.Empty)
         ? _businessObjects.GetCatalogItemByCatalogItemId(catalogItemId)
         : null;
 }
        // INVENTORY REQUEST submit button click event
        private void btn_InventoryRequest_Click(object sender, EventArgs e)
        {
            // Verify all fields are NOT null
            if ((tbx_CatalogId.Text != null) && (tbx_Quantity.Text != null))
            {
                try
                {

                    DateTime time = DateTime.Now;   // Variable to be included in notification message
                    int quantity = Convert.ToInt32(tbx_Quantity.Text);  // validate INT input from user
                    int notificationReturnValue;    // Variable to hold return value from database insert
                    BusinessObjects _businessObject = new BusinessObjects();

                    // Get the catalog information for the item that needs to be ordered.  Some of the catalog item info
                    // will be populated into the notification message string
                    CatalogItem catalogItem = _businessObject.GetCatalogItemByCatalogItemId(new Guid(tbx_CatalogId.Text));

                    // Populate notification fields manually
                    Notification notification = new Notification();
                    notification.OrderId = new Guid(tbx_OrderId.Text);
                    notification.NotificationId = Guid.NewGuid();
                    notification.NotificationMessage = ("Please order inventory item --> Item Name: " +
                    catalogItem.ItemName.ToString() + ",  Manufacturer Name: " + catalogItem.Manufacturer.ToString() +
                    ",  Date: " + time.ToString() + ",  Quantity: " + quantity.ToString()) + ", Catalog ID: " +
                    catalogItem.CatalogItemId.ToString();
                    notification.NotificationType = NotificationType.RestockItem;
                    notification.IsRead = false;
                    notification.PermissionScope = Permission.StockClerk;

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

                    if (notificationReturnValue == 0)
                    {
                        // Database insert success message
                        MessageBox.Show("Your stock request was sent successfully.", "Stock Request",
                                           MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tbx_OrderId.Clear();
                        tbx_CatalogId.Clear();
                        tbx_Quantity.Clear();
                    }
                    else
                    {
                        // Database insert failure message
                        MessageBox.Show("Your stock request failed.  Please try again", "Stock Request",
                                            MessageBoxButtons.OK, MessageBoxIcon.Hand);
                        return;
                    }
                }
                catch (Exception)
                {
                    // Failure message
                    MessageBox.Show("Your stock request failed.  Please make sure that you filled out all request fields with appropriate information", "Stock Request",
                                        MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
            }

            else
            {
                // Error message due to empty fields in stock request form
                MessageBox.Show("Your stock request is not complete.  Please fill out all fields try again", "Stock Request",
                                    MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }
 public static CatalogItem GetCatalogItemByCatalogItemId(CatalogItem catalogItem)
 {
     if (catalogItem != null)
     {
         BusinessObjects _businessObjects = new BusinessObjects();
         return (catalogItem.CatalogItemId != null && catalogItem.CatalogItemId != Guid.Empty)
             ? _businessObjects.GetCatalogItemByCatalogItemId(catalogItem.CatalogItemId)
             : null;
     }
     else
     {
         return null;
     }
 }