public async Task <IActionResult> Create([Bind("Weight,Price,Cart,Size,Description,Amount,Discount,Id,Diamonds,ImagePath,Name,CategoryId,SetId")] Jewelry jewelry)
        {
            if (Account.isAdmin(User))
            {
                if (ModelState.IsValid)
                {
                    _context.Add(jewelry);
                    await _context.SaveChangesAsync();

                    string postToFacebook = ("התכשיט " + jewelry.Name + " נוסף לחנות. יש " + jewelry.Amount + " פריטים. היכנסו לאתר בשביל לקנות");

                    FacebookPost post = new FacebookPost();

                    post.PublishToFacebookNoPhoto(postToFacebook);

                    return(RedirectToAction("Index"));
                }

                ViewData["CategoryId"] = new SelectList(_context.Category, "Id", "Name", jewelry.CategoryId);
                ViewData["SetId"]      = new SelectList(_context.JewelrySet, "Id", "Name", jewelry.SetId);
                return(View(jewelry));
            }
            else
            {
                return(new RedirectToActionResult("NotAuthorized", "Home", null));
            }
        }
        public async Task <IActionResult> Create([Bind("Name,Address,CoordinateLat,CoordinateLng,ManagerId,Id")] Branch branch)
        {
            if (Account.isAdmin(User))
            {
                if (ModelState.IsValid)
                {
                    _context.Add(branch);
                    await _context.SaveChangesAsync();

                    string postToFacebook = ("החנות " + branch.Name + " התווספה. מוזמנים לבקר בכתובת " + branch.Address + ". בואו בהמוניכם !!!");

                    FacebookPost post = new FacebookPost();

                    post.PublishToFacebookNoPhoto(postToFacebook);

                    return(RedirectToAction("Index"));
                }

                ViewData["ManagerId"] = new SelectList(_context.Users, "Id", "Id", branch.ManagerId);

                return(View(branch));
            }
            else
            {
                return(new RedirectToActionResult("NotAuthorized", "Home", null));
            }
        }
