public void Setup()
        {
            var mock = new Mock <IGeoRepository>();

            mock.Setup(a => a.getLocations()).Returns(new List <Location>()
            {
                createLocation("Test1", "PT1"),
                createLocation("Test2", ""),
                createLocation("Test5", ""),
                createLocation("Test3", "PT3"),
                createLocation("Test3", "PT2"),
                createLocation("Test6", ""),
                createLocation("Test7", "PT10"),
                createLocation("Test7", "PT11"),
            });

            mock.Setup(a => a.getCitySortPosition()).Returns(new List <int>()
            {
                0,
                1,
                3,
                4,
                2,
                5,
                6,
                7
            });
            getService = new GeoService(mock.Object);
        }
Beispiel #2
0
 public UserControlLinkedIn2ViewModel(IPeopleService peopleService, IGeoService geoService)
 {
     this.peopleService = peopleService;
     this.geoService    = geoService;
     Jobs     = peopleService.GetJobs().ToList();
     ZipCodes = geoService.GetZipCodes().ToList();
 }
Beispiel #3
0
 public static IGeoService SelectProviderByName(string defaultGeoProvider)
 {
     _selectedGeoService = string.IsNullOrWhiteSpace(defaultGeoProvider)
         ? GeoProviders.FirstOrDefault()
         : GeoProviders.FirstOrDefault(x => x.Name == defaultGeoProvider);
     return(_selectedGeoService);
 }
Beispiel #4
0
        private async Task InsertData(IGeoService dm)
        {
            var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data\\point_list.txt");

            foreach (var line in File.ReadLines(path))
            {
                var columns  = line.Split('\t');
                var vendorid = columns[0];

                var st            = columns[1];
                var et            = columns[2];
                var fromLatitude  = double.Parse(columns[4], CultureInfo.InvariantCulture);
                var fromLongitude = double.Parse(columns[3], CultureInfo.InvariantCulture);

                var toLatitude  = double.Parse(columns[6], CultureInfo.InvariantCulture);
                var toLongitude = double.Parse(columns[5], CultureInfo.InvariantCulture);

                var fromPoint   = new GeoPoint(fromLatitude, fromLongitude);
                var toPoint     = new GeoPoint(toLatitude, toLongitude);
                var rangeKeyVal = new AttributeValue {
                    S = vendorid
                };
                var req = new PutPointRequest(fromPoint, toPoint);
                req.PutItemRequest.Item["startTime"] = new AttributeValue {
                    S = st
                };
                req.PutItemRequest.Item["endTime"] = new AttributeValue {
                    S = et
                };
                await dm.PutPointAsync(req);
            }

            Status = Status.Ready;
        }
        public AccountController(
            IIdentityServerInteractionService interaction,
            IClientStore clientStore,
            SignInManager <ApplicationUser> signInManager,
            UserManager <ApplicationUser> userManager,
            IAuthenticationSchemeProvider schemeProvider,
            IEventService events,
            IRegistrationService registrationService,
            IForgotPasswordService forgotPasswordService,
            IResetPasswordService resetPasswordService,
            ILoginService loginService,
            IGeoService geoService,
            IOptions <AppSettings> settings)
        {
            // if the TestUserStore is not in DI, then we'll just use the global users collection
            // this is where you would plug in your own custom identity management library (e.g. ASP.NET Identity)

            _interaction           = interaction;
            _clientStore           = clientStore;
            _signInManager         = signInManager;
            _userManager           = userManager;
            _schemeProvider        = schemeProvider;
            _settings              = settings;
            _events                = events;
            _registrationService   = registrationService;
            _forgotPasswordService = forgotPasswordService;
            _resetPasswordService  = resetPasswordService;
            _loginService          = loginService;
            _geoService            = geoService;
        }
Beispiel #6
0
 public static void SelectProviderByObject(IGeoService item)
 {
     if (GeoProviders.Contains(item))
     {
         _selectedGeoService = item;
     }
 }
        public MapViewModel(IParkingService parkingService, IGeoService geoService)
        {
            ParkingService = parkingService;
            GeoService     = geoService;

            GetLocationAddress();
        }
Beispiel #8
0
 public FormController(IFormService formService, ICustomFieldService customFieldService, IGeoService geoService, ICachingService cachingService, IReportService reportService)
 {
     this.formService        = formService;
     this.customFieldService = customFieldService;
     this.geoService         = geoService;
     this.cachingService     = cachingService;
     this.reportService      = reportService;
 }
Beispiel #9
0
        public GeoServiceTests()
        {
            this.storageBrokerMock = new Mock <IStorageBroker>();
            this.loggingBrokerMock = new Mock <ILoggingBroker>();

            this.geoService = new GeoService(
                this.storageBrokerMock.Object,
                this.loggingBrokerMock.Object);
        }
