Exemplo n.º 1
0
        static void CalcAvgFineByDriver()
        {
            var query = from f in Gibdd.GetFines()
                        group f by f.DriverId into g
                        select new { Did = g.Key, AvgFines = g.Average(k => k.Cost) };

            foreach (var q in query)
            {
                Console.WriteLine("{0}  {1}", q.Did, q.AvgFines);
            }
        }
Exemplo n.º 2
0
        static void GetUnpaidFines()
        {
            var fines = from p in Gibdd.GetFines()
                        where p.IsPaid == true
                        select p;

            foreach (var f in fines)
            {
                Console.WriteLine("{0} {1} {2}", f.DriverId, f.Cause, f.Cost);
            }
        }
Exemplo n.º 3
0
        static void GetFinesForExperience(int exp)
        {
            IList <Fines>   fines   = Gibdd.GetFines();
            IList <Drivers> drivers = Gibdd.GetDrivers();
            var             query   = from f in fines
                                      join d in drivers on f.DriverId equals d.Id
                                      where d.Experience > exp
                                      select new { FId = f.Id, DId = d.Id, Cause = f.Cause };

            foreach (var q in query)
            {
                Console.WriteLine("{0} {1} {2}", q.FId, q.DId, q.Cause);
            }
            Console.WriteLine("End");
            Console.Read();
        }