Ejemplo n.º 1
0
        public AgentController(IMemberService memberService, IAgentService agentService, IContactService contactService, IMedallionService medallionService,
            IVehicleService vehicleService, IMeterManufacturerService meterManufacturerService, IStockholderService stockholderService, IAgentVehicleService agentVehicleService, IStandardDuesService standardDueService,
            IVehicleMakeService vehicleMakeService, IModelYearInsuranceService modelYearInsuranceService, IVehicleModelService vehicleModelService,
            IInsuranceDepositAgentService insuranceDepositService, IAutoLoanSetupAgentService autoLoanSetupService, IAccountReceivableAgentService accountReceivableService,
            ISavingDepositAgentService savingDepositService)
        {
            this.memberService = memberService;
            this.agentService = agentService;
            this.agentVehicleService = agentVehicleService;
            this.contactService = contactService;
            this.stockholderService = stockholderService;
            this.meterManufacturerService = meterManufacturerService;
            this.medallionService = medallionService;
            this.vehicleService = vehicleService;
            this.standardDueService = standardDueService;

            this._vehicleMakeService = vehicleMakeService;
            this._modelYearInsuranceService = modelYearInsuranceService;
            this._vehicleModelService = vehicleModelService;

            this.insuranceDepositService = insuranceDepositService;
            this.accountReceivableService = accountReceivableService;
            this.autoLoanSetupService = autoLoanSetupService;
            this.savingDepositService = savingDepositService;
        }
Ejemplo n.º 2
0
 public Drive(IVehicleService service, Vehicle car)
 {
     Start = DateTimeOffset.UtcNow;
     Car = car;
     Current = new Leg(car, DrivePath);
     this.service = service;
 }
Ejemplo n.º 3
0
 public VehicleController(ICustomerService customerService, IDistributorService distributorService, IDealerService dealerService, IVehicleService<Vehicle> vehicleService)
 {
     this._customerService = customerService;
     this._distributorService = distributorService;
     this._dealerService = dealerService;
     this._vehicleService = vehicleService;
 }
        public void Setup()
        {
            var sampleDB = JsonConvert.DeserializeObject<Vehicles>(Sampledata.VehiclesJson);

            _vehicleService = new JsonVehicleService(sampleDB);
            //_vehicleService = new JsonVehicleService(Sampledata.VehiclesJson);
            //The JsonVehicleService can NOT have any 'if', 'for', 'foreach', or 'while' statements
            //you must use 'where', 'select', 'selectmany', 'union' with lambas
        }
Ejemplo n.º 5
0
        public MemberController(IMemberService memberService, IAgentService agentService, IContactService contactService, IMedallionService medallionService,
            IVehicleService vehicleService, IMeterManufacturerService meterManufacturerService, IStockholderService stockholderService, IAgentVehicleService agentVehicleService, IStandardDuesService standardDueService,
            IVehicleMakeService vehicleMakeService, IModelYearInsuranceService modelYearInsuranceService, IVehicleModelService vehicleModelService, IUniversalAgentRecordService _universalAgentRecordService,
            IRTAService rtaService, IMobilityService mobilityService)
        {
            this.memberService = memberService;
            this.agentService = agentService;
            this.agentVehicleService = agentVehicleService;
            this.contactService = contactService;
            this.stockholderService = stockholderService;
            this.meterManufacturerService = meterManufacturerService;
            this.medallionService = medallionService;
            this.vehicleService = vehicleService;
            this.standardDueService = standardDueService;

            this._vehicleMakeService = vehicleMakeService;
            this._modelYearInsuranceService = modelYearInsuranceService;
            this._vehicleModelService = vehicleModelService;
            this._universalAgentRecordService = _universalAgentRecordService;
            this.rtaService = rtaService;
            this.mobilityService = mobilityService;
        }
Ejemplo n.º 6
0
 public HomeController(ILogger <HomeController> logger, IVehicleService vehicleService)
 {
     _logger         = logger;
     _vehicleService = vehicleService;
 }