Beispiel #10
0
 public async Task StartLoadData(IGeoService manager)
 {
     Status = Status.CreatingTable;
     //var config = manager.GeoDataManagerConfiguration;
     //var ctr = GeoTableUtil.GetCreateTableRequest(config);
     //await config.DynamoDBClient.CreateTableAsync(ctr);
     //await WaitForTableToBeReady(manager);
     await InsertData(manager);
 }
 public HomeController(IUserService userService, IAuthentication authentication, IListingService listingService,
     IFeaturedService featuredService, IGeoService geoService)
 {
     _userService = userService;
     _authentication = authentication;
     _listingService = listingService;
     _featuredService = featuredService;
     _geoService = geoService;
 }
        IGeoService CreateProxy()
        {
            NetTcpBinding binding = new NetTcpBinding();

            ChannelFactory <IGeoService> factory = new ChannelFactory <IGeoService>(binding, _DiscoveredAddress);
            IGeoService proxy = factory.CreateChannel();

            return(proxy);
        }
 public ZipCode GetZipInfo(string zip)
 {
     using (ChannelFactory <IGeoService> oGeoService = new ChannelFactory <IGeoService>(""))
     {
         IGeoService oService = oGeoService.CreateChannel();
         return(oService.GetZipInfo(zip));
     }
     // return Channel.GetZipInfo(zip);
 }
 public IEnumerable <ZipCode> GetZips(ZipCode zipCode, int range)
 {
     using (ChannelFactory <IGeoService> oGeoService = new ChannelFactory <IGeoService>(""))
     {
         IGeoService oService = oGeoService.CreateChannel();
         return(oService.GetZips(zipCode, range));
     }
     //  return Channel.GetZips(zipCode, range);
 }
Beispiel #15
0
 /// <summary>
 /// Creating constructor for users controller for accessing
 /// </summary>
 /// <param name="userService">userService</param>
 /// <param name="tourService">tourService</param>
 /// <param name="actionService">actionService</param>
 /// <param name="cachingService">cachingService</param>
 public UserController(IUserService userService, ITourService tourService,
                       IActionService actionService, ICachingService cachingService, ICampaignService campaignService, IGeoService geoService)
 {
     this.userService     = userService;
     this.tourService     = tourService;
     this.actionService   = actionService;
     this.cachingService  = cachingService;
     this.campaignService = campaignService;
     this.geoService      = geoService;
 }
Beispiel #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GeoController" /> class.
 /// </summary>
 /// <param name="userInfo">The user information.</param>
 /// <param name="geoService">The country service.</param>
 /// <param name="cache">The memory cache.</param>
 public GeoController(IUserInfo userInfo, IGeoService geoService, IMemoryCache cache) : base(userInfo)
 {
     _geoService   = geoService;
     _cache        = cache;
     _cacheOptions = new MemoryCacheEntryOptions
     {
         Priority          = CacheItemPriority.NeverRemove,
         SlidingExpiration = TimeSpan.FromMinutes(30)
     };
 }
Beispiel #17
0
 public LookupService(IGeoService geoService, IMemoryCache cache)
 {
     _geoService   = geoService;
     _cache        = cache;
     _cacheOptions = new MemoryCacheEntryOptions
     {
         Priority          = CacheItemPriority.NeverRemove,
         SlidingExpiration = TimeSpan.FromMinutes(30)
     };
 }
Beispiel #18
0
        public void test_geo_manager_as_service_http()
        {
            ChannelFactory <IGeoService> channelFactory =
                new ChannelFactory <IGeoService>("http");

            IGeoService proxy = channelFactory.CreateChannel();

            (proxy as ICommunicationObject).Open();

            channelFactory.Close();
        }
 public YourWeatherViewModel(INavigationService navigationService,
                             IPageDialogService pageDialogService,
                             IAPIService aPIService,
                             IFileService fileService,
                             IGeoService geoService) :
     base(navigationService, pageDialogService)
 {
     this.aPIService  = aPIService;
     this.fileService = fileService;
     this.geoService  = geoService;
 }
        public IEnumerable <string> GetStates(bool isPrimaryOnly)
        {
            IEnumerable <string> lstGeoStates = default(IEnumerable <string>);

            using (ChannelFactory <IGeoService> oGeoService = new ChannelFactory <IGeoService>(""))
            {
                IGeoService oService = oGeoService.CreateChannel();
                lstGeoStates = oService.GetStates(isPrimaryOnly);
            }
            return(lstGeoStates);
            //  return Channel.GetStates(isPrimaryOnly);
        }
