Beispiel #1
0
        public Order AddItem(Order newObject)
        {
            if (newObject == null)
            {
                return(null);
            }
            newObject.Id          = GeneratorOrderId();
            newObject.DateCreated = DateTime.Now;
            var execResult = _dao.Add(newObject);

            if (execResult != null)
            {
                _emailSender.Send("New Order", JsonSerializer.Serialize(execResult));
            }
            this.UpdateStatus(execResult.Id, EOrderStatus.NotConfirm);
            return(execResult);
        }
Beispiel #2
0
        public static void Add(Cart cart, Order order)
        {
            Random rnd = new Random();
            int    id  = rnd.Next(100, 100000);
            var    tmp = orderDAO.FindByID(id);

            order.Total     = (int)cart.TotalValue;
            order.OrderDate = DateTime.Now;
            orderDAO.Add(order);

            foreach (var item in cart.Lines)
            {
                orderDetDAO.Add(new OrderDet()
                {
                    OrderID   = order.OrderID,
                    ProductID = item.product.ProductID,
                    Quantity  = item.Quantity,
                    Price     = item.product.Price,
                    Total     = item.Quantity * item.product.Price
                });
            }
        }
Beispiel #3
0
 public int Add(Order order)
 {
     return(orderDAO.Add(order));
 }