예제 #1
0
        private static void InitializeNewCommand(ConsoleTable menu, IParkingService _parkingService)
        {
            Console.Write("Your option: ");
            var newOption = Console.ReadLine();

            SwithMenuItem(menu, newOption, _parkingService);
        }
예제 #2
0
        public ParkingController(ILogger <ParkingController> logger, IConfiguration config, IParkingService parkingService)
        {
            this.logger         = logger;
            this.parkingService = parkingService;

            this.logger.LogInformation("Initialized Parking Controller");
        }
예제 #3
0
        public MapViewModel(IParkingService parkingService, IGeoService geoService)
        {
            ParkingService = parkingService;
            GeoService     = geoService;

            GetLocationAddress();
        }
예제 #4
0
        private static bool MainMenu(IParkingService parkingService)
        {
            Console.Clear();
            Console.WriteLine("Welcome to our parking system!");
            Console.WriteLine("Please select one of our operations:");

            Console.WriteLine("1. Add new car");

            Console.WriteLine("2. Exist a car");

            Console.WriteLine("3. View all parked cars");

            switch (Console.ReadLine())
            {
            case "1":
                EnterCar(parkingService);
                return(true);

            case "2":
                ExitCar(parkingService);
                return(true);

            case "3":
                ShowAllCars(parkingService);
                return(true);

            default:
                return(false);
            }
        }
예제 #5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IParkingService parkingService)
        {
            app.UseCors(builder => {
                builder.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin();
            }).Build();
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "City of Grand Rapids Parking V1");
            });
            //app.UseHealthChecks("/health");
            //app.UseHttpsRedirection();
            app.UseMvc();

            parkingService.UpdateMap();
        }
예제 #6
0
 public ParkingsController(
     IParkingService parkingService,
     IMapper mapper)
 {
     _parkingService = parkingService;
     _mapper         = mapper;
 }
예제 #7
0
 public ParkingController(ILogger <ParkingController> logger,
                          IParkingService parkingService,
                          IPaymentService paymentService)
 {
     _logger         = logger;
     _parkingService = parkingService;
     _paymentService = paymentService;
 }
 public VehicleModels2Controller(Garage2_0MVCContext db, IParkingService parkingService,
                                 IParkingCapacityService parkingCapacityService, IMemberSelectService memberSelectService)
 {
     this.db                     = db;
     this.parkingService         = parkingService;
     this.memberSelectService    = memberSelectService;
     this.parkingCapacityService = parkingCapacityService;
 }
예제 #9
0
        public VehicleController(ILogger <VehicleController> logger, IVehicleService vehicleService, IParkingService parkingService, IMapper mapper)
        {
            this.logger         = logger;
            this.vehicleService = vehicleService;
            this.parkingService = parkingService;
            this.mapper         = mapper;

            this.logger.LogInformation("Initialized Vehicle Controller");
        }
예제 #10
0
        private static void ShowAllCars(IParkingService parkingService)
        {
            List <Car> allCars = parkingService.GetAllCars();
            var        json    = JsonConvert.SerializeObject(allCars, Formatting.Indented);

            Console.WriteLine(json);

            Console.ReadKey();
        }
예제 #11
0
 public HomeController(ICarService carService, IClientService clientService, IParkingTicketService parkingTicketService, IParkingPlaceService parkingPlaceService, IParkingService parkingService)
 {
     CarService           = carService;
     ClientService        = clientService;
     ParkingPlaceService  = parkingPlaceService;
     ParkingTicketService = parkingTicketService;
     ParkingService       = parkingService;
     list = ParkingService.GetAll();
 }
예제 #12
0
        private static void ExitCar(IParkingService parkingService)
        {
            // exit car
            Console.WriteLine("Please enter your car register no:");
            string regNo = Console.ReadLine();
            var    rsp   = parkingService.ExitCar(regNo);

            Console.WriteLine(rsp.Message);
            Console.ReadKey();
        }
예제 #13
0
 public PaymentService(ILogger <PaymentService> logger,
                       IRepository <Settings> settings,
                       IParkingService parkingService,
                       IRepository <ParkingPlace> parkingPlaces)
 {
     _logger         = logger;
     _settings       = settings;
     _parkingService = parkingService;
     _parkingPlaces  = parkingPlaces;
 }
예제 #14
0
        public CustomerTest()
        {
            var builder = new DbContextOptionsBuilder <InvoicingContext>();

            builder.UseInMemoryDatabase($"database{Guid.NewGuid()}");
            _invoicingContext = new InvoicingContext(builder.Options);
            _customerService  = new CustomerService(_invoicingContext);
            _parkingService   = new ParkingService(_invoicingContext);
            _parkedService    = new ParkedService(_invoicingContext);
        }
 public ParkingViewModel(IParkingService parkingService,
     IGpsProvider gpsProvider)
 {
     this._parkingService = parkingService;
     this._gpsProvider = gpsProvider;
 }
예제 #16
0
 public ParkingsController(IParkingService locationService_)
 {
     parkingService = locationService_;
 }
