Пример #1
0
        public LocationShare(LocationShareData data, IEnumerable<TrackerData> shareTrackers)
        {
            PrivateId = data.PrivateId;
            PublicId = data.PublicId;
            Longitude = data.Longitude;
            Latitude = data.Latitude;
            User = new UserInfo () {
                Id = data.UserId,
                Name = data.UserName,
                Icon = data.UserIcon
            };
            SharedTime = data.SharedTime;
            ExpireTime = data.ExpireTime;

            if (shareTrackers != null) {
                foreach (var t in shareTrackers) {
                    trackers.Add (new UserInfo () {
                        Id = t.TrackerId,
                        Name = t.UserName,
                        Icon = t.UserIcon
                    });
                }
            }
        }
Пример #2
0
 static LocationShare GetFullShare(DbConnection db, LocationShareData s)
 {
     var trackers = db.SelectObjectsWhere<TrackerData> ("sharePrivateId={0}", s.PrivateId);
     return new LocationShare (s, trackers);
 }
Пример #3
0
        public static LocationShare CreateLocationShare(UserInfo user, ShareSettings settings)
        {
            try {
                Console.WriteLine ("test");
                LocationShareData data = new LocationShareData () {
                    UserId = user.Id,
                    UserName = user.Name,
                    UserIcon = user.Icon,
                    UserRegistrationId = user.RegistrationId,
                    PublicId = GenerateRandomId (),
                    PrivateId = GenerateRandomId (),
                    Longitude = 0,
                    Latitude = 0,
                    SharedTime = DateTime.Now,
                    ExpireTime = settings.CalculateTimeout (),
                    ExpireOnArrival = settings.CancelOnArrival
                };

                var db = GetConnection ();
                db.InsertObject (data);
                LogService.Log ("Registered Share " + data.PublicId + ", with private Id " + data.PrivateId + ", registration id " + user.RegistrationId);
                return new LocationShare (data, null);
            } catch (Exception e) {
                ThrowFailure (e);
                throw;
            }
        }
Пример #4
0
 public TrackedShare(LocationShareData s, string trackerId)
 {
     TrackerId = trackerId;
     Id = s.PublicId;
     Longitude = s.Longitude;
     Latitude = s.Latitude;
     User = new UserInfo () {
         Name = s.UserName,
         Icon = s.UserIcon
     };
 }
Пример #5
0
 public PublicLocationShare(LocationShareData t)
 {
     Id = t.PublicId;
     Longitude = t.Longitude;
     Latitude = t.Latitude;
     User = new UserInfo () {
         Name = t.UserName,
         Icon = t.UserIcon
     };
 }