Exemplo n.º 1
0
        //this method sets the initial state of your inventory
        public static InventoryState SetState(Product item, int amountOnHand, bool allowBackOrder, DateTime dateAvailable)
        {
            InventoryState result = null;

            if (item.IsOnPreOrder()) {
                result=new OnPreOrder(item);
            } else if (item.IsUnavailable()) {
                result = new Unavailable(item);
            } else if (item.IsOnBackOrder()) {
                result = new OnBackOrder(item);
            } else {
             result = new InStock(item);
            }

            return result;
        }
        //this method sets the initial state of your inventory
        public static InventoryState SetState(Product item, int amountOnHand, bool allowBackOrder, DateTime dateAvailable)
        {
            InventoryState result = null;

            if (item.IsOnPreOrder())
            {
                result = new OnPreOrder(item);
            }
            else if (item.IsUnavailable())
            {
                result = new Unavailable(item);
            }
            else if (item.IsOnBackOrder())
            {
                result = new OnBackOrder(item);
            }
            else
            {
                result = new InStock(item);
            }

            return(result);
        }