public double MyInvoic(int CustID, int CarID) { ADP_ParkingEntities db = new ADP_ParkingEntities(); Customer customer = db.Customers.Find(CustID); Car car = db.Cars.Find(CarID); RegisteredCar registeredCar = db.RegisteredCars.FirstOrDefault(r => r.CarID == CarID && r.CustomerID == CustID); bool isRegistered = false; if (registeredCar != null) { isRegistered = true; } if (customer != null && car != null) { var invoke = .0; if (car.LeavingTime != null) { invoke = new Bill(car.ArrivalTime.Value, car.LeavingTime.Value, customer.Vip == 1, isRegistered).InvoiceValue; } else { invoke = new Bill(car.ArrivalTime.Value, customer.Vip == 1, isRegistered).InvoiceValue; } return(invoke); // return (new Bill(car.ArrivalTime.Value, car.LeavingTime.Value, customer.Vip ==1, isRegistered).InvoiceValue); } //return (new Bill(car.ArrivalTime.Value, car.LeavingTime.Value, false, false).InvoiceValue); return(0); }
public bool isCarRegistered(string numberPlate) { Car tempCar = RegisteredCar.Find(rcar => rcar.NumberPlate.ToLower() == numberPlate.ToLower()); return(tempCar != null); }
public void RegisterCar(List <Car> cars) { foreach (var item in cars) { if (!isCarRegistered(item.NumberPlate)) { RegisteredCar.Add(item); } } }
public void RegisterCar(Car car) { if (isCarRegistered(car.NumberPlate)) { Console.WriteLine("The car is already registered!!"); return; } RegisteredCar.Add(car); Console.WriteLine($"New Car Id: {car.ID}"); }
public List <CarStatus> SearchBy(string key) { List <Car> foundCars = RegisteredCar.FindAll(rcar => rcar.NumberPlate.ToLower() == key.ToLower()); List <CarStatus> carStatus = new List <CarStatus>(); CarStatus cs; foreach (var car in foundCars) { cs = new CarStatus(); cs.car = car; cs.checkInStatus = isCarCheckedIn(car.ID); carStatus.Add(cs); } return(carStatus); }
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); }
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); }
public List <Car> getAllCheckedInCars() { return(RegisteredCar.FindAll(rcar => CheckedInCar.Contains(rcar.ID))); }