Ejemplo n.º 3
0
        public HttpResponseMessage AddFacebookPost(FacebookPost facebookPost)
        {
            var response = this.Request.CreateResponse(HttpStatusCode.OK);

            try
            {
                var customerguid = Request.Headers.GetValues("CustomerGUID").FirstOrDefault();
                if (customerguid != null)
                {
                    var cust = _customerService.GetCustomerByGuid(Guid.Parse(customerguid));
                    if (facebookPost.CustomerId != cust.Id)
                    {
                        return(Request.CreateResponse(HttpStatusCode.Unauthorized, new { code = 0, Message = "something went wrong" }));
                    }
                }
                if (facebookPost.VideoLink == "")
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "Invalid Url", data = "" }));
                }
                facebookPost.CustomerId  = facebookPost.CustomerId;
                facebookPost.NoOfLikes   = 0;
                facebookPost.Price       = 0;
                facebookPost.IsPaid      = false;
                facebookPost.Deleted     = false;
                facebookPost.CreatedDate = DateTime.Now;
                facebookPost.Approved    = false;
                var facebookpost = _adCampaignService.AddUpdateFacebookPost(facebookPost);
                return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "success", data = facebookpost }));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "Some thing went wrong" }));
            }
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            IFConfiguration config = new IFConfiguration();

            config.Subscription = "cnn";
            // update does not work because of https://newsroom.fb.com/news/2018/03/cracking-down-on-platform-abuse/

            FacebookSubscription subscription = config.GetSubscription();

            Console.WriteLine(subscription.Name);
            Console.WriteLine(subscription.Id);

            FacebookPost[] posts = config.GetPosts();
            for (int i = 0;
                 i < posts.Length && i < 300;
                 i++)
            {
                FacebookPost facebookPost = posts[i];
                Console.WriteLine(facebookPost.Message);
            }
            Console.WriteLine(config.GetPicture().Url);
            Console.WriteLine(config.GetPhotos()[3].CreationDate);
            Console.WriteLine(config.GetVideos()[3].UpdateDate);
            Console.WriteLine(config.GetAlbums()[3].Name);
            Console.WriteLine(config.GetEvents()[0].EndTime);
            Console.WriteLine(config.GetPosts()[0].Id.GetLink());
            Console.WriteLine(config.GetPosts()[0].Id.GetNumberShares());
            Console.WriteLine(config.GetPosts()[0].Id.GetPicture());
            Console.WriteLine(config.GetVideos()[0].Id.GetSource());
            Console.WriteLine(config.GetPosts()[0].Id.GetNumberLikes());
            Console.WriteLine(config.GetPosts()[0].Id.GetNumberComments());

            Console.ReadLine();
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> ProcessFacebookPostForm(FacebookPost facebookPost)
        {
            await _facebookPostRepository.AddAysnc(facebookPost);

            await _facebookPostRepository.SaveAsync();

            return(RedirectToAction("LoadFacebookManagement", "Admin"));
        }
        public ActionResult SiteStatus(bool?showErrors)
        {
            List <string> model = new List <string>();

            model.Add(SiteStatusString("Newsletters count:  ", showErrors, () =>
            {
                IEnumerable <Newsletter> newsletters = Repository.GetNewslettersAsync().Result;
                return(newsletters.Count().ToString());
            }));

            model.Add(SiteStatusString("Newest Facebook Post: ", showErrors, () =>
            {
                FacebookPost facebookPost = Repository.GetNewestFacebookPost().Result;
                return(facebookPost.Content);
            }));

            model.Add(SiteStatusString("TwitterFeed: ", showErrors, () =>
            {
                string tweet    = LoadTwitterPosts().Result.FirstOrDefault()?.Content;
                int postBracket = tweet != null ? tweet.IndexOf("<") : -1;
                return(postBracket != -1 ? tweet.Substring(0, postBracket) : tweet);
            }));

            Post post = null;

            model.Add(SiteStatusString("Hub DB access, post key: ", showErrors, () =>
            {
                post = Repository.GetPostAsync("2017FLNR0208-001391").Result;
                return(post.Key);
            }));

            model.Add(SiteStatusString("Media proxy url: ", showErrors, () =>
            {
                var client = new System.Net.Http.HttpClient();
                client.DefaultRequestHeaders.Referrer = new Uri(string.Concat(Request.Scheme, "://", Request.Host.ToUriComponent(), Request.PathBase.ToUriComponent(), Request.Path, Request.QueryString));

                var result = client.GetAsync(post.AssetUrl).Result.ReasonPhrase;

                if (result != "OK")
                {
                    throw new Exception(result);
                }
                return("OK");
            }));

            model.Add(SiteStatusString("Post cache size: ", showErrors, () =>
            {
                return(Repository._cache[typeof(Post)].Count().ToString());
            }));

            model.Add(SiteStatusString("Facebook Post cache size: ", showErrors, () =>
            {
                return(Repository._cache[typeof(FacebookPost)].Count().ToString());
            }));

            return(View("SiteStatus", model));
        }
Ejemplo n.º 7
0
        public void AddFacebookComment(FacebookUser fbUser, string comment, PublishedArticles article)
        {
            var fbPost = new FacebookPost();

            fbPost.articleId  = article.articleId;
            fbPost.facebookId = fbUser.facebookId;
            fbPost.post       = comment;

            _dataModel.AddToFacebookPosts(fbPost);
        }
Ejemplo n.º 8
0
        public static SocialImage ReturnSocialImage(FacebookPost item)
        {
            SocialImage s = new SocialImage();

            s.Image      = item.Picture;
            s.Date       = item.CreatedTime;
            s.Caption    = item.Description;
            s.SocialLink = item.Link;
            return(s);
        }
