Ejemplo n.º 1
0
        private static void ReadOrder()
        {
            var getInput  = new GetInput();
            var getOutput = new GetOutput();

            int id              = getInput.OrderID();
            var orderDto        = getOutput.GetOrderByID(id);
            var orderDetailsDto = getOutput.GetOrderDetailsByID(id);

            if ((orderDto == null) || (orderDetailsDto == null))
            {
                ReallyImportantMessage("Error.");
            }

            Console.Clear();
            Line();
            MessageInsideBox($"Order number: {id}");
            Line();

            PrintOrder(orderDto);

            var productServices = new ProductServices();

            int count = 0;

            foreach (var od in orderDetailsDto)
            {
                count++;
                Line();
                MessageInsideBox($"Bill number {count}");
                Line();
                MessageInsideBox($"Product: {productServices.GetProductNameById(od.ProductID)}");
                MessageInsideBox($"Unit price: {String.Format("{0:0.00}", od.UnitPrice)}");
                MessageInsideBox($"Quantity: {od.Quantity}");
                MessageInsideBox($"Discount: {od.Discount}");
                MessageInsideBox($"Subtotal: {String.Format("{0:0.00}", getOutput.Subtotal(od))}");
            }
            Line();
            MessageInsideBox($"Total(with freight): {String.Format("{0:0.00}", getOutput.Total(orderDto))}");

            ImportantMessage("Press any key to continue...");
        }
Ejemplo n.º 2
0
        private static void ShowAllReceipts()
        {
            var getOutput        = new GetOutput();
            var customerServices = new CustomerServices();
            var orderServices    = new OrderServices();

            var oDetailList = getOutput.GetAllOrderDetails();

            foreach (var od in oDetailList)
            {
                string customerID = orderServices.Find(od.OrderID).CustomerID;

                Line();
                MessageInsideBox($"ORDER {od.OrderID} | CLIENT: {customerServices.GetName(customerID)} | TOTAL: {String.Format("{0:0.00}", getOutput.Subtotal(od))}");
            }
            ImportantMessage("Press any key to continue...");
        }