Exemplo n.º 1
0
        public void TestCreateDelivery()
        {
            Order order = new Order(123456, "Big Smoke", "Grove Street");

            order.AddOrderItem(item1);
            supplyService.CreateDelivery(order);
        }
Exemplo n.º 2
0
        public void SendPackage(string itemName, string store, int userId)
        {
            MarketLog.Log("OrderPool", "Attempting to send package...");
            int orderId = 0;

            try
            {
                OrderItem toBuy = new OrderItem(store, null, "DELIVERY : " + itemName, 1, 1);
                Order     order = InitOrder(_orderDL.GetNameToRefund(userId), _orderDL.GetAddressToSendPackage(userId));
                orderId = order.GetOrderID();
                order.AddOrderItem(toBuy);
                _supplyService.CreateDelivery(order);
                Orders.Add(order);
                _orderDL.AddOrder(order, "Lottery");
                MarketLog.Log("OrderPool", "Successfully made delivery for item: " + itemName);
            }
            catch (OrderException)
            {
                MarketLog.Log("OrderPool", "Order " + orderId + " has failed to execute. Error message has been created!");
            }
            catch (WalleterException)
            {
                MarketLog.Log("OrderPool", "Order " + orderId + " has failed to execute while communicating with payment system." +
                              " Error message has been created!");
            }
            catch (SupplyException)
            {
                MarketLog.Log("OrderPool", "Order " + orderId + " has failed to execute while communicating with supply system." +
                              " Error message has been created!");
            }
            catch (MarketException)
            {
                MarketLog.Log("OrderPool", "Order " + orderId + " has failed to execute. Something is wrong with Store or User." +
                              " Error message has been created!");
            }
        }