public SportCar CreateNewSportCar(double fuelTankVolume, double weight, int horsePower, EngineTypes engineType, string name, string param, Pilot pilot) { var sportCar = new SportCar(name, null, weight, param, pilot, fuelTankVolume, CreateGasolineEngine(horsePower, engineType)); OnCarCreation(sportCar); return sportCar; }
public PilotUpdateDto(Pilot pilot) { if (pilot == null) return; Id = pilot.Id; Name = pilot.Name; Debutdate = pilot.DebutDate.ToString(); Age = pilot.Age; Team = pilot.Team; }
public PilotModel(Pilot pilot) { Id = pilot.Id; Name = pilot.Name; Age = pilot.Age; Team = pilot.Team; DebutDate = pilot.DebutDate; ExperienceTime = Convert.ToInt32((DateTime.Now - DebutDate).TotalDays); CarCount = pilot.CarVehicles.Count; }
public Car(string name, double? mileage, double weight, string additionalInfo, Pilot pilot, double fuelTank, GasolineEngine engine) : base(name, mileage, weight, additionalInfo, pilot) { if (fuelTank < 0) throw new ArgumentException("fuel tank volume can't be below or equal zero"); FuelTank = fuelTank; Engine = engine; FuelType = new Petrol(); AccelerationSpeed = GetAccelerationSpeed(); }
public ElectroCar(string name, double? mileage, ElectroEngine electroEngine, double weight, string additionalInfo, Pilot pilot, int chargeLevel) : base(name, mileage, weight, additionalInfo, pilot) { if (chargeLevel < 0 || chargeLevel > 100) throw new ArgumentException("Charge lvl can't be below zero or more than 100"); ChargeLevel = chargeLevel; Engine = electroEngine; AccelerationSpeed = Engine.HorsePowers/Weight*100; }
public Vehicle(string name, double? mileage, double weight, string additionalInfo, Pilot pilot) { if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("please name the Vehicle!"); if (weight <= 0) throw new ArgumentException("weight can't be below or equal zero"); if (additionalInfo == null) additionalInfo = "No additional specs"; Name = name; Mileage = mileage; Weight = weight; AdditionalInfo = additionalInfo; OwnerPilot = pilot; }
public void AddCar(Pilot pilot, Car car) { using (var tran = _session.BeginTransaction()) { try { pilot = _session.Load<Pilot>(pilot.Id); pilot.AddCar(car); tran.Commit(); } catch (Exception ex) { Console.WriteLine(ex.Message + "\n" + ex.StackTrace); Logger.AddMsgToLog(ex.Message + "\n" + ex.StackTrace); tran.Rollback(); } } }
public void AddPilot(Pilot pilot) { using (var tran = _session.BeginTransaction()) { try { Console.WriteLine("trying to add pilot in Database..."); _session.Save(pilot); tran.Commit(); Console.WriteLine("Succesfully!"); Logger.AddMsgToLog("Succesfully! commited a pilot in database"); } catch (Exception ex) { Console.WriteLine(ex.Message + "\n" + ex.StackTrace); Logger.AddMsgToLog(ex.Message + "\n" + ex.StackTrace); tran.Rollback(); } } }
public void UpdatePilot(Pilot oldPilot, PilotUpdateDto pilotUpdateDto) { using (var tran = _session.BeginTransaction()) { oldPilot.PilotEdit(pilotUpdateDto); tran.Commit(); } }
public SportCar(string name, double? mileage, double weight, string additionalInfo, Pilot pilot, double fuelTank, GasolineEngine engine) : base(name, mileage, weight, additionalInfo, pilot, fuelTank, engine) { DownForcePressure = 0; }
public BoxesProxy(Pilot pilot, Boxes boxes) { _realBoxes = boxes; _realPilot = pilot; }
public ElectroCar CreateNewElectroCar(string name, double weight, int hpValue, Pilot pilot) { var electro = new ElectroCar(name, null, CreateElectroEngine(hpValue), weight, null, pilot, 0); ChargeCar(electro); return electro; }
public static Pilot CreateNewPilot(string name, string debutDateTime, int age, string teamName) { var pilot = new Pilot(name, debutDateTime, age, teamName); return pilot; }
public virtual Pilot PilotEdit(Pilot oldPilot, Pilot newPilot) { var editedPilot = oldPilot; editedPilot.Name = newPilot.Name; editedPilot.Age = newPilot.Age; editedPilot.DebutDate = newPilot.DebutDate; return editedPilot; }