// constructor for NEW Order Item - This constructor creates a GUID for the new Order Item
 public OrderItem(CatalogItem catalogItem, string itemInscription, int quantityOrdered)
 {
     _orderItemId = Guid.NewGuid();
     _catalogItem = catalogItem;
     _itemInscription = itemInscription;
     _quantityOrdered = quantityOrdered;
 }
 // constructor for loading an EXISTING Order Item - This constructor DOES NOT create a new GUID
 public OrderItem(Guid orderItemId, CatalogItem catalogItem, string itemInscription, int quantityOrdered)
 {
     _orderItemId = orderItemId;
     _catalogItem = catalogItem;
     _itemInscription = itemInscription;
     _quantityOrdered = quantityOrdered;
 }
        public static BusinessObject.CatalogItem ToBusinessObject(Entities.CatalogItem entity)
        {
            if (entity == null)
                return null;

            BusinessObject.CatalogItem businessObject = new BusinessObject.CatalogItem(entity.CatalogItemId)
            {
                InscriptionType = (Enumeration.InscriptionType)entity.InscriptionTypeId,
                ItemCost = entity.ItemCost,
                Manufacturer = entity.Manufacturer,
                NumberInscriptionLines = entity.NumberInscriptionLines,
                NumberLineCharacters = entity.NumberLineCharacters,
                ItemName = entity.ItemName,
                ItemRetailPrice = entity.ItemRetailPrice
            };

            return businessObject;
        }
Example #4
0
        public static BusinessObject.CatalogItem ToBusinessObject(Entities.CatalogItem entity)
        {
            if (entity == null)
            {
                return(null);
            }

            BusinessObject.CatalogItem businessObject = new BusinessObject.CatalogItem(entity.CatalogItemId)
            {
                InscriptionType        = (Enumeration.InscriptionType)entity.InscriptionTypeId,
                ItemCost               = entity.ItemCost,
                Manufacturer           = entity.Manufacturer,
                NumberInscriptionLines = entity.NumberInscriptionLines,
                NumberLineCharacters   = entity.NumberLineCharacters,
                ItemName               = entity.ItemName,
                ItemRetailPrice        = entity.ItemRetailPrice
            };

            return(businessObject);
        }
Example #5
0
        public static Entities.CatalogItem ToEntity(BusinessObject.CatalogItem businessObject)
        {
            if (businessObject == null)
            {
                return(null);
            }

            Entities.CatalogItem entity = new Entities.CatalogItem
            {
                InscriptionTypeId      = (int)businessObject.InscriptionType,
                CatalogItemId          = businessObject.CatalogItemId,
                ItemCost               = businessObject.ItemCost,
                Manufacturer           = businessObject.Manufacturer,
                NumberInscriptionLines = businessObject.NumberInscriptionLines,
                NumberLineCharacters   = businessObject.NumberLineCharacters,
                ItemName               = businessObject.ItemName,
                ItemRetailPrice        = businessObject.ItemRetailPrice
            };

            return(entity);
        }
Example #6
0
        public static List <BusinessObject.InventoryItem> PopulateInventoryItemWithCatalogItemInfo(List <BusinessObject.InventoryItem> inventoryItems
                                                                                                   , BusinessObject.CatalogItem catalogItem)
        {
            if ((inventoryItems == null) || (catalogItem == null))
            {
                return(null);
            }

            List <BusinessObject.InventoryItem> items = new List <BusinessObject.InventoryItem>();

            foreach (BusinessObject.InventoryItem item in inventoryItems)
            {
                items.Add(PopulateInventoryItemWithCatalogItemInfo(item, catalogItem));
            }
            return(items);
        }
Example #7
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 List<InventoryItem> GetInventoryItemByCatalogItemIdAndInventoryItemStatusId(CatalogItem catalogItem, int inventoryItemStatus)
 {
     if (catalogItem != null)
     {
         BusinessObjects _businessObjects = new BusinessObjects();
         return (catalogItem.CatalogItemId != null && catalogItem.CatalogItemId != Guid.Empty)
             ? _businessObjects.GetInventoryItemByCatalogItemIdAndInventoryItemStatusId(catalogItem.CatalogItemId, inventoryItemStatus)
             : null;
     }
     else
     {
         return null;
     }
 }
 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;
     }
 }