public static void RemoveCar() { Console.WriteLine("Enter the car's id:"); int id = int.Parse(Console.ReadLine()); if (Parking.GetParkingInstance().ReturnCarBalance(id) < 0) { Console.WriteLine("You do not have enough money on the account!"); } Parking.GetParkingInstance().RemoveCar(id); Console.WriteLine("Your car removed!"); }
public void WriteTransactionTimer(object obj) { var lastMinuteTrans = Parking.GetParkingInstance().GetLastMinuteTransactions(); FileInfo fi = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "\\Transaction.log"); if (!fi.Exists) { fi.Create(); } decimal sum = 0; foreach (var trn in lastMinuteTrans) { sum += trn._debit; } string msg = "Datetime: " + DateTime.Now.ToShortDateString() + " => SUM: " + sum.ToString() + ""; System.IO.File.AppendAllText(fi.FullName, msg + "\r\n"); }
private static void AddCar() { Console.WriteLine("Enter the car's id:"); int currIdCar = Int32.Parse(Console.ReadLine()); Console.WriteLine("Choose the car's type:"); for (int i = 1; i <= 4; i++) { Console.WriteLine(i.ToString() + ") " + Settings.GetSettingsInstance().ReturnTypeCar(i)); } Settings.carsType currTypeCar; switch (int.Parse(Console.ReadLine())) { case 1: currTypeCar = Settings.carsType.passenger; break; case 2: currTypeCar = Settings.carsType.truck; break; case 3: currTypeCar = Settings.carsType.bus; break; case 4: currTypeCar = Settings.carsType.motorcycle; break; default: Console.WriteLine("Please choose the correct car's type!"); currTypeCar = Settings.carsType.passenger; break; } Console.WriteLine("Enter car's balance:"); decimal currBillCar = decimal.Parse(Console.ReadLine()); Car c = new Car(currIdCar, currTypeCar, currBillCar); Parking.GetParkingInstance().AddCar(c); }
public static void ReturnParkingSpaces() { Console.WriteLine("Free plases:" + (Settings.GetSettingsInstance()._parkingSpace - Parking.GetParkingInstance().ReturnCarsCount()).ToString() + ""); }
public static void ReturnAllMoney() { Console.WriteLine(Parking.GetParkingInstance()._allMoney.ToString()); }
public IEnumerable <Transaction> GetLastMinuteTransactions() { var lastMinuteTrans = Parking.GetParkingInstance().allTransaction.Where <Transaction>(t => DateTime.Now == DateTime.Now.AddMinutes(-1)); return(lastMinuteTrans); }