Пример #1
0
 protected Vehicles(int id, string registrationNumber, string make, double odometer, double costKM, VehicleTypes type, VehicleStatuses status)
 {
     Id = id;
     RegistrationNumber = registrationNumber;
     Make     = make;
     Odometer = odometer;
     CostKM   = costKM;
     Type     = type;
     Status   = status;
 }
 public Vehicle(string name, string model, VehicleStatuses status, int price, string plate)
 {
     Name           = name;
     Model          = model;
     Status         = status;
     Price          = price;
     SellPrice      = price / 2;
     InsurancePrice = price / 4;
     Plate          = plate;
 }
        //constructor
        public Vehicle(int ID, string make, string registrationNum, double odometer, double costkm, VehicleStatuses status, VehicleTypes type)

        {
            Id   = ID;
            Make = make;
            RegistrationNumber = registrationNum;
            Odometer           = odometer;
            CostKm             = costkm;
            Status             = status;
            Type = type;
        }
Пример #4
0
 public IEnumerable <IVehicle> GetVehicles(VehicleStatuses status)
 {
     if (status == 0)
     {
         return(_vehicles);
     }
     else
     {
         return(_vehicles.FindAll(v => v.Status.Equals(status)));
     }
 }
Пример #5
0
 public Car(int id, string RegistrationNumber, string make, int odometer, double costKM, VehicleTypes types, VehicleStatuses status)
     : base(id, RegistrationNumber, make, odometer, costKM, types, status)
 {
 }
Пример #6
0
 public Motocycle(int id, string registrationNumber, string make, int odometer, double costKM, VehicleTypes type, VehicleStatuses status)
     : base(id, registrationNumber, make, odometer, costKM, type, status)
 {
 }
Пример #7
0
 public IEnumerable <IVehicle> GetVehicles(VehicleStatuses status = default)
 {
     return(_db.GetVehicles(status));
 }
Пример #8
0
 //constructor
 public Car(int ID, string make, string registrationNum, double odometer, double costkm, VehicleStatuses status, VehicleTypes type)
     : base(ID, make, registrationNum, odometer, costkm, status, type)
 {
 }
Пример #9
0
 public IEnumerable <IVehicle> GetVehicles(VehicleStatuses status = 0)
 {
     return(_vehicles);
 }
 public Motorcycle(int ID, string make, string registrationNum, double odometer, double costkm, VehicleStatuses status)
     : base(ID, make, registrationNum, odometer, costkm, status, VehicleTypes.Motorcycle)
 {
 }
 public void AddVehicle(string make, string registationNumber, double odometer, double costKm, VehicleStatuses status, VehicleTypes type)
 {
     _db.AddVehicle(new Car(_db.NextVehicle, registationNumber, make, odometer, costKm, type, status));
 }
        public void AddVehicle(string make, string registrationNumber, double odometer, double costkm, VehicleStatuses status, VehicleTypes type)
        {
            IVehicle vehicle = new Car(_db.NextVehicleId, make, registrationNumber, odometer, costkm, status, type);

            _db.AddVehicle(vehicle);

            try
            {
                if (registrationNumber.Equals(string.Empty) || make == default)
                {
                    throw new ArgumentException("The Registration Number cannot be empty.");
                }
                else if (make.Equals(string.Empty) || make == default)
                {
                    throw new ArgumentException("The make name cannot be empty.");
                }
                else if (odometer < 1)
                {
                    throw new ArgumentException("The odometer must be greater than 0.");
                }
                else if (costkm < 0)
                {
                    throw new ArgumentException("he costKm must be greater than 0.");
                }
            }
            catch (Exception)
            {
                throw;
            }
        }