public static int Delete(InventoryItem inventoryItem)
        {
            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (DeleteInventoryItemByInventoryItemIdCommand objectCommand = new DeleteInventoryItemByInventoryItemIdCommand(objectConnection))
                {
                    objectCommand.InventoryItemId = inventoryItem.InventoryItemId;

                    objectConnection.Open();
                    objectCommand.ExecuteNonQuery();

                    return objectCommand.ReturnValue;
                }
            }
        }
Exemple #2
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);
        }
Exemple #3
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 static int UpdateByInventoryItemId(InventoryItem inventoryItem)
        {
            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (UpdateInventoryItemByInventoryItemIdCommand objectCommand = new UpdateInventoryItemByInventoryItemIdCommand(objectConnection))
                {
                    objectCommand.InventoryItemId = inventoryItem.InventoryItemId;
                    objectCommand.OrderId = inventoryItem.OrderId;
                    objectCommand.CatalogItemId = inventoryItem.CatalogItemId;
                    objectCommand.InventoryItemStatusId = inventoryItem.InventoryItemStatusId;

                    objectConnection.Open();
                    objectCommand.ExecuteNonQuery();

                    return objectCommand.ReturnValue;
                }
            }
        }
        public static int Insert(InventoryItem inventoryItem)
        {
            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (InsertInventoryItemCommand objectCommand = new InsertInventoryItemCommand(objectConnection))
                {
                    objectCommand.InventoryItemId = (inventoryItem.InventoryItemId != Guid.Empty) ? inventoryItem.InventoryItemId : new Guid();
                    objectCommand.CatalogItemId = inventoryItem.CatalogItemId;
                    objectCommand.OrderId = inventoryItem.OrderId;
                    objectCommand.InventoryItemStatusId = inventoryItem.InventoryItemStatusId;

                    objectConnection.Open();
                    objectCommand.ExecuteNonQuery();

                    return objectCommand.ReturnValue;
                }
            }
        }
        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 int UpdateInventoryItem(InventoryItem item)
 {
     return InventoryItemData.UpdateByInventoryItemId(item);
 }
 public int DeleteInventoryItem(InventoryItem item)
 {
     return InventoryItemData.Delete(item);
 }