Пример #1
0
 public CarClass(int carId, BodyworkClass bodywork, EngineClass engine, ClientClass currentClient, int kilometrage, int cost, int carStatus)
 {
     Bodywork      = bodywork ?? throw new ArgumentNullException("Bodywork can't be null!");
     Engine        = engine ?? throw new ArgumentNullException("Engine can't be null!");
     CurrentClient = currentClient;
     if (kilometrage < 0)
     {
         throw new Exception("Kilometrage can't be less than zero!");
     }
     Kilometrage = kilometrage;
     if (cost < 0)
     {
         throw new Exception("Cost can't be less than zero!");
     }
     Cost = cost;
     if (carId < 0)
     {
         throw new Exception("carId can't be less than zero!");
     }
     //if (CarIdAll.Contains(carId))
     //    throw new Exception("carId is not unique!");
     CarId = carId;
     CarIdAll.Add(carId);
     if (carStatus != 0 && carStatus != 1)
     {
         throw new Exception("carStatus can't be represented as bool!");
     }
     CarStatus = Convert.ToBoolean(carStatus);
 }
Пример #2
0
 public CarClass(BodyworkClass bodywork, EngineClass engine, int kilometrage, int carId) : this(bodywork, engine, null, kilometrage, ((int)(engine.MaxSpeed * 50 + engine.Quality * 10000 + bodywork.Quality * 10000)) / 2, carId)
 {
 }
Пример #3
0
 public CarClass(BodyworkClass bodywork, EngineClass engine, int kilometrage, int cost, int carId) : this(bodywork, engine, null, kilometrage, cost, carId)
 {
 }
Пример #4
0
 public CarClass(BodyworkClass bodywork, EngineClass engine, ClientClass currentClient, int kilometrage, int cost, int carId) : this(carId, bodywork, engine, currentClient, kilometrage, cost, 0)
 {
 }