Ejemplo n.º 7
0
 public GalleryController(IDealerService dealerService, IVehicleService<Vehicle> vehicleService,IDeviceService<Device> deviceService)
 {
     this.dealerService = dealerService;
     this.vehicleServce = vehicleService;
     this.deviceService = deviceService;
 }
Ejemplo n.º 8
0
 public AccountLogics(IAuthService authService, IVehicleService vehicleService)
 {
     _authService = authService;
     _vehicleService = vehicleService;
 }
 public BatchTransportController(IBatchTransportService batchTransportService, IVehicleService vehicleService, IUserService _userService, IBatchService batchService)
 {
     this.batchTransportService = batchTransportService;
     this.vehicleService        = vehicleService;
     this.userService           = _userService;
     this.batchService          = batchService;
 }
Ejemplo n.º 10
0
 public PushMessageTimedHostedService(ILogger <PushMessageTimedHostedService> logger, IVehicleService vehicleService)
 {
     _logger         = logger;
     _vehicleService = vehicleService;
 }
Ejemplo n.º 11
0
 public VehicleController(IVehicleService service)
 {
     Service = service;
 }
 public OverviewController(IRentService rentService, IVehicleService vehicleService, ICustomerService customerService)
 {
     _rentService     = rentService;
     _vehicleService  = vehicleService;
     _customerService = customerService;
 }
Ejemplo n.º 13
0
 public VehicleController(IVehicleService vehicleService, ILogger <VehicleController> logger)
 {
     this.vehicleService = vehicleService;
     this.logger         = logger;
 }
Ejemplo n.º 14
0
 public ControllersLogics(IVehicleService vehicleService)
 {
     _vehicleService = vehicleService;
 }
Ejemplo n.º 15
0
 public IndexModel(IVehicleService vehicleService)
 {
     _vehicleService = vehicleService;
 }
