static void Main() { ClientContext clientContext = ParkingLot_SharePoint.Services.SharePointService.CommonService.GetonlineContext(); UserService userService = new UserService(clientContext); while (true) { try { UserService.CurrentUser = userService.Login(Login()); if (UserService.CurrentUser != null) { if (UserService.CurrentUser.FirstTimeLogin) { userService.FirstTimeLogin(UserService.CurrentUser.Id, RePassword()); } if (UserService.CurrentUser.Type == Convert.ToString(Role.Admin)) { ParkingLotService parkingLotService = new ParkingLotService(clientContext); while (true) { Console.Clear(); Console.WriteLine("1. Add new Member\n2. Add new parking lots\n3. Add other parking in lot\n4. Modify parking slot\n5. Logout\n6. Exit"); Int32.TryParse(Console.ReadLine(), out int option); switch ((ManagerMenu)option) { case ManagerMenu. userService.AddNewUser(AddNewUser(userService, parkingLotService)); break; case 2: if (parkingLotService.AddNewParkingLot(AddNewParkingLots())) { var firstSetupDetails = SetupParkingConfiguration(parkingLotService); if (firstSetupDetails != null) { parkingLotService.SetupParkingLot(firstSetupDetails); } break; } break; case 3: var setupDetails = SetupParkingConfiguration(parkingLotService); if (setupDetails != null) { parkingLotService.SetupParkingLot(setupDetails); } break; case 4: var data = ModifyConfiguration(parkingLotService); if (data != null) { parkingLotService.ModifyParkingLotCongiguration(data); } break; case 5: break; case 6: Environment.Exit(0); break; default: break; } if (option == 5) { break; } Console.ReadKey(); } } else if (UserService.CurrentUser.Type == Convert.ToString(Role.Manager)) { ParkingService parkingService = new ParkingService(clientContext); while (true) { Console.Clear(); Console.Write("1. Parking new vehical\n2. Release vehical\n3. View all parked vehical\n4. Logout\n5. Exit"); Int32.TryParse(Console.ReadLine(), out int choice); switch (choice) { case 1: var parking = ParkVehical(parkingService); if (parking != null) { parkingService.ParkVehical(parking); } break; case 2: int id = ReleaseVehical(parkingService); if (id == 0) { Console.WriteLine("This vehical is not parked in your parking"); } else if (id == -1) { Console.WriteLine("This vehical is releases previously"); } else { var fare = parkingService.ReleaseVehical(id); Console.WriteLine("Total fare is " + fare + "RS" + "\n" + "Amount has been collected by " + UserService.CurrentUser.Name); } break; case 3: AllParkedVehicle(parkingService.AllParkedVehical()); break; case 4: break; case 5: Environment.Exit(0); break; default: break; } if (choice == 4) { break; } Console.ReadKey(); } } else { Console.WriteLine("Please contact to your admin"); } } else { Console.WriteLine("Please enter correct username or password"); } } catch (System.Net.WebException) { Console.WriteLine("Your internet connection is not connected please retry"); } catch (ServerException) { Console.WriteLine("Server error"); } } }