Exemple #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Title = "Victims";


            mapView = new MKMapView(View.Bounds);
            mapView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;
            mapView.MapType          = MKMapType.Hybrid;
            View.AddSubview(mapView);
            locationManager.RequestWhenInUseAuthorization();

            if (CLLocationManager.LocationServicesEnabled)
            {
                mapView.ShowsUserLocation = true;

                locationManager.StartMonitoringSignificantLocationChanges();
                locationManager.StartUpdatingLocation();
            }

            MapDelegate1.color = 2;

            // create our location and zoom for los angeles
            var rcoords = new CLLocationCoordinate2D(37.774628, -122.387341);             // paris
            var span    = new MKCoordinateSpan(MilesToLatitudeDegrees(0.7), MilesToLongitudeDegrees(0.7, rcoords.Latitude));

            // set the coords and zoom on the map
            mapView.Region = new MKCoordinateRegion(rcoords, span);



            PersonDataService persons = new PersonDataService();

            foreach (var person in persons.GetAllPerson())
            {
                mapView.AddAnnotation(new MKPointAnnotation()
                {
                    Title      = person.Name,
                    Subtitle   = person.PhoneNumber + " - Help Me",
                    Coordinate = new CLLocationCoordinate2D(person.latitude, person.longitude)
                });
            }


            // assign the delegate, which handles annotation layout and clicking
            mapView.Delegate = new MapDelegate2(this);



            // add a basic annotation
            var annotation = new BasicMapAnnotation(new CLLocationCoordinate2D(37.774628, -122.387341), "Sathish Kumar Natarajan", "415 533 1764");

            mapView.AddAnnotation(annotation);

            btnBack.TouchUpInside += (sender, e) =>
            {
                this.DismissViewController(true, null);
            };
        }
Exemple #2
0
        public IList <Person> GetPersons()
        {
            Thread.Sleep(1000);
            IList <Person> Persons = new List <Person>();
            DataTable      ds;

            using (PersonDataService data = new PersonDataService())
            {
                string sql = "SELECT *  FROM [Person].[Person]";

                ds = data.GetPersons(sql);
            }
            Persons = ConvertToPersons(ds);

            return(Persons);
        }
		public async Task Add_WhenPersonProvided_ShouldAddPerson()
		{
			// arrange
			Person person = new Person {Id= 1, FirstName = "Andrew", LastName = "Armstrong" };
			Person expected = new Person { Id = 2, FirstName = "Peter", LastName = "Celver" };
			repository.Setup(rep => rep.Add(person)).ReturnsAsync(expected);

			PersonDataService dataService = new PersonDataService(repository.Object);

			// act
			Person actual = await dataService.Add(person);

			// assert
			Assert.IsInstanceOfType(actual, typeof(Person));
			Assert.AreEqual(expected, actual);
		}
Exemple #4
0
        public async Task <IList <Person> > GetPersonsTask()
        {
            await Task.Delay(1000);

            IList <Person> Persons = new List <Person>();
            DataTable      ds;

            using (PersonDataService data = new PersonDataService())
            {
                string sql = "SELECT *  FROM [Person].[Person]";

                ds = await data.GetPersonsAsync(sql);
            }
            Persons = ConvertToPersons(ds);

            return(Persons);
        }
Exemple #5
0
        static void Main(string[] args)
        {
            using var ctx = new ImdbContext();


            PersonDataService personDataService = new PersonDataService();

            //Console.WriteLine(personDataService.GetPersonKnownTitles("nm0000001"));

            IQueryable <Person> GetPersonBySubstring(string substring)
            {
                var ctx   = new ImdbContext();
                var query = ctx.Person.Where(x => x.Name.Contains(substring));

                return(query);
            }

            //GetPersonBySubstring("red ast")


            List <Person_Profession> GetProfessionByPersonId(string id)
            {
                var query = ctx.PersonProfessions
                            .Include(c => c.person)
                            .Include(v => v.Profession)
                            .Where(p => p.person.Id == id)
                            .ToList();

                ctx.SaveChanges();

                return(query.ToList());
            }

            List <Person_Profession> GetPersonsByProfession(string profession)
            {
                var ctx        = new ImdbContext();
                var personList = ctx.PersonProfessions
                                 .Include(x => x.person)
                                 .Include(c => c.Profession)
                                 .Where(personProfession => personProfession.Profession.ProfessionName == profession);

                return(personList.ToList());
            }

            Console.WriteLine(GetPersonsByProfession("actor"));
        }
		public void GetAll_ShouldReturnAllPersons()
		{
			// arrange
			var expected = new List<Person>
			{
			   new Person { Id = 1, FirstName = "Andrew", LastName = "McArthur" },
			   new Person { Id = 2, FirstName = "Peter", LastName = "Celver" }
			}.AsQueryable();
			repository.Setup(rep => rep.GetAll()).Returns(expected);
			PersonDataService dataService = new PersonDataService(repository.Object);

			// act
			IQueryable<Person> actual = dataService.GetAll();

			// assert
			Assert.AreEqual(expected, actual);
			Assert.AreEqual(2, actual.Count());
		}
 public PersonDataServiceTest(ITestOutputHelper output)
 {
     _personDataService = new PersonDataService();
     this.output        = output;
 }
Exemple #8
0
 public UsersController(IOptions <AppSettings> appSettings, ThermoDataContext thermoDataContext)
 {
     _appSettings       = appSettings.Value;
     _thermoDataContext = thermoDataContext;
     _personDataService = new PersonDataService(thermoDataContext);
 }