Ejemplo n.º 16
0
        public SimulationsModule(ISimulationService service, IUserService userService, IClusterService clusterService, IMapService mapService, IVehicleService vehicleService) : base("simulations")
        {
            this.RequiresAuthentication();

            Get("/", x =>
            {
                Debug.Log($"Listing simulations");
                try
                {
                    int page = Request.Query["page"];
                    // TODO: Items per page should be read from personal user settings.
                    //       This value should be independent for each module: maps, vehicles and simulation.
                    //       But for now 5 is just an arbitrary value to ensure that we don't try and Page a count of 0
                    int count = Request.Query["count"] > 0 ? Request.Query["count"] : Config.DefaultPageSize;
                    return(service.List(page, count, this.Context.CurrentUser.Identity.Name).Select(sim =>
                    {
                        sim.Status = service.GetActualStatus(sim, false);
                        return SimulationResponse.Create(sim);
                    }).ToArray());
                }
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    return(Response.AsJson(new { error = $"Failed to list simulations: {ex.Message}" }, HttpStatusCode.InternalServerError));
                }
            });

            Get("/{id:long}", x =>
            {
                long id = x.id;
                Debug.Log($"Getting simulation with id {id}");
                try
                {
                    var simulation = service.Get(id, this.Context.CurrentUser.Identity.Name);
                    if (simulation.TimeOfDay.HasValue)
                    {
                        simulation.TimeOfDay = DateTime.SpecifyKind(simulation.TimeOfDay.Value, DateTimeKind.Utc);
                    }
                    simulation.Status = service.GetActualStatus(simulation, false);
                    return(SimulationResponse.Create(simulation));
                }
                catch (IndexOutOfRangeException)
                {
                    Debug.Log($"Simulation with id {id} does not exist");
                    return(Response.AsJson(new { error = $"Simulation with id {id} does not exist" }, HttpStatusCode.NotFound));
                }
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    return(Response.AsJson(new { error = $"Failed to get simulation with id {id}: {ex.Message}" }, HttpStatusCode.InternalServerError));
                }
            });

            Post("/", x =>
            {
                Debug.Log($"Adding new simulation");
                try
                {
                    var req = this.BindAndValidate <SimulationRequest>();
                    if (!ModelValidationResult.IsValid)
                    {
                        var message = ModelValidationResult.Errors.First().Value.First().ErrorMessage;
                        Debug.Log($"Wrong request: {message}");
                        return(Response.AsJson(new { error = $"Failed to add simulation: {message}" }, HttpStatusCode.BadRequest));
                    }

                    var simulation = req.ToModel(this.Context.CurrentUser.Identity.Name);

                    simulation.Status = service.GetActualStatus(simulation, true);
                    if (simulation.Status != "Valid")
                    {
                        throw new Exception($"Simulation is invalid");
                    }

                    simulation.Status = service.GetActualStatus(simulation, false);
                    long id           = service.Add(simulation);
                    Debug.Log($"Simulation added with id {id}");
                    simulation.Id = id;

                    SIM.LogWeb(SIM.Web.SimulationAddName, simulation.Name);
                    try
                    {
                        SIM.LogWeb(SIM.Web.SimulationAddMapName, mapService.Get(simulation.Map.Value, this.Context.CurrentUser.Identity.Name).Name);

                        if (simulation.Vehicles != null)
                        {
                            foreach (var vehicle in simulation.Vehicles)
                            {
                                var vehicleModel = vehicleService.Get(vehicle.Vehicle, this.Context.CurrentUser.Identity.Name);
                                SIM.LogWeb(SIM.Web.SimulationAddVehicleName, vehicleModel.Name);
                                SIM.LogWeb(SIM.Web.SimulationAddBridgeType, vehicleModel.BridgeType);
                            }
                        }

                        SIM.LogWeb(SIM.Web.SimulationAddAPIOnly, simulation.ApiOnly.ToString());
                        SIM.LogWeb(SIM.Web.SimulationAddInteractiveMode, simulation.Interactive.ToString());
                        SIM.LogWeb(SIM.Web.SimulationAddHeadlessMode, simulation.Headless.ToString());
                        try
                        {
                            SIM.LogWeb(SIM.Web.SimulationAddClusterName, clusterService.Get(simulation.Cluster.Value, this.Context.CurrentUser.Identity.Name).Name);
                        }
                        catch { };
                        SIM.LogWeb(SIM.Web.SimulationAddUsePredefinedSeed, simulation.Seed.ToString());
                        SIM.LogWeb(SIM.Web.SimulationAddEnableNPC, simulation.UseTraffic.ToString());
                        SIM.LogWeb(SIM.Web.SimulationAddRandomPedestrians, simulation.UsePedestrians.ToString());
                        SIM.LogWeb(SIM.Web.SimulationAddTimeOfDay, simulation.TimeOfDay.ToString());
                        SIM.LogWeb(SIM.Web.SimulationAddRain, simulation.Rain.ToString());
                        SIM.LogWeb(SIM.Web.SimulationAddWetness, simulation.Wetness.ToString());
                        SIM.LogWeb(SIM.Web.SimulationAddFog, simulation.Fog.ToString());
                        SIM.LogWeb(SIM.Web.SimulationAddCloudiness, simulation.Cloudiness.ToString());
                    }
                    catch { };

                    return(SimulationResponse.Create(simulation));
                }
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    return(Response.AsJson(new { error = $"Failed to add simulation: {ex.Message}" }, HttpStatusCode.InternalServerError));
                }
            });

            Put("/{id:long}", x =>
            {
                long id = x.id;
                Debug.Log($"Updating simulation with id {id}");
                try
                {
                    var req = this.BindAndValidate <SimulationRequest>();
                    if (!ModelValidationResult.IsValid)
                    {
                        var message = ModelValidationResult.Errors.First().Value.First().ErrorMessage;
                        Debug.Log($"Wrong request: {message}");
                        return(Response.AsJson(new { error = $"Failed to update simulation: {message}" }, HttpStatusCode.BadRequest));
                    }

                    var simulation = req.ToModel(this.Context.CurrentUser.Identity.Name);
                    simulation.Id  = id;

                    simulation.Status = service.GetActualStatus(simulation, true);
                    if (simulation.Status != "Valid")
                    {
                        throw new Exception($"Simulation is invalid");
                    }

                    simulation.Status = service.GetActualStatus(simulation, false);
                    int result        = service.Update(simulation);

                    SIM.LogWeb(SIM.Web.SimulationEditName, simulation.Name);
                    try
                    {
                        SIM.LogWeb(SIM.Web.SimulationEditMapName, mapService.Get(simulation.Map.Value, this.Context.CurrentUser.Identity.Name).Name);

                        if (simulation.Vehicles != null)
                        {
                            foreach (var vehicle in simulation.Vehicles)
                            {
                                try
                                {
                                    var vehicleModel = vehicleService.Get(vehicle.Vehicle, this.Context.CurrentUser.Identity.Name);
                                    SIM.LogWeb(SIM.Web.SimulationEditVehicleName, vehicleModel.Name);
                                    SIM.LogWeb(SIM.Web.SimulationEditBridgeType, vehicleModel.BridgeType);
                                }
                                catch { };
                            }
                        }

                        SIM.LogWeb(SIM.Web.SimulationEditAPIOnly, simulation.ApiOnly.ToString());
                        SIM.LogWeb(SIM.Web.SimulationEditInteractiveMode, simulation.Interactive.ToString());
                        SIM.LogWeb(SIM.Web.SimulationEditHeadlessMode, simulation.Headless.ToString());
                        try
                        {
                            SIM.LogWeb(SIM.Web.SimulationEditClusterName, clusterService.Get(simulation.Cluster.Value, this.Context.CurrentUser.Identity.Name).Name);
                        }
                        catch { };
                        SIM.LogWeb(SIM.Web.SimulationEditUsePredefinedSeed, simulation.Seed.ToString());
                        SIM.LogWeb(SIM.Web.SimulationEditEnableNPC, simulation.UseTraffic.ToString());
                        SIM.LogWeb(SIM.Web.SimulationEditRandomPedestrians, simulation.UsePedestrians.ToString());
                        SIM.LogWeb(SIM.Web.SimulationEditTimeOfDay, simulation.TimeOfDay.ToString());
                        SIM.LogWeb(SIM.Web.SimulationEditRain, simulation.Rain.ToString());
                        SIM.LogWeb(SIM.Web.SimulationEditWetness, simulation.Wetness.ToString());
                        SIM.LogWeb(SIM.Web.SimulationEditFog, simulation.Fog.ToString());
                        SIM.LogWeb(SIM.Web.SimulationEditCloudiness, simulation.Cloudiness.ToString());
                    }
                    catch { };

                    if (result > 1)
                    {
                        throw new Exception($"More than one simulation has id {id}");
                    }
                    else if (result < 1)
                    {
                        throw new IndexOutOfRangeException();
                    }

                    return(SimulationResponse.Create(simulation));
                }
                catch (IndexOutOfRangeException)
                {
                    Debug.Log($"Simulation with id {id} does not exist");
                    return(Response.AsJson(new { error = $"Simulation with id {id} does not exist" }, HttpStatusCode.NotFound));
                }
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    return(Response.AsJson(new { error = $"Failed to update simulation with id {id}: {ex.Message}" }, HttpStatusCode.InternalServerError));
                }
            });

            Delete("/{id:long}", x =>
            {
                long id = x.id;
                Debug.Log($"Removing simulation with id {id}");
                try
                {
                    int result = service.Delete(id, this.Context.CurrentUser.Identity.Name);
                    SIM.LogWeb(SIM.Web.SimulationDelete);
                    if (result > 1)
                    {
                        throw new Exception($"More than one simulation has id {id}");
                    }

                    if (result < 1)
                    {
                        throw new IndexOutOfRangeException();
                    }

                    return(new { });
                }
                catch (IndexOutOfRangeException)
                {
                    Debug.Log($"Simulation with id {id} does not exist");
                    return(Response.AsJson(new { error = $"Simulation with id {id} does not exist" }, HttpStatusCode.NotFound));
                }
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    return(Response.AsJson(new { error = $"Failed to remove simulation with id {id}: {ex.Message}" }, HttpStatusCode.InternalServerError));
                }
            });

            Post("/{id:long}/start", x =>
            {
                long id = x.id;
                Debug.Log($"Starting simulation with id {id}");
                try
                {
                    var current = service.GetCurrent(this.Context.CurrentUser.Identity.Name);
                    if (current != null)
                    {
                        throw new Exception($"Simulation with id {current.Id} is already running");
                    }

                    var simulation = service.Get(id, this.Context.CurrentUser.Identity.Name);
                    if (service.GetActualStatus(simulation, false) != "Valid")
                    {
                        simulation.Status = "Invalid";
                        service.Update(simulation);

                        throw new Exception("Cannot start an invalid simulation");
                    }

                    service.Start(simulation);
                    SIM.LogWeb(SIM.Web.WebClick, "SimulationStart");
                    return(new { });
                }
                catch (IndexOutOfRangeException)
                {
                    Debug.Log($"Simulation with id {id} does not exist");
                    return(Response.AsJson(new { error = $"Simulation with id {id} does not exist" }, HttpStatusCode.NotFound));
                }
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    return(Response.AsJson(new { error = $"Failed to start simulation with id {id}: {ex.Message}" }, HttpStatusCode.InternalServerError));
                }
            });

            Post("/{id:long}/stop", x =>
            {
                long id = x.id;
                Debug.Log($"Stopping simulation with id {id}");
                try
                {
                    var simulation = service.GetCurrent(this.Context.CurrentUser.Identity.Name);
                    if (simulation == null || simulation.Id != id)
                    {
                        throw new Exception($"Simulation with id {id} is not running");
                    }

                    service.Stop();
                    SIM.LogWeb(SIM.Web.WebClick, "SimulationStop");
                    return(new { });
                }
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    return(Response.AsJson(new { error = $"Failed to stop simulation with id {id}: {ex.Message}" }, HttpStatusCode.InternalServerError));
                }
            });
        }
