Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NSimulate.Example3.ReorderProcess"/> class.
 /// </summary>
 /// <param name='product'>
 /// Product to be reordered
 /// </param>
 public ReorderProcess(Product product)
 {
     _product = product;
 }
Example #2
0
 /// <summary>
 /// Checks the quantity of the specified product
 /// </summary>
 /// <returns>
 /// The quantity.
 /// </returns>
 /// <param name='product'>
 /// Product to check
 /// </param>
 public int CheckQuantity(Product product)
 {
     int currentQuantity = 0;
     QuantityByProduct.TryGetValue(product, out currentQuantity);
     return currentQuantity;
 }
Example #3
0
 /// <summary>
 /// Add the specified quantity of the specified product to this inventory
 /// </summary>
 /// <param name='product'>
 /// Product.
 /// </param>
 /// <param name='quantity'>
 /// Quantity.
 /// </param>
 public void Add(Product product, int quantity)
 {
     QuantityByProduct[product] = CheckQuantity(product) + quantity;
 }
Example #4
0
        /// <summary>
        /// Determines whether this instance can remove the specified product quantity.
        /// </summary>
        /// <returns>
        /// <c>true</c> if this instance can remove the specified product quantity; otherwise, <c>false</c>.
        /// </returns>
        /// <param name='product'>
        /// If set to <c>true</c> product.
        /// </param>
        /// <param name='quantity'>
        /// If set to <c>true</c> quantity.
        /// </param>
        public bool CanRemove(Product product, int quantity)
        {
            int currentQuantity = CheckQuantity(product);

            return (currentQuantity >= quantity);
        }
Example #5
0
 /// <summary>
 /// Remove the specified quantity of the specified product
 /// </summary>
 /// <param name='product'>
 /// Product.
 /// </param>
 /// <param name='quantity'>
 /// Quantity.
 /// </param>
 public void Remove(Product product, int quantity)
 {
     QuantityByProduct[product] = CheckQuantity(product) - quantity;
 }