public CourtListControllerTests() { var fileServices = new EnvironmentBuilder("FileServicesClient:Username", "FileServicesClient:Password", "FileServicesClient:Url"); var lookupServices = new EnvironmentBuilder("LookupServicesClient:Username", "LookupServicesClient:Password", "LookupServicesClient:Url"); var locationServices = new EnvironmentBuilder("LocationServicesClient:Username", "LocationServicesClient:Password", "LocationServicesClient:Url"); var lookupServiceClient = new LookupCodeServicesClient(lookupServices.HttpClient); var locationServiceClient = new LocationServicesClient(locationServices.HttpClient); var fileServicesClient = new FileServicesClient(fileServices.HttpClient); var lookupService = new LookupService(lookupServices.Configuration, lookupServiceClient, new CachingService()); var locationService = new LocationService(locationServices.Configuration, locationServiceClient, new CachingService()); var claims = new[] { new Claim(CustomClaimTypes.JcParticipantId, fileServices.Configuration.GetNonEmptyValue("Request:PartId")), new Claim(CustomClaimTypes.JcAgencyCode, fileServices.Configuration.GetNonEmptyValue("Request:AgencyIdentifierId")), }; var identity = new ClaimsIdentity(claims, "Cookies"); var principal = new ClaimsPrincipal(identity); var courtListService = new CourtListService(fileServices.Configuration, fileServices.LogFactory.CreateLogger <CourtListService>(), fileServicesClient, new Mapper(), lookupService, locationService, new CachingService(), principal); _controller = new CourtListController(courtListService) { ControllerContext = HttpResponseTest.SetupMockControllerContext(fileServices.Configuration) }; }
public FilesControllerTests() { //TODO NInject or some other resolvers. var fileServices = new EnvironmentBuilder("FileServicesClient:Username", "FileServicesClient:Password", "FileServicesClient:Url"); var lookupServices = new EnvironmentBuilder("LookupServicesClient:Username", "LookupServicesClient:Password", "LookupServicesClient:Url"); var locationServices = new EnvironmentBuilder("LocationServicesClient:Username", "LocationServicesClient:Password", "LocationServicesClient:Url"); var lookupServiceClient = new LookupCodeServicesClient(lookupServices.HttpClient); var locationServiceClient = new LocationServicesClient(locationServices.HttpClient); var fileServicesClient = new FileServicesClient(fileServices.HttpClient); _fileServicesClient = fileServicesClient; var lookupService = new LookupService(lookupServices.Configuration, lookupServiceClient, new CachingService()); var locationService = new LocationService(locationServices.Configuration, locationServiceClient, new CachingService()); _agencyIdentifierId = fileServices.Configuration.GetNonEmptyValue("Request:AgencyIdentifierId"); _partId = fileServices.Configuration.GetNonEmptyValue("Request:PartId"); var claims = new[] { new Claim(CustomClaimTypes.JcParticipantId, _partId), new Claim(CustomClaimTypes.JcAgencyCode, _agencyIdentifierId), }; var identity = new ClaimsIdentity(claims, "Cookies"); var principal = new ClaimsPrincipal(identity); var filesService = new FilesService(fileServices.Configuration, fileServicesClient, new Mapper(), lookupService, locationService, new CachingService(), principal); //TODO fake this. var vcCivilFileAccessHandler = new VcCivilFileAccessHandler(new ScvDbContext()); _controller = new FilesController(fileServices.Configuration, fileServices.LogFactory.CreateLogger <FilesController>(), filesService, vcCivilFileAccessHandler); _controller.ControllerContext = HttpResponseTest.SetupMockControllerContext(fileServices.Configuration); }
protected void ButtonStoreAddress_Click(object sender, EventArgs e) { LabelErrorStoreName.Visible = false; string zipcode = validateAndReturnZipCode(); string storeName = TextBoxStoreName.Text; string nearestStoreAddress = null; if (zipcode != null && !storeName.Equals("")) { LabelStoreAddress.Visible = true; LocationServicesClient client = new LocationServicesClient(); nearestStoreAddress = client.findNearestStore(zipcode, storeName); if (nearestStoreAddress.Equals("") || nearestStoreAddress == null) { LabelStoreAddress.Text = "Sorry..No store found in the neighborhood with the given name"; } else { LabelStoreAddress.Text = nearestStoreAddress; } } else { LabelErrorStoreName.Visible = true; LabelErrorStoreName.Text = "Please enter a store name"; } }
// calling a service that returns latitude,longtitude against an input zipcode private string getLatLonByZipCode(string zipcode) { string latlon = ""; LocationServicesClient client = new LocationServicesClient(); latlon = client.getLatLonByZipCode(zipcode); return(latlon); }
public JCDataUpdaterService(SheriffDbContext dbContext, LocationServicesClient locationClient, IConfiguration configuration, ILogger <JCDataUpdaterService> logger) { LocationClient = locationClient; Db = dbContext; Configuration = configuration; Expire = Configuration.GetNonEmptyValue("JCSynchronization:Expire").Equals("true"); AssociateUsersWithNoLocationToVictoria = Configuration.GetNonEmptyValue("JCSynchronization:AssociateUsersWithNoLocationToVictoria").Equals("true"); Logger = logger; }
public LocationService(IConfiguration configuration, LocationServicesClient locationServicesClient, IAppCache cache) { _configuration = configuration; _locationClient = locationServicesClient; _cache = cache; _cache.DefaultCachePolicy.DefaultCacheDurationSeconds = int.Parse(configuration.GetNonEmptyValue("Caching:LocationExpiryMinutes")) * 60; SetupLocationServicesClient(); }
public JCDataUpdaterService(SheriffDbContext dbContext, LocationServicesClient locationClient, IConfiguration configuration, ILogger <JCDataUpdaterService> logger) { LocationClient = locationClient; Db = dbContext; Configuration = configuration; ExpireRegions = Configuration.GetNonEmptyValue("JCSynchronization:ExpireRegions").Equals("true"); ExpireLocations = Configuration.GetNonEmptyValue("JCSynchronization:ExpireLocations").Equals("true"); ExpireRooms = Configuration.GetNonEmptyValue("JCSynchronization:ExpireCourtRooms").Equals("true"); AssociateUsersWithNoLocationToVictoria = Configuration.GetNonEmptyValue("JCSynchronization:AssociateUsersWithNoLocationToVictoria").Equals("true"); UpdateEvery = TimeSpan.Parse(configuration.GetNonEmptyValue("JCSynchronization:UpdateEvery")); Logger = logger; }
public FilesControllerTests() { var fileServices = new EnvironmentBuilder("FileServicesClient:Username", "FileServicesClient:Password", "FileServicesClient:Url"); var lookupServices = new EnvironmentBuilder("LookupServicesClient:Username", "LookupServicesClient:Password", "LookupServicesClient:Url"); var locationServices = new EnvironmentBuilder("LocationServicesClient:Username", "LocationServicesClient:Password", "LocationServicesClient:Url"); var lookupServiceClient = new LookupServiceClient(lookupServices.HttpClient); var locationServiceClient = new LocationServicesClient(locationServices.HttpClient); var fileServicesClient = new FileServicesClient(fileServices.HttpClient); var lookupService = new LookupService(lookupServices.Configuration, lookupServiceClient, new CachingService()); var locationService = new LocationService(locationServices.Configuration, locationServiceClient, new CachingService()); var filesService = new FilesService(fileServices.Configuration, fileServicesClient, new Mapper(), lookupService, locationService, new CachingService()); _controller = new FilesController(fileServices.Configuration, fileServices.LogFactory.CreateLogger <FilesController>(), filesService); _controller.ControllerContext = HttpResponseTest.SetupMockControllerContext(); }
public CourtListControllerTests() { var fileServices = new EnvironmentBuilder("FileServicesClient:Username", "FileServicesClient:Password", "FileServicesClient:Url"); var lookupServices = new EnvironmentBuilder("LookupServicesClient:Username", "LookupServicesClient:Password", "LookupServicesClient:Url"); var locationServices = new EnvironmentBuilder("LocationServicesClient:Username", "LocationServicesClient:Password", "LocationServicesClient:Url"); var lookupServiceClient = new LookupServiceClient(lookupServices.HttpClient); var locationServiceClient = new LocationServicesClient(locationServices.HttpClient); var fileServicesClient = new FileServicesClient(fileServices.HttpClient); var lookupService = new LookupService(lookupServices.Configuration, lookupServiceClient, new CachingService()); var locationService = new LocationService(locationServices.Configuration, locationServiceClient, new CachingService()); var courtListService = new CourtListService(fileServices.Configuration, fileServicesClient, new Mapper(), lookupService, locationService, new CachingService()); _controller = new CourtListController(courtListService) { ControllerContext = HttpResponseTest.SetupMockControllerContext() }; }
protected void ButtonSolarIndex_Click(object sender, EventArgs e) { string zipcode = validateAndReturnZipCode(); if (zipcode != null) { LabelSolarIndex.Visible = true; decimal solarIndex = 0; string latlon = getLatLonByZipCode(zipcode); string[] latLonArray = latlon.Split(','); decimal latitude = Convert.ToDecimal(latLonArray[0]); decimal longitude = Convert.ToDecimal(latLonArray[1]); LocationServicesClient client = new LocationServicesClient(); solarIndex = client.getSolarIntensity(latitude, longitude); if (solarIndex != 0 && solarIndex > 7) { LabelSolarIndex.Text = "High"; } else if (solarIndex != 0 && solarIndex > 4 && solarIndex <= 7) { LabelSolarIndex.Text = "Medium"; } else if (solarIndex != 0) { LabelSolarIndex.Text = "Low"; } else { LabelSolarIndex.Text = "Something went wrong in backend"; } } }