示例#1
0
        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!");
        }
示例#2
0
        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");
        }
示例#3
0
        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);
        }
示例#4
0
 public static void ReturnParkingSpaces()
 {
     Console.WriteLine("Free plases:" + (Settings.GetSettingsInstance()._parkingSpace - Parking.GetParkingInstance().ReturnCarsCount()).ToString() + "");
 }
示例#5
0
 public static void ReturnAllMoney()
 {
     Console.WriteLine(Parking.GetParkingInstance()._allMoney.ToString());
 }
示例#6
0
        public IEnumerable <Transaction> GetLastMinuteTransactions()
        {
            var lastMinuteTrans = Parking.GetParkingInstance().allTransaction.Where <Transaction>(t => DateTime.Now == DateTime.Now.AddMinutes(-1));

            return(lastMinuteTrans);
        }