Exemple #1
0
        public Car CreateNewCar(double fuelTankVolume, double weight, int horsePower,
            EngineTypes engineType, string name, string param, Pilot pilot)
        {
            var car = new Car(name, null, weight, param, pilot, fuelTankVolume,
                CreateGasolineEngine(horsePower, engineType));

            OnCarCreation(car);

            return car;
        }
Exemple #2
0
 public CarModel(Car car)
 {
     if (car.OwnerPilot == null) PilotName = "no owner";
     else PilotName = car.OwnerPilot.Name;
     Id = car.Id;
     Name = car.Name;
     Weight = car.Weight;
     HorsePowers = car.Engine.HorsePowers;
     EngineType = (EngineTypes) car.Engine.NumberOfCylinders;
     TankVolume = car.FuelTank;
     AdditionalInfo = car.AdditionalInfo;
 }
Exemple #3
0
 public CarModel(Car car, IList<SelectListItem> pilots)
 {
     Name = car.Name;
     Weight = car.Weight;
     HorsePowers = car.Engine.HorsePowers;
     EngineType = (EngineTypes) car.Engine.NumberOfCylinders;
     TankVolume = car.FuelTank;
     AdditionalInfo = car.AdditionalInfo;
     if (car.OwnerPilot == null) PilotName = "no owner";
     else PilotName = car.OwnerPilot.Name;
     Pilots = pilots;
 }
Exemple #4
0
 public void FillCarTank(Car car)
 {
     car.FillTank(100);
     Console.WriteLine("Tank filled in {0} ", car.Name);
     Logger.AddMsgToLog("Tank Filled in " + car.Name);
 }
Exemple #5
0
 private void OnCarCreation(Car car)
 {
     _fillCarTank.FillCarTank(car);
 }
 public void UpdateCarInfo(Car oldCar, CarUpdateDto newCar)
 {
     using (var tran = _session.BeginTransaction())
     {
         try
         {
             var edited = oldCar.CarEdit(newCar);
             _session.SaveOrUpdate(edited);
             tran.Commit();
         }
         catch (Exception ex)
         {
             tran.Rollback();
             Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
             Logger.AddMsgToLog(ex.Message + "\n" + ex.StackTrace);
         }
     }
 }