/// <summary>
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public async Task <ProfileLiteList> GetBuddiesToLocate(string userID)
        {
            long UserID  = Convert.ToInt64(userID);
            var  oReturn = new ProfileLiteList();

            string liveUserID = WebOperationContext.Current.IncomingRequest.Headers["LiveUserID"];
            //TODO: remove userID as input and continue with liveuserid
            bool isAuthorized = await _authService.ValidUserAccess(liveUserID, UserID);

            if (isAuthorized)
            {
                List <ProfileLite> budList = await GetLocateBuddies(UserID);

                if (budList != null && budList.Count > 0)
                {
                    oReturn.List = budList;
                }
                else
                {
                    ResultsManager.AddResultInfo(oReturn, ResultTypeEnum.Error,
                                                 "Dependent List not loaded for UserID:" + userID);
                }
            }
            else
            {
                ResultsManager.AddResultInfo(oReturn, ResultTypeEnum.AuthError,
                                             "You are not authorized to access this method");
            }

            return(oReturn);
        }
Beispiel #2
0
        private void GetLocateMembersList(ProfileLiteList oLocateMembersList)
        {
            try
            {
                if (oLocateMembersList == null && LocationServiceWrapper.IsErrorOccured == true)
                {
                    this.Message = "We are having issues in retrieving your data. Please try again later.";
                }
                else if ((oLocateMembersList == null || oLocateMembersList.List == null || oLocateMembersList.List.Count == 0) && (this.LocateBuddies.Count < 1))
                {
                    this.Message = "You have no buddies to track.";
                    ClearLocateBuddies();
                }
                else if (oLocateMembersList != null && oLocateMembersList.List != null)
                {
                    foreach (var item in oLocateMembersList.List)//.OrderByDescending(b => b.IsSOSOn).ThenByDescending(b => b.IsTrackingOn))
                    {
                        string backStatusColor = item.IsSOSOn ? Constants.SaffronColorCode : (item.IsTrackingOn ? Constants.GreenColorCode : Constants.WhiteColorCode);
                        int    order           = item.IsSOSOn ? 6 : (item.IsTrackingOn ? 4 : 2);//These numbers are used for Border Thickness as well.
                        var    buddy           = new LocateBuddyTableEntity()
                        {
                            BuddyProfileId = item.ProfileID.ToString(), Name = item.Name, Email = item.Email, PhoneNumber = item.MobileNumber, BuddyStatusColor = backStatusColor, TrackingToken = item.SessionID, OrderNumber = order, BorderThickness = new Thickness(order)
                        };

                        UpdateLocateBuddy(buddy);

                        if (item.LastLocs != null && item.LastLocs.Count > 0)
                        {
                            GetLocationAddressAsync(item.LastLocs, item.ProfileID.ToString());//TODO: Optimize
                        }
                    }

                    if (this.LocateBuddies.Count > 0)
                    {
                        if (this.LocateBuddies.Count != oLocateMembersList.List.Count)
                        {
                            DeleteLocateBuddies(oLocateMembersList.List);
                        }

                        this.LocateBuddies.Sort(b => b.OrderNumber, ListSortDirection.Descending);
                    }
                }
            }
            catch (Exception)
            {
                CallErrorHandler();
            }
            IsInProgress = false;
        }
