Beispiel #1
0
        /// <summary>
        /// Increase the product stock in warehouse
        /// </summary>
        /// <param name="product_code">
        /// A <see cref="System.String"/>
        /// </param>
        /// <param name="qty">
        /// A <see cref="System.Int32"/>
        /// </param>
        /// <returns>
        /// A <see cref="SMProduct"/>
        /// </returns>
        public static SBProduct increaseProductStock(string product_code, int qty)
        {
            SBProduct p = SBWarehouse.getProduct(product_code);

            p.Quantity = p.Quantity + qty;
            p.Update();
            return(p);
        }
Beispiel #2
0
        /// <summary>
        /// Descrease the product stock in warehouse
        /// </summary>
        /// <param name="product_code">
        /// A <see cref="System.String"/>
        /// </param>
        /// <param name="qty">
        /// A <see cref="System.Int32"/>
        /// </param>
        /// <returns>
        /// A <see cref="SMProduct"/>
        /// </returns>
        public static SBProduct restStock(string product_code, int qty)
        {
            SBProduct p = SBWarehouse.getProduct(product_code);

            p.Quantity = p.Quantity - qty;
            p.Quantity = (p.Quantity < 0) ? 0 : p.Quantity;
            p.Update();
            return(p);
        }