/// <summary>
        /// Created by Michael Takrama
        /// 04/28/2017
        ///
        /// Submits order lines for Order
        /// </summary>
        /// <param name="cart"></param>
        /// <param name="orderId"></param>
        /// <returns></returns>
        private static bool SubmitOrderLines(Cart cart, int orderId)
        {
            try
            {
                bool all = cart.Lines.Select(o => new OrderLine
                {
                    ProductOrderID = orderId,
                    ProductName    = o.Product.Name,
                    ProductID      = o.Product.ProductId,
                    Quantity       = o.Quantity,
                    GradeID        = o.Product.GradeId,
                    Price          = (decimal)o.Product.Price,
                    UnitDiscount   = 0 //temporaire
                }).All(lineToWrite => 0 < OrderLineAccessor.CreateOrderLine(lineToWrite));

                if (!all)
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                throw;
            }

            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  Eric Walton
        ///  2017/10/3
        ///  Calls order line accessor to retrieve an orderling by order id
        /// </summary>
        /// <param name="ProductOrderId"></param>
        /// <param name="OrderAmount"></param>
        /// <returns></returns>
        public List <OrderLine> RetrieveOrderLineListByProductOrderId(int ProductOrderId, Decimal OrderAmount)
        {
            List <OrderLine> result = null;

            try
            {
                result = OrderLineAccessor.RetrieveOrderLinesByProductOrderId(ProductOrderId, OrderAmount);
            }
            catch (Exception)
            {
                throw;
            }
            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Eric Walton
        /// 2017/10/3
        /// Calls order line accessor create order line and retrieves
        /// the order line id
        /// </summary>
        /// <param name="orderLine"></param>
        /// <returns></returns>
        public int CreateOrderLine(OrderLine orderLine)
        {
            int result = 0;

            try
            {
                result = OrderLineAccessor.CreateOrderLine(orderLine);
            }
            catch (Exception)
            {
                throw;
            }
            return(result);
        }