Esempio n. 1
0
 public Trip(Employee init, Vehicle v, DateTime date, City departure, City destination, long length)
 {
     this.ID = lastID;
     lastID++;
     this.TripOwner = init;
     this.departureDate = date;
     this.DepartureCity = departure;
     this.DestinationCity = destination;
     this.IsAprooved = false;
     this.Vehicle = v;
     this.Travellers = new List<Employee>();
     this.Stops = new List<TripStops>();
     this.isFull = false; //nijedno vozilo nije kapaciteta točno jedan
     this.TripLength = length;
     this.TripCost = length * v.Consumption * avgCost; //informacija za menadžera
     TripStops tmp = new TripStops(DepartureCity, date, 1);
     this.addStop(tmp); //što s destinationom? što je s povratnom rutom? razraditi!
     this.addTraveller(init);
     TripStops tmpStop = new TripStops(DestinationCity, departureDate.AddDays(1),1);
     this.addStop(tmpStop);
     this.Vehicle.IsAvailable = false; //zauzmi vozilo
     this.TripOwner.AddTripInit(this);
     this.isDone = false;
 }
Esempio n. 2
0
        //dodati get trip by id
        public void Load()
        {
            City c = new City("Karlovac","Croatia");
            TripStops t = new TripStops(c,new DateTime(2013, 3, 15, 18, 30, 00), 2);
            Trip trip = new Trip(EmployeeRepository.GetInstance().getEmployeeByOib("10257841210"), VehicleRepository.GetInstance().getVehicleByID(1),new DateTime(2013, 3, 15, 17, 30, 00), new City("Zagreb", "Croatia"), new City("Gospić", "Croatia"),100);
            trip.addStop(t);
            TripRepository.GetInstance().addTrip(trip);

            c = new City("Zaprešić", "Croatia");
            t = new TripStops(c, DateTime.Today, 2);
            trip = new Trip(EmployeeRepository.GetInstance().getEmployeeByOib("10778125367"), VehicleRepository.GetInstance().getVehicleByID(1), new DateTime(2012, 4, 10, 18, 50, 0), new City("Zagreb", "Croatia"), new City("Gospić", "Croatia"), 100);
            trip.addStop(t);
            trip.addTraveller(EmployeeRepository.GetInstance().getEmployeeByOib("77812541042"));
            TripRepository.GetInstance().addTrip(trip);

            c = new City("Zagreb", "Croatia");
            t = new TripStops(c, DateTime.Today, 2);
            trip = new Trip(EmployeeRepository.GetInstance().getEmployeeByOib("77812541042"), VehicleRepository.GetInstance().getVehicleByID(2), new DateTime(2013,4,5,10,30,0), new City("Osijek", "Croatia"), new City("Gospić", "Croatia"), 200);
            trip.addStop(t);
            //10234781881
            trip.addTraveller(EmployeeRepository.GetInstance().getEmployeeByOib("10257841210"));
            trip.addTraveller(EmployeeRepository.GetInstance().getEmployeeByOib("10234781881"));
            TripRepository.GetInstance().addTrip(trip);
        }
Esempio n. 3
0
 public void addStop(TripStops stop)
 {
     this.Stops.Add(stop);
 }
        public void TestMethod6()
        {
            //arrange

            Employee e1 = new Employee("12348501236","Jelena", "Cvitanović", "Indirektna prodaja", "0989036876", "*****@*****.**");
            Employee e2 = new Employee("", "Pero", "Perić", "Financije", "0977253426", "*****@*****.**");
            City city = new City("Zagreb", "Croatia");
            City city2 = new City("Ljubljana", "Slovenia");
            e1.removeAllTrips();
            e2.removeAllTrips();
            Vehicle v = new Vehicle(VehicleType.car, "Toyota", 2, 7, city);
            VehicleRepository.GetInstance().RemoveAllVehicles();
            VehicleRepository.GetInstance().AddNewVehicle(v);

            Trip t = new Trip(e1, v, DateTime.Today, city, city2, 100);
            t.addTraveller(e2);
            TripStops stop1 = new TripStops(new City("Karlovac", "Croatia"), DateTime.Today, 4);
            t.addStop(stop1);

            //act

            int check = t.Stops.Count();

            //assert

            Assert.AreEqual(2, check, "Nesipravno bilježnjenje rute");
        }