コード例 #1
0
ファイル: BuyerUI.cs プロジェクト: IrenZ26/FoodDelivery21
        public void CreateOrder(DeliveryData deliveryData, OrderData orderData, ProductData productData, Buyer buyer)
        {
            bool isExist = IsExist(orderData, buyer);
            var  answer  = 2;
            var  order   = new OrderUI();

            if (isExist)
            {
                answer = GetResult();
            }
            if (answer == 1)
            {
                var buyerClient = new BuyerInterface();
                buyerClient.ShowOrder(orderData, default, buyer, false);
コード例 #2
0
ファイル: OrderUI.cs プロジェクト: IrenZ26/FoodDelivery21
        public void CreateOrder(DeliveryData deliveryData, OrderData orderData, ProductData productData, Buyer buyer)
        {
            bool isContinue   = true;
            var  buyerClient  = new BuyerInterface();
            var  orderService = new OrderService();
            var  delivery     = new DeliveryUI();
            int  id           = GetId(orderData);

            while (isContinue)
            {
                orderData.Orders.Add(orderService.AddOrderItem(productData, buyer, id));
                isContinue = buyerClient.Continue();
            }
            decimal totalPrice    = delivery.GetDeliveryPrice(orderData, buyer);
            decimal deliveryPrice = delivery.GetDelivery(deliveryData);

            delivery.SetDeliveryPrice(orderData, buyer, deliveryPrice);
            totalPrice += deliveryPrice;
            buyerClient.ShowOrder(orderData, totalPrice, buyer, true);
            var logger = new Logger();

            logger.SaveIntoFile("The total order`s price was calculated");
        }