Ejemplo n.º 1
0
        public string DiscoverySearchGplus(string UserId, string keyword)
        {
            List <Domain.Myfashion.Domain.DiscoverySearch> GplusDiscoverySearch = new List <Domain.Myfashion.Domain.DiscoverySearch>();
            string profileid = string.Empty;

            try
            {
                string searchResultObj = GplusDiscoverySearchHelper.GooglePlus(keyword);
                GooglePlusAccountRepository gplusAccRepo = new GooglePlusAccountRepository();
                ArrayList alst = gplusAccRepo.getAllGooglePlusAccounts();

                GlobusGooglePlusLib.Authentication.oAuthToken oauth = new GlobusGooglePlusLib.Authentication.oAuthToken();
                GooglePlusActivities obj = new GooglePlusActivities();

                JObject GplusActivities = JObject.Parse(GplusDiscoverySearchHelper.GooglePlus(keyword));

                foreach (JObject gobj in JArray.Parse(GplusActivities["items"].ToString()))
                {
                    Domain.Myfashion.Domain.DiscoverySearch gpfeed = new Domain.Myfashion.Domain.DiscoverySearch();
                    gpfeed.Id = Guid.NewGuid();

                    try
                    {
                        gpfeed.MessageId       = gobj["url"].ToString();
                        gpfeed.CreatedTime     = DateTime.Parse(gobj["published"].ToString());
                        gpfeed.Message         = gobj["title"].ToString();
                        gpfeed.FromId          = gobj["actor"]["id"].ToString();
                        gpfeed.FromName        = gobj["actor"]["displayName"].ToString();
                        gpfeed.ProfileImageUrl = gobj["actor"]["image"]["url"].ToString();
                    }
                    catch { }

                    GplusDiscoverySearch.Add(gpfeed);
                }
            }
            catch { }
            return(new JavaScriptSerializer().Serialize(GplusDiscoverySearch));
        }