Beispiel #21
0
        private void GetZipCodesBtn_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(StateTxt.Text))
            {
                return;
            }

            // We could use this, but the generic binding doesn't have access to lot of properties
            //Binding binding = new BasicHttpBinding();

            //To access the MaxReceivedMessageSize we need this instance.
            BasicHttpBinding binding = new BasicHttpBinding {
                MaxReceivedMessageSize = int.MaxValue
            };

            EndpointAddress address = new EndpointAddress("http://localhost/GeoService");



            //This way we can override the configuration
            //using (GeoClient proxy = new GeoClient(binding, address))
            //{
            //    IEnumerable<ZipCodeData> data = proxy.GetZip(StateTxt.Text);

            //    if (data == null) return;

            //    foreach (ZipCodeData zipCodeData in data)
            //    {
            //        ZipCodeByStateLsb.Items.Add(zipCodeData);
            //    }
            //}

            // Or even create a proxy on the fly
            // the only things we need to communicate with the service are
            // contract, binding and endpoint.
            ChannelFactory <IGeoService> proxyFactory = new ChannelFactory <IGeoService>(binding, address);
            IGeoService proxy = proxyFactory.CreateChannel();
            IEnumerable <ZipCodeData> data = proxy.GetZip(StateTxt.Text);

            if (data == null)
            {
                return;
            }

            ZipCodeByStateLsb.Items.Clear();
            foreach (ZipCodeData zipCodeData in data)
            {
                ZipCodeByStateLsb.Items.Add(zipCodeData);
            }

            proxyFactory.Close();
        }
Beispiel #22
0
 public BusinessController(IGeoService geoService, IBusinessService providerService, IRateService rateService, ICommentService commentService, IMapper mapper, ILog4Net logger, IDropDownService dropDownService, IActivityService activityService, ICategory2BusinessService category2BusinessService, IAdminService adminService)
 {
     _dropDownService          = dropDownService;
     _rateService              = rateService;
     _commentService           = commentService;
     _businessService          = providerService;
     _mapper                   = mapper;
     _logger                   = logger;
     _activityService          = activityService;
     _geoService               = geoService;
     _category2BusinessService = category2BusinessService;
     _adminService             = adminService;
 }
Beispiel #23
0
        public GeoXPage()
        {
            InitializeComponent();

            _service            = new GeoService();
            model               = new GeoLocationsStatusViewModel();
            this.BindingContext = model;

            try
            {
                GetUserregionCollection();
                userPlacesCollection = model.LocationStatusCollection;
            }
            catch (Exception ex)
            {
                DisplayAlert("Error loading", ex.Message, "OK");
            }


            listView.ItemsSource = userPlacesCollection;

            /// Catch the region status change and send Attendance record to API
            MessagingCenter.Subscribe <GeofenceResult>(this, "region", async(region) =>
            {
                // await DisplayAlert("Region", region.TransitionName, "OK", "Cancel");
                Region p = new Region()
                {
                    Name            = region.TransitionName.ToString() + "|" + region.RegionId,
                    Latitude        = region.Latitude,
                    Longitude       = region.Longitude,
                    LastEnteredTime = (DateTime)region.LastEnterTime,
                    LastExitedTime  = (DateTime)region.LastExitTime
                };
                // add region status resut to list
                model.LocationStatusCollection.Add(p);

                AttendanceData att = new AttendanceData()
                {
                    Name           = region.RegionId,
                    Latitude       = region.Latitude,
                    Longitude      = region.Longitude,
                    TransitionName = region.TransitionName,
                    TransitionTime = region.TransitionName == GeofenceTransition.Exited.ToString() ? p.LastExitedTime:p.LastEnteredTime,
                    UserId         = 1
                };
                // send record to API
                await UpdateAttendanceAsync(att);
            });
        }
Beispiel #24
0
 public UnitsController(IDepartmentsService departmentsService, IUsersService usersService, IUnitsService unitsService, Model.Services.IAuthorizationService authorizationService,
                        ILimitsService limitsService, IDepartmentGroupsService departmentGroupsService, ICallsService callsService, IEventAggregator eventAggregator, ICustomStateService customStateService,
                        IGeoService geoService)
 {
     _departmentsService      = departmentsService;
     _usersService            = usersService;
     _unitsService            = unitsService;
     _authorizationService    = authorizationService;
     _limitsService           = limitsService;
     _departmentGroupsService = departmentGroupsService;
     _callsService            = callsService;
     _eventAggregator         = eventAggregator;
     _customStateService      = customStateService;
     _geoService = geoService;
 }