Beispiel #3
0
        public async Task <ResultInfo> DeleteMarshal(string AdminID, string groupID, string marshalProfileID)
        {
            int  GroupID          = Convert.ToInt32(groupID);
            long MarshalProfileID = Convert.ToInt64(marshalProfileID);

            var result = new ResultInfo();

            try
            {
                if (string.IsNullOrEmpty(AdminID) || GroupID == 0 || MarshalProfileID == 0)
                {
                    result.ResultType = ResultTypeEnum.Error;
                    result.Message    = "Marshal Not Deleted.Invalid IDs !";
                }
                else if (MarshalValidationsForBuddy(AdminID, GroupID, MarshalProfileID, 0, false))
                {
                    ProfileLiteList locateBuddies =
                        await _LocationService.GetBuddiesToLocateByProfileID(marshalProfileID);

                    if (locateBuddies == null || locateBuddies.List.Count == 0)
                    {
                        bool isMarshalDeleted = await _GroupRepository.DeleteMarshal(GroupID, MarshalProfileID);

                        if (isMarshalDeleted)
                        {
                            result.ResultType = ResultTypeEnum.Success;
                            result.Message    = "Marshal Deleted";
                        }
                    }
                    else
                    {
                        result.ResultType = ResultTypeEnum.Error;
                        result.Message    = "Marshal can not be deleted As People have added him as a buddy";
                    }
                }
                else
                {
                    result.ResultType = ResultTypeEnum.Error;
                    result.Message    = "Failed";
                }
            }
            catch (Exception e)
            {
                result.ResultType = ResultTypeEnum.Exception;
                result.Message    = "Failed-" + e.Message;
            }
            return(result);
        }
        /// <summary>
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="dummyTicks"></param>
        /// <returns></returns>
        public async Task <ProfileLiteList> GetBuddiesToLocateLastLocation(string userID, string dummyTicks)
        {
            long UserID = Convert.ToInt64(userID);

            string liveUserID = WebOperationContext.Current.IncomingRequest.Headers["LiveUserID"];

            bool isAuthorized = await _authService.ValidUserAccess(liveUserID, UserID);

            var profileLiteList = new ProfileLiteList();

            if (isAuthorized)
            {
                profileLiteList.List = await GetLocateBuddies(UserID);
            }
            else
            {
                ResultsManager.AddResultInfo(profileLiteList, ResultTypeEnum.AuthError,
                                             "You are not authorized to access this method");
            }

            return(profileLiteList);
        }
        public static async Task <bool> GetLocateMembersAsync(Action <ProfileLiteList> target)
        {
            IsErrorOccured = false;
            try
            {
                var       uri   = new Uri(string.Format(Constants.LocateBuddiesUrl, Globals.User.UserId, DateTime.Now.Ticks.ToString()));
                WebClient proxy = new WebClient();
                proxy.Headers[HttpRequestHeader.CacheControl] = "no-cache;";
                proxy.Headers["AuthID"] = Globals.User.LiveAuthId;
                string result = await proxy.DownloadStringTask(uri);

                DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(ProfileLiteList));
                MemoryStream    ms             = new MemoryStream(Encoding.UTF8.GetBytes(result));
                ProfileLiteList profileList    = (ProfileLiteList)ser.ReadObject(ms);

                target(profileList);
            }
            catch (Exception)
            {
                IsErrorOccured = true;
            }
            return(true);
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            bool IsSOSOn = false;

            try
            {
                //Write
                //ActivateSosPost2Server();

                string URL  = "http://guardianservice.cloudapp.net/LocationService.svc/GetBuddiesToLocate/2";
                string URL1 = "http://guardianservice.cloudapp.net/MembershipService.svc/GetAllSOSMembers/rajinikanth";
                //Read
                WebClient client = new WebClient();
                client.Headers[HttpRequestHeader.CacheControl] = "no-cache;";
                string st = client.DownloadString(new Uri(URL));

                DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(ProfileLiteList));
                MemoryStream    ms             = new MemoryStream(Encoding.UTF8.GetBytes(st));
                ProfileLiteList profile        = (ProfileLiteList)ser.ReadObject(ms);

                //DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(ProfileLiteList));
                //var list = (ProfileLiteList)ser.ReadObject(st);
                string str = string.Empty;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            int sendEmail = 0, sendSMS = 0, sendFbPosting = 0;
            //if (sendSMS == 1)
            //{
            //    try
            //    {

            //        //Utility.SendSMSTwilio();
            //        //Utility.SendSMSUbaid("site2sms", "9949091097", "venkat", "TEST: I'm in serious trouble. Urgently need your help! I'm currently @ Microsoft, Gachibowli, Hyderabad, AP, India 500082. Track me: http://lvry.vs/xbl (dummy url)", "7702690004");
            //        //Utility.SendSMSUbaid("site2sms", "9949091097", "venkat", "TEST: I'm in serious trouble. Urgently need your help! I'm currently @ Microsoft, Gachibowli, Hyderabad, AP, India 500082. Track me: http://lvry.vs/xbl (dummy url)", "9985121428");
            //        //int returnCode = Utility.SendSMSUbaid("160by2","9949091097", "venkat", "from VR. from 160by2. let me know, if you receive it", "9989025002");//
            //        //Utility.SendSMSViaWay2SMS("9949091097", "venkat", "Guardian test SMS from Worker Role", "9949091097");

            //        Utility.SendSMSviaVFirst("TEST via vFirst: SOS: Urgent help needed! I'm @ Microsoft, Gachibowli, Hyderabad, AP, India 500082.", "9949091097", "9989025002, 9502751602");//Track me:http://lvry.vs/xbl 9985121428, 7702690004,
            //        Console.WriteLine("SMS has been sent successfully");

            //        //Utility.SendSMS("9949091097", "venkat", "I love you", "9676223499");
            //        //Utility.SendSMS("9949091097", "venkat", "Guardian test SMS from Worker Role", "9949091097");
            //        //Console.WriteLine("SMS has been sent successfully");
            //    }
            //    catch (Exception ex)
            //    {
            //        Console.WriteLine("Error occurred while sending SMS. Details: " + ex.Message);
            //    }
            //}

            //if (sendEmail == 1)
            //{
            //    try
            //    {
            //        //Utility.SendMail();
            //        //Console.WriteLine("Email has been sent successfully");
            //        FaceBookPosting();
            //        //Utility.SendMailViaLiveAccount();
            //        //Utility.SendMailViaGmailAccount();
            //        //Console.WriteLine("Email has been sent successfully");
            //    }
            //    catch (Exception ex)
            //    {
            //        Console.WriteLine("Error occurred while sending email. Details: " + ex.Message);
            //    }
            //}

            //if (sendFbPosting == 1)
            //{
            //    try
            //    {
            //        FaceBookPosting();
            //    }
            //    catch (Exception ex)
            //    {
            //        Console.WriteLine("Error occurred while sending FB posting. Details: " + ex.Message);
            //    }
            //}
        }
Beispiel #7
0
 public void GroupBuddiesToLocateTest()
 {
     LocationService ls  = new LocationService();
     ProfileLiteList pll = ls.GetBuddiesToLocate("1").Result as ProfileLiteList;
     string          str = "";
 }