Ejemplo n.º 17
0
 public void AddCompletedServiceToServiceHistory(IVehicleService service)
 {
     serviceHistory.Add(service);
 }
Ejemplo n.º 18
0
 public bool?CheckIfServiceIsCompleted(IVehicleService service)
 {
     return(service.IsServiceCompleted);
 }
Ejemplo n.º 19
0
 public ModelController(IVehicleService service)
 {
     this.Service = service;
 }
Ejemplo n.º 20
0
 public InsertTests(IClientService cliSrvc, IEmployeeService empSrvc, IBrandService brandSrvc, IVehicleService vehicleSrvc, IParkingSpotService psSrvc, IModelService modelSrvc, ILocationSevice locationSrvc)
 {
     this._clientService      = cliSrvc;
     this._employeeService    = empSrvc;
     this._brandService       = brandSrvc;
     this._vehicleService     = vehicleSrvc;
     this._parkingSpotService = psSrvc;
     this._modelService       = modelSrvc;
     this._locationSevice     = locationSrvc;
 }
Ejemplo n.º 21
0
 public AddVehicleVM(IVehicleService service, IDinkeyDongleService _dongleService) : base(_service: service, _dongleService: _dongleService)
 {
 }
Ejemplo n.º 22
0
 public VehiclesController(IVehicleService vehicleSearchService)
 {
     _vehicleSearchService = vehicleSearchService;
 }
