Пример #1
0
        public static void Main(string[] args)
        {
            Order order = new Order(10);
            //OrderItem orditem = new OrderItem();
            OrderRepository  or  = new OrderRepository();
            OrderDisplay     od  = or.RetrieveOrderDisplay(10);
            OrderDisplayItem odi = new OrderDisplayItem();

            Console.WriteLine(od.FirstName + " " + od.LastName);
            Console.WriteLine(od.OrderDate);
            AddressRepository ar = new AddressRepository();
            Address           a  = new Address();

            ar.RetrieveByCustomerId(1);
            Console.WriteLine(ar.RetrieveByCustomerId(10));
            //a = ar.RetrieveByCustomerId(10);
            //or.RetrieveOrderDisplay(10);

            /*var a=or.RetrieveOrderDisplay(10).OrderDisplayItemList;
             * // odi.
             * Console.WriteLine(a); //or.Retrieve(10);
             * List<OrderDisplay> lOrder = new List<OrderDisplay>();
             * lOrder.Add(or.RetrieveOrderDisplay(10).OrderDisplayItemList.Or);
             * //foreach (OrderRepository orr in lOrder)
             * //Console.WriteLine(or.Retrieve(10) ); //or.Retrieve(10);
             * //List<Order> lOrder = new List<Order>();
             * //lOrder.Add(or.RetrieveOrderDisplay(10));
             * foreach(Order orr in lOrder)
             * {
             *  Console.WriteLine(orr.OrderId);
             *  Console.WriteLine(orr.OrderDate);
             *  Console.WriteLine(orr.orderItems);
             * }
             * //Console.WriteLine(or.RetrieveOrderDisplay(10));*/
        }
Пример #2
0
        public OrderDisplay RetrieveOrderDisplay(int orderId)
        {
            OrderDisplay orderDisplay = new OrderDisplay();

            var addressRepository = new AddressRepository();

            if (orderId == 10)
            {
                orderDisplay.FirstName       = "William";
                orderDisplay.LastName        = "Smith";
                orderDisplay.OrderDate       = new DateTimeOffset(2017, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0));
                orderDisplay.ShippingAddress = addressRepository.Retrieve(1);
            }

            orderDisplay.OrderDisplayItemList = new List <OrderDisplayItem>();

            if (orderId == 10)
            {
                var orderDisplayItem = new OrderDisplayItem()
                {
                    ProductName   = "Mouse",
                    PurchasePrice = 14.93M,
                    OrderQuantity = 2
                };
                orderDisplay.OrderDisplayItemList.Add(orderDisplayItem);

                orderDisplayItem = new OrderDisplayItem()
                {
                    ProductName   = "USB Drive",
                    PurchasePrice = 8M,
                    OrderQuantity = 1
                };
                orderDisplay.OrderDisplayItemList.Add(orderDisplayItem);
            }
            return(orderDisplay);
        }