Ejemplo n.º 1
0
        public bool UpdateQuantityOrder(long productId, decimal qtyUpdate, Enums.OrderType orderType = Enums.OrderType.SalesOrder)
        {
            var oldDetails = GetAll().Where(p => p.ProductId == productId).FirstOrDefault();
            var newDetails = new ProductDto();

            if (oldDetails.IsNull())
            {
                return(false);
            }
            else
            {
                newDetails = oldDetails;

                switch (orderType)
                {
                case Enums.OrderType.SalesOrder:
                    newDetails.Quantity = newDetails.Quantity - qtyUpdate;
                    break;
                }

                var details = newDetails.DtoToEntity();
                if (this._product.Update2(details).IsNull())
                {
                    return(false);
                }
            }


            return(true);
        }
Ejemplo n.º 2
0
        public long SaveProduct(ProductDto dto)
        {
            this.product = dto.DtoToEntity();

            if (this._product.Insert(this.product).IsNull())
            {
                return(0);
            }

            return(this.product.ProductID);
        }
Ejemplo n.º 3
0
        public bool UpdateDetails(ProductDto newDetails)
        {
            var details = newDetails.DtoToEntity();

            if (this._product.Update2(details).IsNull())
            {
                return(false);
            }


            return(true);
        }
Ejemplo n.º 4
0
        public long SaveDetails(ProductDto newDetails)
        {
            this.product = newDetails.DtoToEntity();
            var insertedProduct = this._product.Insert(this.product);

            if (insertedProduct.IsNull())
            {
                return(0);
            }


            return(insertedProduct.ProductID);
        }