Example #1
0
        public void GetGooglePlusComments(string feedId, string AccessToken, string profileId)
        {
            oAuthTokenGPlus ObjoAuthTokenGPlus = new oAuthTokenGPlus();

            Domain.Socioboard.MongoDomain.GoogleplusComments _GoogleplusComments = new Domain.Socioboard.MongoDomain.GoogleplusComments();
            try
            {
                string  _Comments  = ObjoAuthTokenGPlus.APIWebRequestToGetUserInfo(Globals.strGetCommentListByActivityId.Replace("[ActivityId]", feedId) + "?key=" + ConfigurationManager.AppSettings["Api_Key"].ToString(), AccessToken);
                JObject J_Comments = JObject.Parse(_Comments);
                List <Domain.Socioboard.MongoDomain.GoogleplusComments> lstGoogleplusComments = new List <Domain.Socioboard.MongoDomain.GoogleplusComments>();
                foreach (var item in J_Comments["items"])
                {
                    try
                    {
                        _GoogleplusComments.Id           = ObjectId.GenerateNewId();
                        _GoogleplusComments.Comment      = item["object"]["content"].ToString();
                        _GoogleplusComments.CommentId    = item["id"].ToString();
                        _GoogleplusComments.CreatedDate  = Convert.ToDateTime(item["published"]).ToString("yyyy/MM/dd HH:mm:ss");
                        _GoogleplusComments.FeedId       = feedId;
                        _GoogleplusComments.FromId       = item["actor"]["id"].ToString();
                        _GoogleplusComments.FromImageUrl = item["actor"]["image"]["url"].ToString();
                        _GoogleplusComments.FromName     = item["actor"]["url"].ToString();
                        _GoogleplusComments.FromUrl      = item["actor"]["url"].ToString();
                        _GoogleplusComments.GplusUserId  = profileId;

                        lstGoogleplusComments.Add(_GoogleplusComments);

                        //if (!objGoogleplusCommentsRepository.IsExist(_GoogleplusComments.CommentId))
                        //{
                        //    objGoogleplusCommentsRepository.Add(_GoogleplusComments);
                        //}
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }
                }

                gplusCommentRepo.AddList(lstGoogleplusComments);
            }
            catch (Exception ex)
            {
            }
        }
        public void GetGooglePlusComments(string feedId, string AccessToken, string profileId)
        {
            oAuthTokenGPlus ObjoAuthTokenGPlus = new oAuthTokenGPlus();

            Domain.Socioboard.MongoDomain.GoogleplusComments _GoogleplusComments = new Domain.Socioboard.MongoDomain.GoogleplusComments();
            try
            {
                string _Comments = ObjoAuthTokenGPlus.APIWebRequestToGetUserInfo(Globals.strGetCommentListByActivityId.Replace("[ActivityId]", feedId) + "?key=" + ConfigurationManager.AppSettings["Api_Key"].ToString(), AccessToken);
                JObject J_Comments = JObject.Parse(_Comments);
                List<Domain.Socioboard.MongoDomain.GoogleplusComments> lstGoogleplusComments = new List<Domain.Socioboard.MongoDomain.GoogleplusComments>();
                foreach (var item in J_Comments["items"])
                {
                    try
                    {
                        _GoogleplusComments.Id = ObjectId.GenerateNewId();
                        _GoogleplusComments.Comment = item["object"]["content"].ToString();
                        _GoogleplusComments.CommentId = item["id"].ToString();
                        _GoogleplusComments.CreatedDate = Convert.ToDateTime(item["published"]).ToString("yyyy/MM/dd HH:mm:ss");
                        _GoogleplusComments.FeedId = feedId;
                        _GoogleplusComments.FromId = item["actor"]["id"].ToString();
                        _GoogleplusComments.FromImageUrl = item["actor"]["image"]["url"].ToString();
                        _GoogleplusComments.FromName = item["actor"]["url"].ToString();
                        _GoogleplusComments.FromUrl = item["actor"]["url"].ToString();
                        _GoogleplusComments.GplusUserId = profileId;

                        lstGoogleplusComments.Add(_GoogleplusComments);

                        //if (!objGoogleplusCommentsRepository.IsExist(_GoogleplusComments.CommentId))
                        //{
                        //    objGoogleplusCommentsRepository.Add(_GoogleplusComments);
                        //}

                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }
                }

                gplusCommentRepo.AddList(lstGoogleplusComments);

            }
            catch (Exception ex)
            {
            }

        }