Ejemplo n.º 9
0
        public static string PosterUrl(this FacebookPost facebookPost)
        {
            int posterIdx = facebookPost.Key.IndexOf("facebook.com/"); // facebookPost.Key is the postUrl

            if (posterIdx != -1)
            {
                posterIdx = facebookPost.Key.IndexOf('/', posterIdx + "facebook.com/".Length);
            }
            return(posterIdx != -1 ? facebookPost.Key.Substring(0, posterIdx) : null);
        }
Ejemplo n.º 10
0
 public FacebookPost AddUpdateFacebookPost(FacebookPost facebookPost)
 {
     if (facebookPost.Id > 0)
     {
         _facebookRepository.Update(facebookPost);
         return(facebookPost);
     }
     else
     {
         _facebookRepository.Insert(facebookPost);
         return(facebookPost);
     }
 }
        public async Task LoadSocialFeeds(ListViewModel model)
        {
            model.FacebookPosts = new List <FacebookPost>();

            FacebookPost facebookPost = await Repository.GetNewestFacebookPost();

            if (facebookPost != null)
            {
                model.FacebookPosts.Add(facebookPost);
            }

            model.TwitterPosts = await LoadTwitterPosts();
        }
        public async Task <IActionResult> Edit(int id, [Bind("Weight,Price,Cart,Size,Description,Amount,Discount,Id,Diamonds,ImagePath,Name,CategoryId,SetId")] Jewelry jewelry)
        {
            if (id != jewelry.Id)
            {
                return(NotFound());
            }

            if (Account.isAdmin(User))
            {
                if (ModelState.IsValid)
                {
                    try
                    {
                        ColmanInternetiotContext newContext = new ColmanInternetiotContext();

                        int?currAmount = newContext.Jewelry.First(x => x.Id == jewelry.Id).Amount;

                        _context.Update(jewelry);
                        await _context.SaveChangesAsync();

                        if (currAmount != null)
                        {
                            string postToFacebook = ("לתכשיט " + jewelry.Name + " נוספו " + (jewelry.Amount - int.Parse(currAmount.ToString())) + " פריטים חדשים. היכנסו לאתר בשביל לקנות");

                            FacebookPost post = new FacebookPost();

                            post.PublishToFacebookNoPhoto(postToFacebook);
                        }
                    }
                    catch (DbUpdateConcurrencyException)
                    {
                        if (!JewelryExists(jewelry.Id))
                        {
                            return(NotFound());
                        }
                        else
                        {
                            throw;
                        }
                    }
                    return(RedirectToAction("Index"));
                }
                ViewData["CategoryId"] = new SelectList(_context.Category, "Id", "Name", jewelry.CategoryId);
                ViewData["SetId"]      = new SelectList(_context.JewelrySet, "Id", "Name", jewelry.SetId);
                return(View(jewelry));
            }
            else
            {
                return(new RedirectToActionResult("NotAuthorized", "Home", null));
            }
        }
Ejemplo n.º 13
0
        private void UpdatePostDetails(FacebookPost post, FacebookDataProvider provider, Repository repository)
        {
            var likesAndUsers = provider.GetLikesAndUsersForPostFromFacebook(post.ExternalKey);

            foreach (var like in likesAndUsers.Item1)
            {
                repository.LikesAdd(like);
            }

            foreach (var user in likesAndUsers.Item2)
            {
                repository.UsersAddOrUpdate(user);
            }
        }
Ejemplo n.º 14
0
        static string GetEmbeddedFacebookHtmlString(FacebookPost facebookPost)
        {
            return("<div class='feature-post' style='display: block;'>" +
                   "<div class='facebook-post' style='position: relative;'>" +
                   "<div class='facebook-article'>" +
                   "<div class='feed-header'>" +
                   "<a href='" + facebookPost.PosterUrl() + "' target='_blank' class='link-button facebook-like'>Like on Facebook</a>" +
                   "<h5>" +
                   "<img src='" + facebookPost.PosterLogo.ToUri().ToProxyUrl() + "' />" +
                   facebookPost.Poster + "<br />" +

                   "<span class='post-details' style='padding:0'>" + facebookPost.PosterSubtitle + " &#9679;" + string.Format("{0:n0}", facebookPost.PosterLikes) + " Likes</span>" +
                   "</h5>" +
                   "</div>" +
                   "<div class='clearfix'></div>" +

                   "<div style='float:left; margin:10px;display:none;'>" +
                   "<img src='" + facebookPost.PosterLogo.ToUri().ToProxyUrl() + "' /><br />" +
                   "<span class='post-details' style='padding-left:0; padding-top:5px;'>" + facebookPost.PosterSubtitle + "</span>" +                      /*@* TODO &#9679; @string.Format("{0:n0}", Model.FacebookPost.PosterLikes) Likes*@*/
                   "</div>" +
                   //(facebookPost.Type == "photo" && !string.IsNullOrWhiteSpace(facebookPost.PictureUrl) ? "<img src='" + facebookPost.PostImageFileName + "'/><br />" : "") +
                   ConvertUrlsToLinks(facebookPost.Content).Replace("\n", "<br />").AsHtmlParagraphs() +

                   "<div class='clearfix'></div>" +
                   "\n<div class='sharing-options'><ul>" +

                   /*  <li class="facebook-action facebook-like" data-facebook-object-id="facebookPost.FacebookObjectId"><a href = "#" > Like </ a ></ li >
                    *  < li class="facebook-action facebook-comment"><a href = "#" > Comment </ a ></ li >
                    *      < li class="facebook-action facebook-share" data-url="facebookPost.PosterUrl()"><a href = "#" > Share </ a ></ li >
                    *      </ ul >
                    *  </ div > *@*/
                   /* "<div class='facebook-comment-dialog'>" +
                    *   "<textarea id='facebook-comment-message-1' placeholder='Comment on this story'></textarea>" +
                    *   "<input type='submit' class='facebook-comment-trigger' data-slider-id='1' data-facebook-object-id='" + facebookPost.FacebookObjectId + "' value='Comment' />" +
                    *   "<a class='facebook-comment-close' href='#'>Close</a>" */
                   "<li class='facebook-info'><a href = '" + facebookPost.Key + "' target='_blank'>Like or Comment<span class='on-story'> on this post</span><span class='on-facebook'> on Facebook</span></a></li>" +
                   "</ul ></div >" +
                   "</div>" +
                   "</div>" +
                   "</div>");
        }
Ejemplo n.º 15
0
        public static Post ConvertFacebookPostToPost(FacebookPost fbPost, string defaultTitle)
        {
            if (fbPost == null)
            {
                throw new ArgumentNullException(nameof(fbPost));
            }

            return(new Post
            {
                Title = fbPost.Story ?? defaultTitle,
                Content = "<p>" + fbPost.Message + "</p>",
                CreatedDate = DateTime.Parse(fbPost.Created_time),
                IsPublic = true,
                PostType = PostType.Facebook,
                UserId = 1,
                DurationInSeconds = 10,
                IsDeleted = false,
                PostFiles = new List <PostFile>(),
                Priority = PostPriority.Normal
            });
        }
Ejemplo n.º 16
0
        public HttpResponseMessage GetFacebookPosts(int CustomerId)
        {
            var customerguid = Request.Headers.GetValues("CustomerGUID").FirstOrDefault();

            if (customerguid != null)
            {
                var cust = _customerService.GetCustomerByGuid(Guid.Parse(customerguid));
                if (CustomerId != cust.Id)
                {
                    return(Request.CreateResponse(HttpStatusCode.Unauthorized, new { code = 0, Message = "something went wrong" }));
                }
            }
            var response = this.Request.CreateResponse(HttpStatusCode.OK);

            try
            {
                List <FacebookPost> list = new List <FacebookPost>();
                var facebookPosts        = _adCampaignService.GetFacebookPost(false, true, CustomerId, 0, int.MaxValue).ToList();
                foreach (var fblink in facebookPosts)
                {
                    FacebookPost fp = new FacebookPost();
                    fp.VideoLink   = fblink.VideoLink;
                    fp.CustomerId  = fblink.CustomerId;
                    fp.NoOfLikes   = fblink.NoOfLikes;
                    fp.IsPaid      = fblink.IsPaid;
                    fp.Approved    = fblink.Approved;
                    fp.Price       = fblink.Price;
                    fp.CreatedDate = fblink.CreatedDate;
                    list.Add(fp);
                }

                return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "success", data = list }));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "Some thing went wrong" }));
            }
        }
Ejemplo n.º 17
0
        public async Task LoadPosts() 

        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            Posts.Clear();
            FacebookResponse <string> post = await CrossFacebookClient.Current.QueryDataAsync("me/feed", new string[] { "user_posts" });

            var jo = JObject.Parse(post.Data); 


            if (jo.ContainsKey("data"))
            {
                var array = ((JArray)jo["data"]);
                foreach (var item in array)
                {
                    var postData = new FacebookPost();

                    if (item["message"] != null)
                    {
                        postData.Message = $"{item["message"]}";
                    }

                    if (item["story"] != null)
                    {
                        postData.Story = $"{item["story"]}";
                    }

                    Posts.Add(postData);
                }
            }

            IsBusy = false;
        }
        public IList <FacebookPost> FetchPostsFromFacebook()
        {
            string urlPattern = "https://graph.facebook.com/v2.9/{0}/feed?fields=reactions.limit(0).summary(true),type,caption,full_picture,icon,is_published,message,picture,updated_time,link,name,created_time,description,object_id,from,to&limit=50&access_token={1}";

            string pageId = "154009054780458";
            FacebookNewsContainer data = GetList <FacebookNewsContainer>(CreateAccessUrl(urlPattern, pageId));

            return(new List <FacebookPost>(
                       data.Data.Where(d => d.Reactions.Summary.TotalCount >= 10).Select(d =>
            {
                string content = d.Message + "\n\n" + d.Name + "\n\n" + d.Link;

                return new FacebookPost
                {
                    ExternalKey = d.ObjectId,
                    CreateDate = d.CreatedDate,
                    Content = content,
                    Likes = d.Reactions.Summary.TotalCount,
                    CreatorId = d.From.Id,
                    Tags = FacebookPost.ExtractTags(content),
                    LastUpdated = DateTime.Now
                };
            })));
        }
Ejemplo n.º 19
0
        /// <summary>
        /// valida si un cotizante esta afiliado a asofondos y retorna el código de estado de la administradora si lo está  o retorna cero si no lo está
        /// </summary>
        public static int validarAfiliacionAsofondos(FacebookPost post, string no_id, SqlConnection cn)
        {
            SqlCommand cmd = new SqlCommand();
            SqlDataAdapter da = new SqlDataAdapter();
            DataTable dt = new DataTable("Empleados");
            int valor = 0;
            try
            {
                cmd.Connection = cn;
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter parametro = new SqlParameter();
                cmd.Parameters.Add(new SqlParameter("@@nombre", post));

                cmd.CommandText = "procAdministradoras_asofondos_estadoSELECT";
                cmd.CommandTimeout = 0;
                da.SelectCommand = cmd;
                valor = (int)cmd.ExecuteScalar();
            }
            catch (Exception ex)
            {
                throw new Exception("No se pudo realizar la consulta, Intentelo nuevamente", ex);
            }
            return valor;
        }
Ejemplo n.º 20
0
 public FacebookPostTests()
 {
     sut = new FacebookPost();
 }
Ejemplo n.º 21
0
 public FacebookCardViewModel(FacebookPost post)
 {
     _facebookPost    = post;
     _facebookService = IocContainer.GetContainer().Resolve <IFacebookService> ();
     _facebookHelper  = IocContainer.GetContainer().Resolve <IFacebookHelper> ();
 }
Ejemplo n.º 22
0
        public void ProvidedContentShouldExtractTags(string content, string expectedTagsCommaSeparated)
        {
            var actaulTags = String.Join(",", FacebookPost.ExtractTags(content));

            Assert.Equal(expectedTagsCommaSeparated, actaulTags);
        }
