using System;
using System.Collections.Generic;
using System.Text;

namespace ConnectedDataSet
{
   class Program
   {
      static void Main(string[] args)
      {
         ConnectedOrderDataSetTableAdapters.OrdersTableAdapter orderTa =
           new ConnectedOrderDataSetTableAdapters.OrdersTableAdapter();
         ConnectedOrderDataSetTableAdapters.OrderItemsTableAdapter orderItemsTa =
           new ConnectedOrderDataSetTableAdapters.OrderItemsTableAdapter();

         ConnectedOrderDataSet orderData = new ConnectedOrderDataSet();
         orderTa.Fill(orderData.Orders);
         orderItemsTa.Fill(orderData.OrderItems);

         foreach (ConnectedOrderDataSet.OrdersRow order in orderData.Orders)
         {
            Console.WriteLine("Zamówienie {0} złożone przez {1} dnia {3}", order.OrderID,
              order.ShipTo, order.OrderDate.ToShortDateString());
            foreach (ConnectedOrderDataSet.OrderItemsRow orderItem in
              order.GetOrderItemsRows())
            {
               Console.WriteLine("\t{0} – {1} za {2:00.00}PLN", orderItem.SKU,
                 orderItem.ItemDescription, orderItem.Price);
            }
         }

         Console.ReadLine();
      }
   }
}
