コード例 #1
0
        public static void RemoveInventoryItemFromInventory(InventoryItem item)
        {
            BusinessObjects _businessObjects = new BusinessObjects();
            int             returnValue;

            returnValue = _businessObjects.DeleteInventoryItem(item);
            DisplayDataStatus(returnValue);
            if (returnValue == 0)
            {
                int             notificationReturnValue;
                BusinessObjects _notificationBusinessObject = new BusinessObjects();
                Notification    notification = new Notification();
                notification.OrderId             = item.OrderId;
                notification.NotificationId      = Guid.NewGuid();
                notification.NotificationMessage = ("Inventory item is en route : " +
                                                    item.InventoryItemId.ToString());
                notification.NotificationType = BusinessLayer.Enumerations.NotificationType.EnRoute;
                notification.IsRead           = false;
                notification.PermissionScope  = BusinessLayer.Enumerations.Permission.Manager;

                // INSERT notification to database
                notificationReturnValue = _notificationBusinessObject.InsertNotification(notification);

                if (notificationReturnValue == 0)
                {
                    MessageBox.Show("A notification has been sent to the Work specialist", "Item Sent to Work Specialist", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (notificationReturnValue == 1)
                {
                    MessageBox.Show("There was a problem sending a notification to the Work Specialist - please notify them manually that the item is on the way", "Item Sent to Work Specialist", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }