private async void CheckIn(int roomId)
        {
            if (string.IsNullOrWhiteSpace(FirstName) || string.IsNullOrWhiteSpace(LastName) || SelectedRoom == null)
            {
                MessageDialog dialog = new MessageDialog("You must enter first and last name and select a room", "Error");
                await dialog.ShowAsync();

                return;
            }

            var sensor = new Sensor
            {
                FirstName = FirstName,
                LastName  = LastName,
                SensorId  = 5,
                SensorMac = "1"
            };

            var presence = new SensorPresence
            {
                RoomId    = roomId,
                SensorId  = sensor.SensorId,
                TimeStamp = DateTime.Now
            };

            await serverHubProxy.Invoke("RecordLocation", presence, sensor);

            navigationService.NavigateTo("checkedInList");
        }
Beispiel #2
0
 public static PresenceDto Convert(this SensorPresence presence)
 {
     return(new PresenceDto
     {
         RoomId = presence.roomId,
         SensorId = presence.sensorId,
         TimeStamp = presence.timeSample
     });
 }
Beispiel #3
0
        public void CreateSensorPresence(SensorPresence presence, Sensor sensor)
        {
            using (var context = new ClientSensorLocationEntities())
            {
                //Check if sensor doesn't exist
                if (context.Sensors.Find(sensor.sensorId) == null)
                {
                    context.Sensors.Add(sensor);
                }

                // Check if sensor is present elsewhere
                if (context.SensorPresences.Find(sensor.sensorId) != null)
                {
                    context.SensorPresences.Remove(context.SensorPresences.Find(sensor.sensorId));
                }

                context.SensorPresences.Add(presence);
                context.SaveChanges();
            }
        }