public bool Check_Slot_Availability(int Vehicle_Type) { foreach (Slot Single_Slot in Slot_List) { if (Single_Slot.Return_Slot_Type() == Vehicle_Type && Single_Slot.Check_Slot_Availability() == true) { return(true); } } return(false); }
public Ticket Unpark_Vehicle(string Vehicle_Number, int Ticket_Id) { foreach (Ticket Search_Ticket in Ticket_List) { if (Search_Ticket.Ticket_No == Ticket_Id && Search_Ticket.Vehicle_No == Vehicle_Number) { foreach (Slot Single_Slot in Slot_List) { Single_Slot.UnPark_Vehicle(Search_Ticket.Assigned_Slot); } Set_OutTime_For_Ticket(Search_Ticket); return(Search_Ticket); } } return(null); }
public int Park_Vehicle(int Parking_Vehicle_Type, string Vehicle_Number) { int Assigned_Slot_Number = -1; int Ticket_Id; foreach (Slot Single_Slot in Slot_List) { if (Single_Slot.Return_Slot_Type() == Parking_Vehicle_Type && Single_Slot.Check_Slot_Availability() == true) { Assigned_Slot_Number = Single_Slot.Park_Vehicle(); break; } } DateTime Present_Time = DateTime.Now; Random Random_value = new Random(); Ticket_Id = Random_value.Next(1000, 9999); string InTime = Present_Time.ToString(); Ticket_List.Add(new Ticket(Ticket_Id, InTime, "\0", Assigned_Slot_Number, Vehicle_Number, Parking_Vehicle_Type)); return(Ticket_Id); }