Ejemplo n.º 23
0
 public VehicleController(IVehicleService vehicleService,
                          ICustomerService customerService)
 {
     this._vehicleService  = vehicleService;
     this._customerService = customerService;
 }
Ejemplo n.º 24
0
 public CheckOutController(IVehicleService vehicleService)
 {
     _vehicleService = vehicleService;
 }
Ejemplo n.º 25
0
 public VehicleController(IErrorService errorService,
                          IVehicleService vehicleService) : base(errorService)
 {
     _vehicleService = vehicleService;
 }
Ejemplo n.º 26
0
 public VehiclesTest(DatabaseFixture fixture)
 {
     this.fixture        = fixture;
     this.vehicleService = new VehicleService(this.fixture.Context, this.fixture.Mapper);
 }
 public UpdateVehicleHandler(IVehicleService vehicleService, IMapper mapper)
 {
     _vehicleService = vehicleService ?? throw new ArgumentNullException(nameof(_vehicleService));
     _mapper         = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
Ejemplo n.º 28
0
 public VehicleController(IVehicleService vehicleService)
 {
     _vehicleService = vehicleService;
     _vehicleService.CreateVehicles();
 }
Ejemplo n.º 29
0
 public VehicleController(IVehicleService vehicleService, IUserService userService)
 {
     this.vehicleService = vehicleService;
     this.userService    = userService;
 }
 public VehiclesController(IVehicleService service)
 {
     this.service = service;
 }
Ejemplo n.º 31
0
 public MakeController(IVehicleService vehicleService)
 {
     this.vehicleService = vehicleService;
 }
 public VehicleImageController(IVehicleImageService vehicleImageService, IVehicleService vehicleService)
 {
     VehicleImageService = vehicleImageService;
     VehicleService      = vehicleService;
 }
Ejemplo n.º 33
0
 public VehicleController(ILogger <VehicleController> logger, IVehicleService service)
 {
     _logger  = logger;
     _service = service;
 }
Ejemplo n.º 34
0
 public VehicleController(IVehicleService vehicleService)
 {
     this._vehicleService = vehicleService;
 }
Ejemplo n.º 35
0
 public InspectionService(IRepository <Inspection> genericRepository, IUserService userService, IVehicleService vehicleService) : base(genericRepository)
 {
     this.userService        = userService;
     this.vehicleService     = vehicleService;
     this._genericRepository = genericRepository;
 }
 public VehicleController()
 {
     vehicleService = new VehicleService();
 }
 public void Setup()
 {
     var sampleDB = XDocument.Parse(Sampledata.Vehicles);
     _vehicleService = new XmlVehicleService(sampleDB);
 }
 public VehicleController(IVehicleService vehicleService, UserManager <MdmsUser> userManager)
 {
     _vehicleService = vehicleService;
     _userManager    = userManager;
 }
Ejemplo n.º 39
0
 public VehicleLogics(IVehicleService vehicleService)
 {
     _vehicleService = vehicleService;
 }
Ejemplo n.º 40
0
 public WorkshopController(IVehicleService vehicleService, IOrderService orderService)
 {
     this._vehicleService = vehicleService;
     this._orderService = orderService;
 }
Ejemplo n.º 41
0
 public DataController(ICustomerService customerService, IVehicleService vehicleService)
 {
     _customerService = customerService;
     _vehicleService  = vehicleService;
 }
Ejemplo n.º 42
0
 public HomeController(IVehicleService vehicleService, IOrderService orderService, IOptionService optionService)
 {
     this._vehicleService = vehicleService;
     this._orderService = orderService;
     this._optionService = optionService;
 }
Ejemplo n.º 43
0
 public SupplyController(ISupplyService supplyService, IVehicleService vehicleService)
 {
     this.supplyService  = supplyService;
     this.vehicleService = vehicleService;
 }