private void AddDriver_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DriverModel newDriver = new DriverModel()
                {
                    FirstName         = FirstName.Text,
                    LastName          = LastName.Text,
                    Patronymic        = Patronymic.Text,
                    SerialPasp        = PaspSeries.Text,
                    NumberPasp        = PaspNumber.Text,
                    DateBirth         = DateBirth.SelectedDate.Value,
                    FullAddressLife   = CityLife.Text + " " + AddressLife.Text,
                    FullAddress       = City.Text + " " + AddressLife.Text,
                    Telephone         = Phone.Text,
                    DrivingExperience = int.Parse(Expirience.Text),
                    PostCode          = int.Parse(PostCode.Text),
                    Company           = Company.Text,
                    JobName           = JobName.Text,
                    Email             = Email.Text
                };
                if (ImageURL.Text == "")
                {
                    newDriver.Photo = null;
                }
                else
                {
                    newDriver.Photo = ImageLogic.ByteFromImage(ImageURL.Text);
                }
                DriverLogic.AddDriver(newDriver);

                MessageBox.Show("Водитель успешно добавлен!");

                switch (SecurityContext.CurrentWindow)
                {
                case Logic.Enums.EnumWindow.AddLicense:
                    this.Close();
                    break;

                case Logic.Enums.EnumWindow.AddTransport:
                    this.Close();
                    break;

                case Logic.Enums.EnumWindow.DriverList:
                    DriverList driverList = new DriverList();
                    driverList.Show();
                    this.Close();
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
 public IHttpActionResult AddDriver(DriverDto am)
 {
     try
     {
         ML.AddDriver(am);
         Console.WriteLine("dfd");
         return(Ok("pppp0"));
     }
     catch (Exception e)
     {
         return(BadRequest(e.ToString()));
     }
 }
Esempio n. 3
0
        public void TestAddNewDriver()
        {
            DriverLogic d    = new DriverLogic(this.driverRepo.Object);
            Driver      newd = new Driver()
            {
                TID        = Guid.NewGuid().ToString(),
                DID        = Guid.NewGuid().ToString(),
                DName      = "TestDriver",
                BornYear   = 1999,
                CountryB   = "TestCountry",
                RaceNumber = 1,
            };

            driverRepo.Setup(x => x.AddItem(It.IsAny <Driver>()));
            d.AddDriver(newd);
            driverRepo.Verify(x => x.AddItem(newd), Times.Once);
        }
Esempio n. 4
0
 public IActionResult DriverAdd(Driver driver)
 {
     //driver.TID = id;
     //driver.TIDN = teamLogic.GetTeam(id).TName;
     driver.DID = Guid.NewGuid().ToString();
     driverLogic.AddDriver(driver);
     driverLogic.UpdateDriver(driver.DID, driver);
     return(RedirectToAction(nameof(TeamList)));
 }
 public void AddDriver([FromBody] Driver item)
 {
     logic.AddDriver(item);
 }
Esempio n. 6
0
        public void FillDb()
        {
            //HomeControllerből átillesztett kód!
            League lg1 = new League {
                Name = "Formula 1 (F1)", Rating = 10, Homology = true, RaceTypes = RaceType.circuit
            };

            llogic.AddLeague(lg1);
            League lg2 = new League {
                Name = "Deutsche Tourenwagen Masters (DTM)", Rating = 5, Homology = false, RaceTypes = RaceType.circuit
            };

            llogic.AddLeague(lg2);
            League lg3 = new League {
                Name = "World Touring Car Championship (WTCC)", Rating = 7, Homology = false, RaceTypes = RaceType.circuit
            };

            llogic.AddLeague(lg3);
            League lg4 = new League {
                Name = "Le Mans Series", Rating = 8, Homology = false, RaceTypes = RaceType.circuit
            };

            llogic.AddLeague(lg4);
            League lg5 = new League {
                Name = "Formula E", Rating = 3, Homology = true, RaceTypes = RaceType.circuit
            };

            llogic.AddLeague(lg5);
            League lg6 = new League {
                Name = "World of Outlaws Sprint Car Series", Rating = 5, Homology = false, RaceTypes = RaceType.sprint
            };

            llogic.AddLeague(lg6);
            /*------------------------------------------------------------------------*/
            Team tm1 = new Team {
                TName = "Mercedes-AMG Petronas F1 Team", Created = 2010, Country = "Germany", Engine = ESuppliers.Mercedes, LID = lg1.LID
            };

            tlogic.AddTeam(tm1);
            Team tm2 = new Team {
                TName = "Aston Martin Red Bull Racing", Created = 2005, Country = "Austria", Engine = ESuppliers.Honda, LID = lg1.LID
            };

            tlogic.AddTeam(tm2);
            Team tm3 = new Team {
                TName = "Renault DP World F1 Team", Created = 1977, Country = "France", Engine = ESuppliers.Renault, LID = lg1.LID
            };

            tlogic.AddTeam(tm3);
            Team tm4 = new Team {
                TName = "Audi MotorSport Abt Sportsline", Created = 1991, Country = "Germany", Engine = ESuppliers.Audi, LID = lg2.LID
            };

            tlogic.AddTeam(tm4);
            Team tm5 = new Team {
                TName = "Zengő Motorsport Services KFT", Created = 1996, Country = "Hungary", Engine = ESuppliers.Seat, LID = lg3.LID
            };

            tlogic.AddTeam(tm5);
            Team tm6 = new Team {
                TName = "DragonSpeed Racing", Created = 2007, Country = "USA", Engine = ESuppliers.Gibson, LID = lg4.LID
            };

            tlogic.AddTeam(tm6);
            Team tm7 = new Team {
                TName = "Alfa Romeo Racing Orlen", Created = 2019, Country = "Switzerland", Engine = ESuppliers.Ferrari, LID = lg1.LID
            };

            tlogic.AddTeam(tm7);
            Team tm8 = new Team {
                TName = "McLaren-Renault", Created = 1963, Country = "Switzerland", Engine = ESuppliers.Renault, LID = lg1.LID
            };

            tlogic.AddTeam(tm8);
            /*------------------------------------------------------------------------*/
            Driver dr1 = new Driver {
                DName = "Valtteri Bottas", BornYear = 1989, CountryB = "Finland", RaceNumber = 77, TID = tm1.TID
            };

            dlogic.AddDriver(dr1);
            Driver dr2 = new Driver {
                DName = "Daniel Ricciardo", BornYear = 1989, CountryB = "Australia", RaceNumber = 3, TID = tm3.TID
            };

            dlogic.AddDriver(dr2);
            Driver dr3 = new Driver {
                DName = "Max Verstappen", BornYear = 1997, CountryB = "Belgium", RaceNumber = 33, TID = tm2.TID
            };

            dlogic.AddDriver(dr3);
            Driver dr4 = new Driver {
                DName = "Lucas di Grassi", BornYear = 1984, CountryB = "Brazil", RaceNumber = 11, TID = tm4.TID
            };

            dlogic.AddDriver(dr4);
            Driver dr5 = new Driver {
                DName = "Boldizs Bence", BornYear = 1997, CountryB = "Hungary", RaceNumber = 55, TID = tm5.TID
            };

            dlogic.AddDriver(dr5);
            Driver dr6 = new Driver {
                DName = "Ben Hanley", BornYear = 1985, CountryB = "England", RaceNumber = 27, TID = tm6.TID
            };

            dlogic.AddDriver(dr6);
            Driver dr7 = new Driver {
                DName = "Esteban Ocon", BornYear = 1996, CountryB = "France", RaceNumber = 31, TID = tm3.TID
            };

            dlogic.AddDriver(dr7);
            Driver dr8 = new Driver {
                DName = "Kimi Räikkönen", BornYear = 1979, CountryB = "Finland", RaceNumber = 7, TID = tm7.TID
            };

            dlogic.AddDriver(dr8);
            Driver dr9 = new Driver {
                DName = "Lando Norris", BornYear = 1999, CountryB = "England", RaceNumber = 4, TID = tm8.TID
            };

            dlogic.AddDriver(dr9);
            Driver dr10 = new Driver {
                DName = "Carlos Sainz Jr.", BornYear = 1994, CountryB = "Spain", RaceNumber = 55, TID = tm8.TID
            };

            dlogic.AddDriver(dr10);
            Driver dr11 = new Driver {
                DName = "Paul Di Resta", BornYear = 1986, CountryB = "England", RaceNumber = 40, TID = tm8.TID
            };

            dlogic.AddDriver(dr11);
        }
Esempio n. 7
0
        static void Main(string[] args)

        {
            var data = new DateTime();

            data = DateTime.UtcNow;
            App_Start.NHibernateProfilerBootstrapper.PreStart();
            Employee employee = new Employee("George", "Mihai", "sssa", "2121", 22, data);

            //   Driver driver=new Driver(employee,1,true,1.22);
            employeeFactory    = ServiceLocator.Get <Factory>();
            employeeRepository = ServiceLocator.Get <IEmployeeRepository>();
            driverRepository   = ServiceLocator.Get <IDriverRepository>();
            //var employee = employeeFactory.CreateNewDriver("George", "Birau", "Stra", "2121212", 22);
            var aaa = employeeRepository.SlectAllEmployees();

            //employeeRepository.ShowTop3EmployeesbySalary();
            // employeeRepository.ShowDriverSalary();
            //    employeeRepository.EmployeeDate();
            employeeRepository.SubSelectEmployees();
            //      // employeeRepository.Save(employee);

            Testx();
            SortGeneric sortGeneric = new SortGeneric();

            string[] cuvinte = { "da", "ba", "aa" };
            int[]    numere  = { 1, 2, 3 };
            sortGeneric.Sortare(cuvinte);
            sortGeneric.Sortare(numere);


            DriverLogic   driverLogic = new DriverLogic();
            TaxiLogic     taxiLogic   = new TaxiLogic();
            IncarcareDate loadDate    = new IncarcareDate();


            int choice       = 0;
            var sourceobject = new object[]
            {
                new Product {
                    Name = "paine", Price = 2
                },

                new Product
                {
                    Name = "Caise", Price = 3
                }
            };
            var taxiuri = new List <TaxiCar> {
            };
            var drivers = new List <Driver> {
            };

            loadDate.IncarcaDateDrivers(drivers);
            loadDate.IncarcaDateTaxiuri(taxiuri);
            //    var compareString = new DriverLogic.SortingDelegate(DriverLogic.SortingDelegateDriver);
            EventAssignament14.MyEvent evt = new EventAssignament14.MyEvent();
            EventAssignament14.Add     add = new EventAssignament14.Add();

            while (choice != 10)
            {
                Console.WriteLine("1)AddTaxi");
                Console.WriteLine("2)Afisare Taxiuri");
                Console.WriteLine("3)Adauga Sofer");
                Console.WriteLine("4)Afisare Soferi");
                Console.WriteLine("5)Cauta sofer");
                Console.WriteLine("6)Asigneaza Masina");
                Console.WriteLine("9)Tema");
                Console.WriteLine("12)ProxyPatern");
                Console.WriteLine("10)Exit");
                Console.Write("Introduceti Optiunea: ");
                choice = int.Parse(Console.ReadLine());
                Console.Clear();
                switch (choice)

                {
                //Adaugare Taxiuri
                case 1:
                    int  z        = 0;
                    bool isEmpty1 = taxiuri.Any();
                    if (isEmpty1)
                    {
                        z = taxiuri.Max(x => x.Id);
                        z++;
                    }
                    else
                    {
                        z = 1;
                    }

                    taxiLogic.AddTaxi();

                    evt.SomeEvent += new EventAssignament14.MyEventHandler(add.TaxiAdded);
                    evt.OnSomeEvent();

                    Console.ReadLine();

                    //Afisare Taxiuri
                    break;

                case 2:
                    taxiuri.Clear();
                    loadDate.IncarcaDateTaxiuri(taxiuri);
                    Console.WriteLine("Toate Taxiurile:");
                    foreach (var b in taxiuri)
                    {
                        Console.WriteLine("ID:{0} Marca:{1} Plate:{2} Price:{3}", b.Id, b.Brand, b.Plate, b.Price);
                    }
                    Console.WriteLine("____________________________________");
                    Console.ReadLine();
                    Console.Clear();

                    break;

                //Adaugare Soferi
                case 3:
                    //int p;
                    //bool isEmpty = drivers.Any();
                    //if (isEmpty)
                    //{
                    //    p = drivers.Max(x => x.id);
                    //    p++;
                    //}

                    //else
                    //{
                    //    p = 1;
                    //}

                    driverLogic.AddDriver();
                    // loadDate.IncarcaDateDrivers(drivers);

                    break;

                //Afisare Soferi
                case 4:
                    //  driverLogic.ShowDrivers(drivers);
                    Console.ReadLine();
                    Console.Clear();

                    break;

                //Cautare
                case 5:
                    string deCautat;
                    Console.Write("Numele soferului pe care il cautati:");
                    deCautat = Console.ReadLine();
                    //   SearchDriver(deCautat, drivers);
                    break;

                //Adaugare Masina
                case 6:
                    Console.WriteLine("Cui vrei sa asignezi o masina");
                    string deAssignat = Console.ReadLine();
                    //   taxiLogic.Cauta(deAssignat,drivers,taxiuri);

                    break;

                case 7:
                    // driverLogic.Sort(drivers, delegate(Driver x, Driver y)
                    // {
                    //    return x.FirstName[0] > y.FirstName[0];
                    //});
                    break;

                case 8:
                    taxiLogic.OperatorUse(taxiuri);

                    Console.ReadLine();
                    break;

                case 9:
                    // driverLogic.Sort(drivers, (x,y) =>(((Driver)x).FirstName[0])>((Driver)y).FirstName[0]);
                    break;

                case 10:
                    Console.Write("Programul se v-a inchide singur in 2 secunde");
                    Thread.Sleep(2000);
                    break;

                case 11:

                    //Console.WriteLine(drivers.Concat("+"));
                    //Console.WriteLine(StringHelpers.Concat(drivers, "*"));
                    Console.ReadLine();
                    break;

                case 12:
                    //     driverLogic.ProxyShowDriver(drivers,taxiuri);
                    break;

                case 13:
                //// Driver mihai =new Driver();
                // Angajat alex = mihai as Angajat;
                // Angajat george = (Angajat) alex;
                // Console.WriteLine(mihai is Driver);
                // Console.WriteLine(alex is Driver);
                // break;
                default:
                    Console.WriteLine("Optiunea introdusa nu exista");
                    break;
                }
            }
        }