Example #1
0
        static void Main(string[] args)
        {
            using (var context = new AutoServiceDataBase())
            {
                ReadAuto();
                ReadSalePeople();
                ReadClient();
                ReadContract();
                ReadInformation();
                GetPages(context);
                zapros2(1000, context);
                zapros3(3000, context);
                zapros4(50, context);
            }


            Stopwatch clock = new Stopwatch();

            clock.Start();
            CreateAuto(2, "Mark2tourerv", "Toyota", "1jz-gte-500HP", 0);
            UpdateAuto(2, "Mark2tourerv", "Toyota", "1jz-gte-500HP", 0);
            DeleteAuto(2, "Mark2tourerv", "Toyota", "1jz-gte-500HP", 0);

            clock.Stop();
            Console.WriteLine(clock.ElapsedMilliseconds);

            Console.ReadKey();
        }
Example #2
0
        public static void zapros3(int x, AutoServiceDataBase context)
        {
            var contracts = context.Contracts(p => p.Amount > x).OrderBy(p => p.Amount);

            foreach (var contract in contracts)
            {
                Console.WriteLine("Id контракта: " + contract.Id + " Оплата: " + contract.Amount);
            }
        }
Example #3
0
        public static void zapros2(int x, AutoServiceDataBase context)
        {
            var peoples = context.SalePeoples
                          .Where(p => p.WageDollars == x);

            foreach (var people in peoples)
            {
                Console.WriteLine("Name is:" + people.Name + " he earns " + x + "money");
            }
        }
Example #4
0
        public static void zapros4(int x, AutoServiceDataBase context)
        {
            var contractPeople = context.Contracts.Join(context.SalePeoples,
                                                        c => c.SalePeopleID,
                                                        s => s.SalePeopleID,
                                                        (c, s) => new
            {
                ContrID    = c.ContractID,
                PersonName = s.Name,
                Wage       = s.WageDollars
            }).Where(rec => rec.Wage == x);

            foreach (var cp in contractPeople)
            {
                Console.WriteLine("Id контракта: " + cp.ContrID + " Продавец: " + cp.PersonName);
            }
        }
Example #5
0
        public static void GetPages(AutoServiceDataBase context)
        {
            AutoLogic orderLogic = new AutoLogic(context);
            var       autos      = orderLogic.ReadPage(0, 4);

            foreach (var order in autos)
            {
                Console.WriteLine(order.ModelName + " "
                                  + order.BrandName + " " + order.TypeMotor + " " + order.CountAirbags);
            }
            Console.WriteLine();
            ClientLogic authorLogic = new ClientLogic(context);
            var         clients     = authorLogic.ReadPage(0, 4);

            foreach (var author in clients)
            {
                Console.WriteLine(author.Name + " " + author.InformationId);
            }
            Console.WriteLine();
        }