public static void InitializeRents() { foreach (var i in SQLRents.GetInstance().GetList()) { Rent.Add(i); } }
static void Main() { //ClientClass client = ClientService.AddNewClient(new ClientClass(487, 0, "Danik", "+1234567")); Session.InitializeCars(); ClientService.InitializeClients(); RentService.InitializeRents(); TransactionService.InitializeTransactions(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); List <CarClass> cars = AutoParkService.AutoPark; /*foreach (var i in cars) * { * Console.WriteLine($"bodyworkSN = {i.Bodywork.SerialNumber}, engineSN = {i.Engine.SerialNumber}" + * $", kilometrage = {i.Kilometrage}, cost = {i.Cost}" + * $", carStatus = {i.CarStatus}"); * }*/ Console.WriteLine(SQLEngines.GetInstance().Search("24887")); Console.WriteLine(SQLBodyworks.GetInstance().Search("11414")); Console.WriteLine(SQLRents.GetInstance().Search("1")); //Console.WriteLine(SQLCars.GetInstance().Search("5")); //Application.Run(new WorkForm(client)); //Console.WriteLine(SQLClients.GetInstance().Search("Danik")); Application.Run(new LoginForm()); }
public static void RemoveRent(RentClass rent) { rent.CurrentCar.CarStatus = false; rent.CurrentCar.CurrentClient = null; SQLCars.GetInstance().Update(rent.CurrentCar); SQLRents.GetInstance().Remove(rent.RentId.ToString()); Rent.Remove(rent); }
public static void AddNewRent(RentClass rentToAdd) { if (rentToAdd != null) { rentToAdd.CurrentCar.CarStatus = true; rentToAdd.CurrentCar.CurrentClient = rentToAdd.CurrentClient; SQLCars.GetInstance().Update(rentToAdd.CurrentCar); SQLRents.GetInstance().Create(rentToAdd); Rent.Add(rentToAdd); TransactionService.NewTransaction(rentToAdd.CurrentCar.Cost, rentToAdd.CurrentClient); } else { throw new ArgumentNullException("rentToAdd can't be null!"); } }