Ejemplo n.º 23
0
 public static HtmlString RenderEmbeddedFacebookAsset(FacebookPost facebookPost)
 {
     return(new HtmlString(GetEmbeddedFacebookHtmlString(facebookPost)));
 }
Ejemplo n.º 24
0
 public FacebookComment(FacebookUser fbUser, FacebookPost fbPost)
 {
     FBuser = fbUser;
     FBPost = fbPost;
 }
Ejemplo n.º 25
0
        /// <summary>
        /// Facebook의 Search API를 이용하여 데이터 조회 
        /// </summary>
        /// <param name="keywordId">관심주제Id</param>
        /// <param name="keyword">관심주제</param>
        /// <param name="exceptKeyword">제외문자</param>
        /// <param name="pagingNext">최근 조회한 Facebook Post의 다음 Page 조회 Url</param>
        public void SearchFacebook(string keywordId, string keyword, string exceptKeyword, string pagingNext)
        {
            bool isFirstCall = string.IsNullOrEmpty(pagingNext); // Facebook API 최초 호출시에는 Paging Next Url을 사용하고 이후에는 Paging Previous Url 사용함
            string LastPagingNext = "";
            string prevPagingNext = "";
            string searchingUrl = "";
            int enQueuePost = 0;

            log.Info("Keyword is " + HttpUtility.UrlDecode(keyword, Encoding.UTF8));

            try
            {

                // Keyword Encoding
                //keyword = HttpUtility.UrlEncode(keyword.ToString().Trim(), Encoding.UTF8);

                // Facebook client 생성
                FacebookClient fb = new FacebookClient(_accessToken);

                // 검색 키워드 설정
                Dictionary<string, object> searchParams = new Dictionary<string, object>();
                searchParams.Add("type", "post");
                searchParams.Add("q", keyword.Trim());
                searchParams.Add("limit", "200");

                // 최종 검색결과 다음 페이지 조회 Url
                LastPagingNext = pagingNext;

                while (true)
                {

                    if (LastPagingNext.Length > 0)
                    {
                        if (LastPagingNext.IndexOf("&until") > 0 )
                        {
                            searchingUrl = LastPagingNext.Substring(LastPagingNext.IndexOf("&until"), LastPagingNext.Length - LastPagingNext.IndexOf("&until")).Replace("&access_token=" + this._accessToken, "");
                        }
                        else if (LastPagingNext.IndexOf("&since") > 0)
                        {
                            searchingUrl = LastPagingNext.Substring(LastPagingNext.IndexOf("&since"), LastPagingNext.Length - LastPagingNext.IndexOf("&since")).Replace("&access_token=" + this._accessToken, "");
                        }
                        else
                        {
                            searchingUrl = "";
                        }

                        log.Info("Keyword [" + HttpUtility.UrlDecode(keyword, Encoding.UTF8) + "] Searching - " + searchingUrl);
                    }

                    // 키워드 검색
                    dynamic searchResult = LastPagingNext.Length > 0 ? fb.Get(LastPagingNext) : fb.Get("/search", searchParams);

                    if (searchResult.data.Count > 0)
                    {
                        for (int i = 0; i <= searchResult.data.Count - 1; i++)
                        {
                            // 제외문자 검사
                            if (!CheckExceptKeywords(searchResult.data[i].message, exceptKeyword))
                            {
                                // 검색 결과 저장
                                FacebookPost f = new FacebookPost();

                                f.post_id = searchResult.data[i].id;
                                f.post_created_time = Convert.ToDateTime(searchResult.data[i].created_time).ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
                                f.post_message = searchResult.data[i].message;

                                f.from_id = searchResult.data[i].from.id;
                                f.from_name = searchResult.data[i].from.name;

                                this.enQueueResult(f);
                                enQueuePost++;
                            }
                        }

                        log.Info("Enqueue [" + HttpUtility.UrlDecode(keyword, Encoding.UTF8) + "] - " + enQueuePost.ToString());

                        // 검색결과 다음 페이지 조회 Url
                        if (isFirstCall)
                        {
                            // API 최초 호출시에는 Next 사용
                            LastPagingNext = searchResult.paging.next;

                            // API 재 호출시 사용할 이전 페이지 조회 Url 저장
                            if (string.IsNullOrEmpty(prevPagingNext))
                                prevPagingNext = searchResult.paging.previous;
                        }
                        else
                        {
                            // API 재 호출시에는 Previous 사용
                            LastPagingNext = searchResult.paging.previous;

                            prevPagingNext = searchResult.paging.previous;
                        }

                        // 다음 페이지 조회 Url 존재할 경우 Looping
                        if (LastPagingNext.Length > 0)
                        {
                            continue;
                        }
                        else
                        {
                            // 검색결과가 없을 경우 종료
                            break;
                        }
                    }
                    else
                    {
                        // 검색결과가 없을 경우 종료
                        if (string.IsNullOrEmpty(prevPagingNext))
                            prevPagingNext = LastPagingNext;

                        break;
                    }

                }

                log.Info("keyword is " + HttpUtility.UrlDecode(keyword, Encoding.UTF8) + " > Number of Search Result is " + this.searchResultPost.Count.ToString());

                // 조회 결과 관심글(Post) 저장
                this.deQueueResult(keywordId, prevPagingNext);

                log.Info("keyword is " + HttpUtility.UrlDecode(keyword, Encoding.UTF8) + " > Complete Search");
            }
            catch (Exception ex)
            {
                log.Error("keyword is " + HttpUtility.UrlDecode(keyword, Encoding.UTF8) + " > " + ex.ToString());
            }
        }