Beispiel #25
0
        static GeoWorker()
        {
            var iExtension = typeof(IGeoService);
            var types      = AppDomain.CurrentDomain.GetAssemblies()
                             .SelectMany(s => s.GetTypes())
                             .Where(p => iExtension.IsAssignableFrom(p) && !p.IsInterface);

            foreach (var type in types)
            {
                if (Activator.CreateInstance(type) is IGeoService instance)
                {
                    GeoProviders.Add(instance);
                }
            }
            _selectedGeoService = GeoProviders.First();
        }
Beispiel #26
0
 public ActionLogsService(IActionLogsRepository actionLogsRepository, IUsersService usersService,
                          IDepartmentMembersRepository departmentMembersRepository, IDepartmentGroupsService departmentGroupsService,
                          IDepartmentsService departmentsService, IDepartmentSettingsService departmentSettingsService, IEventAggregator eventAggregator,
                          IGeoService geoService, ICustomStateService customStateService, ICacheProvider cacheProvider)
 {
     _actionLogsRepository        = actionLogsRepository;
     _usersService                = usersService;
     _departmentMembersRepository = departmentMembersRepository;
     _departmentGroupsService     = departmentGroupsService;
     _departmentsService          = departmentsService;
     _departmentSettingsService   = departmentSettingsService;
     _eventAggregator             = eventAggregator;
     _geoService         = geoService;
     _customStateService = customStateService;
     _cacheProvider      = cacheProvider;
 }
Beispiel #27
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // TODO: Prepare page for display here.

            // TODO: If your application contains multiple pages, ensure that you are
            // handling the hardware Back button by registering for the
            // Windows.Phone.UI.Input.HardwareButtons.BackPressed event.
            // If you are using the NavigationHelper provided by some templates,
            // this event is handled for you.

            if (this.geoservice == null)
            {
                this.geoservice = new MqttGeoService("192.168.0.119");
            }
            //this.geoservice = new HttpGeoService("192.168.0.119", 1880);
        }
Beispiel #28
0
        public void test_zip_code_retrieval()
        {
            string  address = "net.pipe://localhost/GeoService";
            Binding binding = new NetNamedPipeBinding();

            ServiceHost host = new ServiceHost(typeof(GeoManager));

            host.AddServiceEndpoint(typeof(IGeoService), binding, address);
            host.Open();

            ChannelFactory <IGeoService> factory = new ChannelFactory <IGeoService>(binding, new EndpointAddress(address));
            IGeoService proxy = factory.CreateChannel();

            ZipCodeData data = proxy.GetZipInfo("07035");

            Assert.IsTrue(data.City.ToUpper() == "LINCOLN PARK");
            Assert.IsTrue(data.State == "NJ");
        }
Beispiel #29
0
        public void Setup()
        {
            var mock = new Mock <IGeoRepository>();

            mock.Setup(a => a.getLocations()).Returns(new List <Location>()
            {
                createLocation("Test1"),
                createLocation("Test2"),
                createLocation("Test3"),
                createLocation("Test4"),
            });
            mock.Setup(a => a.getRanges()).Returns(new List <IPRange>()
            {
                createRange(0, 10, 0),
                createRange(11, 20, 2),
                createRange(21, 30, 1),
                createRange(31, 120, 0),
                createRange(121, 300, 2),
                createRange(1 * 256 * 256, 1 * 256 * 256 + 256, 3),
            });
            getService = new GeoService(mock.Object);
        }
Beispiel #30
0
        public void ZipCodeRetrival()
        {
            Type            contract   = typeof(IGeoService);
            Binding         binding    = new BasicHttpBinding();
            string          addressTxt = "http://localhost/GeoService";
            EndpointAddress address    = new EndpointAddress(addressTxt);

            // Creates the service
            ServiceHost host = new ServiceHost(typeof(GeoManager));

            host.AddServiceEndpoint(contract, binding, addressTxt);
            host.Open();

            // Creates the proxy
            ChannelFactory <IGeoService> proxyFactory = new ChannelFactory <IGeoService>(binding, address);
            IGeoService proxy = proxyFactory.CreateChannel();

            // Test it
            ZipCodeData data = proxy.GetZipInfo("70112");

            Assert.IsTrue(data.City == "New Orleans");
            Assert.IsTrue(data.State == "LA");
        }
 public ScraperService(ITideRepository tideRepository, IGeoService geoService)
 {
     _tideRepository = tideRepository;
     _geoService = geoService;
 }
Beispiel #32
0
 public TasksViewModel(IRepository repository, IGeoService service)
 {
     this.repository = repository;
     this.service = service;
 }
Beispiel #33
0
 public StopController(IWorldRepository repository, IGeoService geoService)
 {
   _repository = repository;
   _geoService = geoService;
 }
 public GeoMapsController(IGeoService geoService)
 {
     _geoService = geoService;
 }
Beispiel #35
0
 public HomeController(IGeoService geoService)
 {
     _geoService = geoService;
 }