Exemplo n.º 1
0
        // TASK 5 - Find orders for a given region and date range
        private static void PrintOrdersByRegionAndDateRange(string region, DateTime startDate, DateTime endDate)
        {
            var regionResult = OrdersUtils.FindOrderByRegion(region, startDate, endDate);

            Console.WriteLine();
            foreach (var sale in regionResult)
            {
                Console.WriteLine(sale);
            }
        }
Exemplo n.º 2
0
        // TASK 6 - see NorthwindEntity.Twin.Model

        // TASK 8 - By inheriting the Employee entity class create a class which allows employees to access their corresponding territories as property of type



        // Task 9 - Add new order.
        private static void AddOrders()
        {
            // In the current demo, the product, linked to the order is done in the OrdersUrils method...
            Order[] orders =
            {
                new Order {
                    CustomerID = "PARIS", ShipName = "Ship 121", ShipRegion = "BS", ShippedDate = new DateTime(2013, 7, 17)
                }
            };

            OrdersUtils.AddOrders(orders);

            Console.WriteLine("Orders added:");
            PrintOrdersByRegionAndDateRange("BS", new DateTime(2013, 7, 16), new DateTime(2013, 7, 18));
            Console.WriteLine();
        }
Exemplo n.º 3
0
        // THis is for testing purpoises - trying to do some kind of delegating tasks.. it's not the best approach.
        // TASK 3 - Find customers from Canada, who made orders after 1997
        private static void PrintCustomersByDateAndCountry(DateTime date, string country)
        {
            var ordersByDate    = OrdersUtils.FindOrderByDate(date);
            var ordersByCountry = OrdersUtils.FindOrderByCountry(country);

            var foundOrdersIds = ordersByDate.Select(id => id.OrderID).Intersect(ordersByCountry.Select(id => id.OrderID));
            var found          = ordersByDate.Where(o => foundOrdersIds.Contains(o.OrderID));

            var orders         = found.ToList();
            var customersFound = CustomerUtils.GetCustomersByOrdersList(orders);

            Console.WriteLine();

            foreach (var customer in customersFound)
            {
                Console.WriteLine(customer.ContactName);
            }

            Console.WriteLine();
        }