Ejemplo n.º 26
0
 /// <summary>
 /// 조회된 Post 건 별 Queue에 저장 
 /// </summary>
 /// <param name="t">조회된 Post</param>
 public void enQueueResult(FacebookPost t)
 {
     searchResultPost.Enqueue(t);
 }
Ejemplo n.º 27
0
    /*==========================================================================================================================
    | METHOD: GET GROUP VIEW (HELPER)
    \-------------------------------------------------------------------------------------------------------------------------*/
    /// <summary>
    ///   Centralized validation, model lookup, and view binding. 
    /// </summary>
    /// <remarks>
    ///   <para>
    ///     Provides a view model containing basic metadata necessary for the rendering of the server-side view (which, namely, 
    ///     includes metadata for search engines and Facebook's Open Graph schema.
    ///   </para>
    ///   <para>
    ///     Note: If the associated JSON file cannot be found, the view will redirect to the corresponding URL on Facebook. 
    ///     This may happen because the thread hasn't yet been indexed. It may also occur, however, if the IDs provided 
    ///     are invalid. In the latter case, Facebook will notify the user that this is the case by displaying an error.
    ///   </para>
    /// </remarks>
    /// <returns>A view containing all details of the requested current thread.</returns>
    private async Task<ActionResult> GetGroupView(long groupId, long postId = 0) {

      /*------------------------------------------------------------------------------------------------------------------------
      | If the post doesn't exist in the archive, redirect to Facebook
      \-----------------------------------------------------------------------------------------------------------------------*/
      if (!await ArchiveManager.StorageProvider.PostExistsAsync(groupId, postId)) {
        return Redirect("https://www.facebook.com/groups/" + groupId + "/permalink/" + postId);
      }

      /*------------------------------------------------------------------------------------------------------------------------
      | Retreive post
      \-----------------------------------------------------------------------------------------------------------------------*/
      dynamic json = await ArchiveManager.StorageProvider.GetPostAsync(groupId, postId);

      /*------------------------------------------------------------------------------------------------------------------------
      | Provide preprocessing of variables required by the view
      \-----------------------------------------------------------------------------------------------------------------------*/
      FacebookPost post = new FacebookPost(json);

      /*------------------------------------------------------------------------------------------------------------------------
      | Return data to view
      \-----------------------------------------------------------------------------------------------------------------------*/
      return View(post);

    }