예제 #17
0
 public ParkingController(IParkingService parking)
 {
     _parking = parking;
 }
 public TransactionsController(IParkingService parking)
 {
     _parking = parking;
 }
예제 #19
0
 public ParkingController(IParkingService parkingService)
 {
     _parkingService = parkingService;
 }
예제 #20
0
 public VehiclesController(IParkingService parking)
 {
     _parking = parking;
 }
예제 #21
0
 public HomeController(IParkingService parkingService, IMapper mapper)
 {
     this._parkingService = parkingService;
     this._mapper         = mapper;
 }
예제 #22
0
 public DetailViewModel(IParkingService parkingDataService)
 {
     this._parkingDataService = parkingDataService;
 }
예제 #23
0
 public ParkingsViewModel(IParkingService parkingService, IMvxNavigationService navigationService)
 {
     this._navigationService = navigationService;
     this._parkingService    = parkingService;
     loadData();
 }
예제 #24
0
 public VehiclesController(IParkingService service)
 {
     Service = service;
 }
예제 #25
0
        static void Main(string[] args)
        {
            provider = new ParkingServiceProvider();
            HelperMethods.PrintWelcomeMessage();

            if (args.Length != 0)
            {
                //Input from a file
                string line;
                try {
                    System.IO.StreamReader file = new StreamReader(args[0]);
                    while ((line = file.ReadLine()) != null)
                    {
                        if (provider.Validate(line))
                        {
                            try {
                                provider.Execute(line);
                            } catch (ParkingException e) {
                                Console.WriteLine(e.Message);
                            }
                        }
                    }
                    file.Close();
                    Console.Read();
                } catch (System.Exception e) {
                    Console.WriteLine(e.Message);
                }

                return;
            }
            else
            {
                //Input Interactively
                HelperMethods.PrintCommands();
                while (true)
                {
                    try {
                        var input = Console.ReadLine();
                        if (input.ToLower().Equals("exit"))
                        {
                            break;
                        }
                        else
                        {
                            if (provider.Validate(input))
                            {
                                try {
                                    provider.Execute(input);
                                } catch (ParkingException e) {
                                    Console.WriteLine(e.Message);
                                }
                            }
                            else
                            {
                                HelperMethods.PrintCommands();
                            }
                        }
                    } catch (System.Exception e) {
                        Console.WriteLine(e.Message);
                    }
                }
            }
        }
예제 #26
0
        private static void SwithMenuItem(ConsoleTable menu, string selectedMenuOption, IParkingService _parkingService)
        {
            string registrationNumber;

            switch (selectedMenuOption)
            {
            case string value when value == Constants.MenuItems.AvaiableParkingSpots.ToString():
                _parkingService.GetNumberOfFreeParkingSpots();
                InitializeNewCommand(menu, _parkingService);
                break;

            case string value when value == Constants.MenuItems.DisplayCosts.ToString():
                _parkingService.DisplayCosts();
                InitializeNewCommand(menu, _parkingService);
                break;

            case string value when value == Constants.MenuItems.EnterTheParking.ToString():
                registrationNumber = GetUserConsoleInput("Please enter the car registration number. Please use the format BV10ABC: ");
                _parkingService.AddNewParkingEntry(registrationNumber);
                InitializeNewCommand(menu, _parkingService);
                break;

            case string value when value == Constants.MenuItems.GetParkedCars.ToString():
                _parkingService.GetParkedCars();
                InitializeNewCommand(menu, _parkingService);
                break;

            case string value when value == Constants.MenuItems.ExitTheParkingAndPay.ToString():
                registrationNumber = GetUserConsoleInput("Please enter the car registration number: ");
                _parkingService.ExitTheParking(registrationNumber);
                InitializeNewCommand(menu, _parkingService);
                break;

            case string value when value == Constants.MenuItems.ExitTheApp.ToString():
                Console.WriteLine("Thank you for visiting us!");
                break;

            default:
                Console.WriteLine("Looks like your selection is not valid. Please select one of the avaiable menu options!\n");
                InitializeNewCommand(menu, _parkingService);
                break;
            }
        }
예제 #27
0
 public TypeSelectService(Garage2_0MVCContext db, IParkingService parkingService, IParkingCapacityService parkingCapacityService)
 {
     this.db                     = db;
     this.parkingService         = parkingService;
     this.parkingCapacityService = parkingCapacityService;
 }
예제 #28
0
 public ParkingsController(IParkingService parkingService)
 {
     this.parkingService = parkingService;
 }
예제 #29
0
 public ParkingGarage(IParkingService parkingService)
 {
     _parkingService = parkingService;
 }
예제 #30
0
 public ParkingController(IParkingViewModelService parkingViewModelService, IParkingService parkingService, ILogger <HomeController> logger)
 {
     _logger = logger;
     _parkingViewModelService = parkingViewModelService;
     _parkingService          = parkingService;
 }
예제 #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OwnerController"/> class.
 /// </summary>
 /// <param name="parkingService">Parking service.</param>
 public OwnerController(IParkingService parkingService)
 {
     this.parkingService = parkingService;
 }
 public TransactionsController(IParkingService service)
 {
     Service = service;
 }