public OrderForm(UserAccount user, Guid orderId, InventoryItem invItem, LoginForm loginForm)
 {
     userAccount = user;
     _loginForm = loginForm;
     InitializeComponent();
     order = ApplicationObjects.GetOrder(orderId);
     inventoryItem = invItem;
 }
        public static BusinessObject.InventoryItem ToBusinessObject(Entities.InventoryItem entity)
        {
            if (entity == null)
                return null;

            BusinessObject.InventoryItem businessObject = new BusinessObject.InventoryItem(entity.CatalogItemId)
            {
                InventoryItemId = entity.InventoryItemId,
                OrderId = entity.OrderId,
                InventoryItemStatus = (Enumeration.InventoryItemStatus)entity.InventoryItemStatusId
            };

            return businessObject;
        }
Esempio n. 3
0
        public static BusinessObject.InventoryItem ToBusinessObject(Entities.InventoryItem entity)
        {
            if (entity == null)
            {
                return(null);
            }

            BusinessObject.InventoryItem businessObject = new BusinessObject.InventoryItem(entity.CatalogItemId)
            {
                InventoryItemId     = entity.InventoryItemId,
                OrderId             = entity.OrderId,
                InventoryItemStatus = (Enumeration.InventoryItemStatus)entity.InventoryItemStatusId
            };

            return(businessObject);
        }
Esempio n. 4
0
        public static Entities.InventoryItem ToEntity(BusinessObject.InventoryItem businessObject)
        {
            if (businessObject == null)
            {
                return(null);
            }

            Entities.InventoryItem entity = new Entities.InventoryItem
            {
                InventoryItemId       = businessObject.InventoryItemId,
                CatalogItemId         = businessObject.CatalogItemId,
                OrderId               = businessObject.OrderId,
                InventoryItemStatusId = (int)businessObject.InventoryItemStatus
            };

            return(entity);
        }
        public void ShowOrderForm(UserAccount user, Guid orderId, InventoryItem inventoryItem, LoginForm loginForm)
        {
            foreach (Form form in Application.OpenForms)
            {
                if (String.Compare(form.Name, "OrderForm") == 0) { form.Show(); return; }
            }

            orderForm = new OrderForm(user, orderId, inventoryItem, loginForm);
            orderForm.Show();
        }
Esempio n. 6
0
        public static BusinessObject.InventoryItem PopulateInventoryItemWithCatalogItemInfo(BusinessObject.InventoryItem inventoryItem
                                                                                            , BusinessObject.CatalogItem catalogItem)
        {
            if ((inventoryItem == null) || (catalogItem == null))
            {
                return(null);
            }

            inventoryItem.ItemName               = catalogItem.ItemName;
            inventoryItem.Manufacturer           = catalogItem.Manufacturer;
            inventoryItem.NumberInscriptionLines = catalogItem.NumberInscriptionLines;
            inventoryItem.NumberLineCharacters   = catalogItem.NumberLineCharacters;
            inventoryItem.ItemCost               = catalogItem.ItemCost;
            inventoryItem.ItemRetailPrice        = catalogItem.ItemRetailPrice;
            inventoryItem.InscriptionType        = catalogItem.InscriptionType;
            inventoryItem.UpdateNumberInStock();

            return(inventoryItem);
        }
 public static int UpdateInventoryItem(InventoryItem item)
 {
     BusinessObjects _businessObjects = new BusinessObjects();
     return _businessObjects.UpdateInventoryItem(item);
 }
        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.WorkSpecialist;

                // 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);
                }
            }
        }
 public static List<InventoryItem> GetInventoryItemByInventoryItemId(InventoryItem inventoryItem, int inventoryItemStatus)
 {
     if (inventoryItem != null)
     {
         BusinessObjects _businessObjects = new BusinessObjects();
         return (inventoryItem.InventoryItemId != null && inventoryItem.InventoryItemId != Guid.Empty)
             ? _businessObjects.GetInventoryItemByCatalogItemId(inventoryItem.InventoryItemId)
             : null;
     }
     else
     {
         return null;
     }
 }