Exemplo n.º 1
0
        public async Task <ProfileLite> GetLocationDetails(string ProfileID, string GroupID, string LastUpdateDateTicks)
        {
            //note: here only location details are returned, no profile and user details
            var resProfileLite = new ProfileLite();

            GeoTagList listLocationData = await GetUserLocations(ProfileID, LastUpdateDateTicks, GroupID);

            if (listLocationData == null || listLocationData.List == null || listLocationData.List.Count < 1)
            {
                resProfileLite.IsSOSOn      = false;
                resProfileLite.IsTrackingOn = false;
            }
            else
            {
                resProfileLite.ProfileID = Convert.ToInt64(ProfileID);
                //just passing avaialable info, imp is location details alone
                GeoTag latest = listLocationData.List[listLocationData.List.Count - 1];
                resProfileLite.IsSOSOn      = latest.IsSOS.Value;
                resProfileLite.IsTrackingOn = !latest.IsSOS.Value || !string.IsNullOrEmpty(latest.Lat);

                resProfileLite.LastLocs = listLocationData.List;
                ResultsManager.AddResultInfo(resProfileLite, ResultTypeEnum.Success, "Location details filled.");
            }

            if (!resProfileLite.IsSOSOn && !resProfileLite.IsTrackingOn)
            {
                ResultsManager.AddResultInfo(resProfileLite, ResultTypeEnum.Success, "No Tracking or SOS Details found");
            }

            return(resProfileLite);
        }
Exemplo n.º 2
0
        private async Task PostTheLocation(GeoTags vGeoTags)
        {
            GeoTagList          GTL       = Caster.ConvertToGeoTagList(vGeoTags);
            List <LiveLocation> locations = GTL.List.ConvertToLiveLocationList();

            await new LocationService().PostMyLocation(locations.ToArray());
        }
Exemplo n.º 3
0
        /// <summary>
        /// </summary>
        /// <param name="profileID"></param>
        /// <param name="lastUpdateTimeTicks"></param>
        /// <returns></returns>
        public async Task <GeoTagList> GetUserLocations(string profileID, string lastUpdateTimeTicks,
                                                        string GroupID = "0")
        {
            string liveUserID = WebOperationContext.Current.IncomingRequest.Headers["LiveUserID"];
            string UType      = WebOperationContext.Current.IncomingRequest.Headers["UserType"];

            long ProfileID           = Convert.ToInt64(profileID);
            long LastUpdateTimeTicks = Convert.ToInt64(lastUpdateTimeTicks);

            bool isAuthorized = false;

            if (UType != null && Convert.ToChar(UType) == 'a')
            {
                isAuthorized = await _authService.OwnGroupMembersAccess(liveUserID, Convert.ToInt32(GroupID), ProfileID);
            }
            else
            {
                bool isAuthorizedForSelf = await _authService.SelfAccess(liveUserID, ProfileID);

                bool isAuthorizedForLocateBuddy = await _authService.LocateBuddyAccess(liveUserID, ProfileID);

                if (isAuthorizedForSelf || isAuthorizedForLocateBuddy)
                {
                    isAuthorized = true;
                }
            }
            var geoTagList = new GeoTagList();

            if (isAuthorized)
            {
                List <LiveLocation> geoLiveLocation =
                    (await _locRepository.GetLocationData(ProfileID, LastUpdateTimeTicks)).ToList();

                List <GeoTag> LiveLocationData = geoLiveLocation.ConvertToGeoTagList();
                geoTagList.List = LiveLocationData;
            }
            else
            {
                ResultsManager.AddResultInfo(geoTagList, ResultTypeEnum.AuthError,
                                             "You are not authorized to view locations for this profile");
            }

            return(geoTagList);
        }