コード例 #1
0
ファイル: ParkingLot.cs プロジェクト: sagunji/CSharp-Practice
        public bool isCarRegistered(string numberPlate)
        {
            Car tempCar = RegisteredCar.Find(rcar =>
                                             rcar.NumberPlate.ToLower() == numberPlate.ToLower());

            return(tempCar != null);
        }
コード例 #2
0
ファイル: ParkingLot.cs プロジェクト: sagunji/CSharp-Practice
        public void CheckCarIn(string numberPlate)
        {
            if (!isCarRegistered(numberPlate))
            {
                Console.WriteLine("The car is not registered yet. You cannot check unregistered car!!");
                return;
            }
            Car foundCar = RegisteredCar.Find(car => car.NumberPlate.ToLower() == numberPlate.ToLower());

            if (isCarCheckedIn(foundCar.ID))
            {
                Console.WriteLine("The car is already checked in!!");
                return;
            }
            CheckedInCar.Add(foundCar.ID);
            Console.WriteLine("The car of number plate {0} has been registered.", numberPlate);
        }
コード例 #3
0
ファイル: ParkingLot.cs プロジェクト: sagunji/CSharp-Practice
        public void checkOutCar(string numberPlate)
        {
            if (!isCarRegistered(numberPlate))
            {
                Console.WriteLine("The car is not registered yet. You cannot check out unregistered car!!");
                return;
            }
            Car foundCar = RegisteredCar.Find(car => car.NumberPlate.ToLower() == numberPlate.ToLower());

            if (!isCarCheckedIn(foundCar.ID))
            {
                Console.WriteLine("The car is not checked in!!");
                return;
            }
            CheckedInCar.Remove(foundCar.ID);
            Console.WriteLine("The car of number plate {0} has checked out!!", numberPlate);
        }