Ejemplo n.º 1
0
        /// <summary>
        /// Instantiating Respiratory and NorthWind classes to use in solutions.
        /// And runs solutions.
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            Console.WriteLine("Attaching NORTHWND.MDF");
            using (NORTHWNDEntities1 db = new NORTHWNDEntities1())
            {
                Console.WriteLine("Connecting NORTHWND.MDF");
                db.Database.Connection.Open();
                Console.WriteLine("Connected");
                Respiratory respiratory = new Respiratory(db);
                NorthWind northWind = new NorthWind(respiratory);
                Console.WriteLine("Preparing database meta data");
                //Dummy query
                northWind.Products().Take(0);
                Console.WriteLine("Ready");
               // ReportingModule reportingModule = new ReportingModule(northWind);
                //IList<OrdersByTotalPriceDto> reportedOrders = reportingModule.TopOrdersByTotalPrice(5).Data;
                northWind.newOrderEvent += subscription;
                Console.WriteLine("Adding an order to Denmark.");
                northWind.AddOrder(DateTime.Now, "testName", "testAddress", "testCity", "testRegion", "2300", "Denmark");

                //Write list with name of first 5 products
                First5Products(northWind);

                //Write the counting of orders by shipping country. Order the output by descending count [use LINQ]
                OrdersByShippingCountry(northWind);
                Console.WriteLine("Finished");

                Console.ReadLine();
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Sets the Respiratory
 /// </summary>
 /// <param name="respiratory">A Respiratory containing data classes</param>
 public NorthWind(Respiratory respiratory)
 {
     this.respiratory = respiratory;
 }