コード例 #1
0
ファイル: Discovery.aspx.cs プロジェクト: utkarshx/socioboard
        public string BindData(DiscoverySearch dissearch, int i)
        {
            string message = string.Empty;
            if (dissearch.Network == "facebook")
            {
                message += "<li><div class=\"userpictiny\" id=\"messagetaskable_"+i+"\"><div style=\"width:60px;height:auto;float:left\">"+
                            "<img width=\"48\" height=\"48\" title=\""+dissearch.FromName+"\" alt=\""+dissearch.FromName+"\" src=\""+ dissearch.ProfileImageUrl+"\" onclick=\"detailsprofile(this.alt);\" id=\"formprofileurl_"+i+"\"><a title=\"\" class=\"userurlpic\" href=\"#\"><img width=\"16\" height=\"16\" alt=\"\" src=\"../Contents/img/fb_icon.png\">"+
                            "</a></div></div><div class=\"message-list-content\" id=\"messagedescription_"+i+"\">"+
                            "<div style=\"width:500px;height:auto;float:left\"><p>"+dissearch.Message +"</p>"+
                            "<div class=\"message-list-info\"><span><a onclick=\"detailsprofile(this.id);\" id=\"rowname_"+i+"\" href=\"#\">"+dissearch.FromName+"</a>&nbsp; "+dissearch.CreatedTime+"</span>"+
                            "</div></div></div></li>";
                i++;
            }
            else if (dissearch.Network == "twitter")
            {
                message += "<li><div class=\"userpictiny\" id=\"messagetaskable_" + i + "\"><div style=\"width:60px;height:auto;float:left\">" +
                            "<img width=\"48\" height=\"48\" title=\"" + dissearch.FromName + "\" alt=\"" + dissearch.FromId + "\" src=\"" + dissearch.ProfileImageUrl + "\" onclick=\"detailsprofile(this.alt);\" id=\"formprofileurl_" + i + "\"><a title=\"\" class=\"userurlpic\" href=\"#\"><img width=\"16\" height=\"16\" alt=\"\" src=\"../Contents/img/twticon.png\">" +
                            "</a></div></div><div class=\"message-list-content\" id=\"messagedescription_" + i + "\">" +
                            "<div style=\"width:500px;height:auto;float:left\"><p>" + dissearch.Message + "</p>" +
                            "<div class=\"message-list-info\"><span><a onclick=\"detailsprofile(this.id);\" id=\"rowname_" + i + "\" href=\"#\">" + dissearch.FromName + "</a> &nbsp;" + dissearch.CreatedTime + "</span>" +
                            "</div></div></div></li>";

            }
            return message;
        }
コード例 #2
0
ファイル: Discovery.aspx.cs プロジェクト: utkarshx/socioboard
        public string BindData(DiscoverySearch dissearch, int i)
        {
            string message = string.Empty;
            if (dissearch.Network == "facebook")
            {
                try
                {

                    //message += "<li><div class=\"userpictiny\" id=\"messagetaskable_"+i+"\"><div style=\"width:60px;height:auto;float:left\">"+
                    //            "<img width=\"48\" height=\"48\" title=\""+dissearch.FromName+"\" alt=\""+dissearch.FromName+"\" src=\""+ dissearch.ProfileImageUrl+"\" onclick=\"detailsprofile(this.alt);\" id=\"formprofileurl_"+i+"\"><a title=\"\" class=\"userurlpic\" href=\"#\"><img width=\"16\" height=\"16\" alt=\"\" src=\"../Contents/img/fb_icon.png\">"+
                    //            "</a></div></div><div class=\"message-list-content\" id=\"messagedescription_"+i+"\">"+
                    //            "<div style=\"width:500px;height:auto;float:left\"><p>"+dissearch.Message +"</p>"+
                    //            "<div class=\"message-list-info\"><span><a onclick=\"detailsprofile(this.id);\" id=\"rowname_"+i+"\" href=\"#\">"+dissearch.FromName+"</a> "+dissearch.CreatedTime+"</span>"+
                    //            "</div></div></div></li>";
                    //i++;

                    string[] msgId = dissearch.MessageId.Split('_');

                    message += "<li><div class=\"userpictiny\" id=\"messagetaskable_" + i + "\"><div style=\"width:60px;height:auto;float:left\">" +
                               "<img width=\"48\" height=\"48\" title=\"" + dissearch.FromName + "\" alt=\"" + dissearch.FromName + "\" src=\"" + dissearch.ProfileImageUrl + "\" onclick=\"detailsdiscoveryfacebook('" + msgId[0] + "');\" id=\"formprofileurl_" + i + "\"><a title=\"\" class=\"userurlpic\" href=\"#\"><img width=\"16\" height=\"16\" alt=\"\" src=\"../Contents/img/fb_icon.png\">" +
                               "</a></div></div><div class=\"message-list-content\" id=\"messagedescription_" + i + "\">" +
                               "<div style=\"width:500px;height:auto;float:left\"><p>" + dissearch.Message + "</p>" +
                               "<div class=\"message-list-info\"><span><a onclick=\"detailsdiscoveryfacebook('" + msgId[0] + "');\" id=\"rowname_" + i + "\" href=\"#\">" + dissearch.FromName + "</a> " + dissearch.CreatedTime + "</span>" +
                               "</div></div></div></li>";
                    i++;
                }
                catch (Exception ex)
                {

                    Console.WriteLine(ex.Message);
                }
            }
            else if (dissearch.Network == "twitter")
            {
                try
                {
                    //message += "<li><div class=\"userpictiny\" id=\"messagetaskable_" + i + "\"><div style=\"width:60px;height:auto;float:left\">" +
                    //            "<img width=\"48\" height=\"48\" title=\"" + dissearch.FromName + "\" alt=\"" + dissearch.FromName + "\" src=\"" + dissearch.ProfileImageUrl + "\" onclick=\"detailsprofile(this.alt);\" id=\"formprofileurl_" + i + "\"><a title=\"\" class=\"userurlpic\" href=\"#\"><img width=\"16\" height=\"16\" alt=\"\" src=\"../Contents/img/twticon.png\">" +
                    //            "</a></div></div><div class=\"message-list-content\" id=\"messagedescription_" + i + "\">" +
                    //            "<div style=\"width:500px;height:auto;float:left\"><p>" + dissearch.Message + "</p>" +
                    //            "<div class=\"message-list-info\"><span><a onclick=\"detailsprofile(this.id);\" id=\"rowname_" + i + "\" href=\"#\">" + dissearch.FromName + "</a> " + dissearch.CreatedTime + "</span>" +
                    //            "</div></div></div></li>";

                    message += "<li><div class=\"userpictiny\" id=\"messagetaskable_" + i + "\"><div style=\"width:60px;height:auto;float:left\">" +
                               "<img width=\"48\" height=\"48\" title=\"" + dissearch.FromName + "\" alt=\"" + dissearch.FromName + "\" src=\"" + dissearch.ProfileImageUrl + "\" onclick=\"detailsdiscoverytwitter('" + dissearch.FromId + "') ;\" id=\"formprofileurl_" + i + "\"><a title=\"\" class=\"userurlpic\" href=\"#\"><img width=\"16\" height=\"16\" alt=\"\" src=\"../Contents/img/twticon.png\">" +
                               "</a></div></div><div class=\"message-list-content\" id=\"messagedescription_" + i + "\">" +
                               "<div style=\"width:500px;height:auto;float:left\"><p>" + dissearch.Message + "</p>" +
                               "<div class=\"message-list-info\"><span><a onclick=\"detailsdiscoverytwitter('" + dissearch.FromId + "');\" id=\"rowname_" + i + "\" href=\"#\">" + dissearch.FromName + "</a> " + dissearch.CreatedTime + "</span>" +
                               "</div></div></div></li>";
                }
                catch (Exception ex)
                {

                    Console.WriteLine(ex.Message);
                }
            }
            return message;
        }
コード例 #3
0
 public void addNewSearchResult(DiscoverySearch dis)
 {
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             session.Save(dis);
             transaction.Commit();
         }
     }
 }
コード例 #4
0
 /// <addNewSearchResult>
 /// Add a new search result in a database.
 /// </summary>
 /// <param name="dis">Set Values in a DiscoverySearch Class Property and Pass the same Object of DiscoverySearch Class.(Domain.DiscoverySearch)</param>
 public void addNewSearchResult(DiscoverySearch dis)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             //Proceed action to save data.
             session.Save(dis);
             transaction.Commit();
         }//End Transaction
     }//End session
 }
コード例 #5
0
ファイル: Discovery.aspx.cs プロジェクト: utkarshx/socioboard
        public string getresults(string keyword)
        {
            User user = (User)Session["LoggedUser"];
            int i = 0;
            string searchRes = string.Empty;
            if (!string.IsNullOrEmpty(keyword))
            {
                DiscoverySearch dissearch = new DiscoverySearch();
                DiscoverySearchRepository dissearchrepo = new DiscoverySearchRepository();

                List<DiscoverySearch> discoveryList = dissearchrepo.getResultsFromKeyword(keyword);

                if (discoveryList.Count == 0)
                {

                    #region Twitter

                    try
                    {
                        oAuthTwitter oauth = new oAuthTwitter();
                        oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"].ToString();
                        oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"].ToString();
                        oauth.CallBackUrl = ConfigurationManager.AppSettings["callbackurl"].ToString();
                        TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                        ArrayList alst = twtAccRepo.getAllTwitterAccounts();
                        foreach (TwitterAccount item in alst)
                        {
                            oauth.AccessToken = item.OAuthToken;
                            oauth.AccessTokenSecret = item.OAuthSecret;
                            oauth.TwitterUserId = item.TwitterUserId;
                            oauth.TwitterScreenName = item.TwitterScreenName;
                            break;
                        }

                        Search search = new Search();
                        JArray twitterSearchResult = search.Get_Search_Tweets(oauth, keyword);

                        foreach (var item in twitterSearchResult)
                        {
                            var results = item["statuses"];

                            foreach (var chile in results)
                            {
                                try
                                {
                                    dissearch.CreatedTime = SocioBoard.Helper.Extensions.ParseTwitterTime(chile["created_at"].ToString().TrimStart('"').TrimEnd('"')); ;
                                    dissearch.EntryDate = DateTime.Now;
                                    dissearch.FromId = chile["user"]["id_str"].ToString().TrimStart('"').TrimEnd('"');
                                    dissearch.FromName = chile["user"]["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                                    dissearch.ProfileImageUrl = chile["user"]["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                                    dissearch.SearchKeyword = txtSearchText.Text;
                                    dissearch.Network = "twitter";
                                    dissearch.Message = chile["text"].ToString().TrimStart('"').TrimEnd('"');
                                    dissearch.MessageId = chile["id_str"].ToString().TrimStart('"').TrimEnd('"');
                                    dissearch.Id = Guid.NewGuid();
                                    dissearch.UserId = user.Id;

                                    if (!dissearchrepo.isKeywordPresent(dissearch.SearchKeyword, dissearch.MessageId))
                                    {
                                        dissearchrepo.addNewSearchResult(dissearch);
                                    }

                                    searchRes += this.BindData(dissearch, i);

                                    i++;
                                }
                                catch (Exception ex)
                                {
                                    logger.Error(ex.StackTrace);
                                    Console.WriteLine(ex.StackTrace);
                                }
                            }
                        }

                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                        Console.WriteLine(ex.StackTrace);
                    }
                    #endregion
                    #region Facebook
                    try
                    {
                        #region FacebookSearch
                        int j = 0;
                        string accesstoken = string.Empty;
                        FacebookAccountRepository fbAccRepo = new FacebookAccountRepository();
                        ArrayList asltFbAccount = fbAccRepo.getAllFacebookAccounts();
                        foreach (FacebookAccount item in asltFbAccount)
                        {
                            accesstoken = item.AccessToken;
                            break;
                        }

                        string facebookSearchUrl = "https://graph.facebook.com/search?q=" + txtSearchText.Text + " &type=post&access_token="+accesstoken;
                        var facerequest = (HttpWebRequest)WebRequest.Create(facebookSearchUrl);
                        facerequest.Method = "GET";
                        string outputface = string.Empty;
                        using (var response = facerequest.GetResponse())
                        {
                            using (var stream = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(1252)))
                            {
                                outputface = stream.ReadToEnd();
                            }
                        }
                        if (!outputface.StartsWith("["))
                            outputface = "[" + outputface + "]";

                        JArray facebookSearchResult = JArray.Parse(outputface);

                        foreach (var item in facebookSearchResult)
                        {
                            var data = item["data"];

                            foreach (var chile in data)
                            {
                                try
                                {
                                    dissearch.CreatedTime = DateTime.Parse(chile["created_time"].ToString());
                                    dissearch.EntryDate = DateTime.Now;
                                    dissearch.FromId = chile["from"]["id"].ToString();
                                    dissearch.FromName = chile["from"]["name"].ToString();
                                    dissearch.ProfileImageUrl = "http://graph.facebook.com/" + chile["from"]["id"] + "/picture?type=small";
                                    dissearch.SearchKeyword = txtSearchText.Text;
                                    dissearch.Network = "facebook";
                                    dissearch.Message = chile["message"].ToString();
                                    dissearch.MessageId = chile["id"].ToString();
                                    dissearch.Id = Guid.NewGuid();
                                    dissearch.UserId = user.Id;
                                    if (!dissearchrepo.isKeywordPresent(dissearch.SearchKeyword, dissearch.MessageId))
                                    {
                                        dissearchrepo.addNewSearchResult(dissearch);
                                    }
                                    searchRes += this.BindData(dissearch, i);
                                }
                                catch (Exception ex)
                                {
                                    logger.Error(ex.StackTrace);
                                    Console.WriteLine(ex.StackTrace);
                                }

                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                        Console.WriteLine(ex.StackTrace);
                    }
                        #endregion

                    #endregion
                }
                else
                {
                    foreach (DiscoverySearch item in discoveryList)
                    {
                        searchRes += this.BindData(item, i);
                        i++;
                    }
                }

            }
            return searchRes;
        }
コード例 #6
0
 public void deleteSearchResult(DiscoverySearch dis)
 {
     throw new NotImplementedException();
 }
コード例 #7
0
 public void updateNewSearchResult(DiscoverySearch dis)
 {
     throw new NotImplementedException();
 }
コード例 #8
0
ファイル: Discovery.aspx.cs プロジェクト: utkarshx/socioboard
        public string getlistresults(string keyword)
        {
            User user = (User)Session["LoggedUser"];
            int i = 0;
            string searchRes = string.Empty;
            if (!string.IsNullOrEmpty(keyword))
            {
                DiscoverySearch dissearch = new DiscoverySearch();
                DiscoverySearchRepository dissearchrepo = new DiscoverySearchRepository();

                List<DiscoverySearch> discoveryList = dissearchrepo.getResultsFromKeyword(keyword);

                if (discoveryList.Count == 0)
                {

                }
                else
                {
                    foreach (DiscoverySearch item in discoveryList)
                    {
                        searchRes += this.BindData(item, i);
                        i++;
                    }
                }

            }
            return searchRes;
        }
コード例 #9
0
ファイル: Discovery.aspx.cs プロジェクト: utkarshx/socioboard
 public string BindData(DiscoverySearch dissearch,int i)
 {
     string message = string.Empty;
     if (dissearch.Network == "facebook")
     {
         message += "<div  class=\"messages\"><section>" +
                                "<aside>" +
                                "<section data-sstip_class=\"twt_avatar_tip\" class=\"js-avatar_tip\">" +
                               "<a class=\"avatar_link view_profile\">" +
                               " <img width=\"54\" height=\"54\" border=\"0\" src=\"" + dissearch.ProfileImageUrl + "\" class=\"avatar\" id=\" " + dissearch.FromId + "\">" +
                                "<article class=\"message-type-icon\">" +
                                   "<span class=\"twitter_bm\">" +
                                       "<img width=\"16\" height=\"16\" src=\"../Contents/Images/fb_icon.png\">" +
                                       "</span>" +
                                  "</article>" +
                                        "</a>" +
                                  "</section>" +
                                   "<ul></ul>" +
                                         "</aside>" +
                                        "<article>" +
                             "<div class=\"\"><a href=\"\" class=\"language\"></a></div>" +
                             "<div class=\"message_actions\"><a href=\"#\" class=\"gear_small\"><span class=\"ficon\" title=\"Options\">?</span></a></div>" +
                             "<div class=\"message-text font-14\" id=\"messagedescription_1\">" + dissearch.Message + "</div>" +
                             "<section class=\"bubble-meta\">" +
                             "<article class=\"threefourth text-overflow\">" +
                               "<section class=\"floatleft\">" +
                                "<a data-sstip_class=\"twt_avatar_tip\" class=\"js-avatar_tip view_profile profile_link\">" +
                                 "<span id=\"rowname_" + i + "\">" + dissearch.FromName + "</span>" +
                                                "</a>&nbsp;" +
                                "<a title=\"View message on Twitter\" target=\"_blank\" class=\"time\" data-msg-time=\"1363926699000\">" + dissearch.CreatedTime + "</a>" +
                                "<span  class=\"location\">&nbsp;</span>" +
                                "</section>" +
                              "</article>" +
                              "<ul class=\"message-buttons quarter clearfix\">" +
                                       "</ul>" +
                             "</section>" +
                            "</article>" +
                           "</section></div>";
         i++;
     }
     else if (dissearch.Network == "twitter")
     {
         message += "<div  class=\"messages\"><section>" +
                                   "<aside>" +
                                   "<section data-sstip_class=\"twt_avatar_tip\" class=\"js-avatar_tip\">" +
                                  "<a class=\"avatar_link view_profile\">" +
                                  " <img width=\"54\" height=\"54\" border=\"0\" src=\"" + dissearch.ProfileImageUrl + "\" class=\"avatar\" id=\" " + dissearch.FromId + "\">" +
                                   "<article class=\"message-type-icon\">" +
                                      "<span class=\"twitter_bm\">" +
                                          "<img width=\"16\" height=\"16\" src=\"../Contents/Images/twticon.png\">" +
                                          "</span>" +
                                     "</article>" +
                                           "</a>" +
                                     "</section>" +
                                      "<ul></ul>" +
                                            "</aside>" +
                                           "<article>" +
                                "<div class=\"\"><a href=\"\" class=\"language\"></a></div>" +
                                "<div class=\"message_actions\"><a href=\"#\" class=\"gear_small\"><span class=\"ficon\" title=\"Options\">?</span></a></div>" +
                                "<div class=\"message-text font-14\" id=\"messagedescription_1\">" + dissearch.Message + "</div>" +
                                "<section class=\"bubble-meta\">" +
                                "<article class=\"threefourth text-overflow\">" +
                                  "<section class=\"floatleft\">" +
                                   "<a data-sstip_class=\"twt_avatar_tip\" class=\"js-avatar_tip view_profile profile_link\">" +
                                    "<span id=\"rowname_" + i + "\">" + dissearch.FromName + "</span>" +
                                                   "</a>&nbsp;" +
                                   "<a title=\"View message on Twitter\" target=\"_blank\" class=\"time\" data-msg-time=\"1363926699000\">" + dissearch.CreatedTime + "</a>" +
                                   "<span  class=\"location\">&nbsp;</span>" +
                                   "</section>" +
                                 "</article>" +
                                 "<ul class=\"message-buttons quarter clearfix\">" +
                                          "</ul>" +
                                "</section>" +
                               "</article>" +
                              "</section></div>";
     }
     return message;
 }
コード例 #10
0
ファイル: Discovery.aspx.cs プロジェクト: utkarshx/socioboard
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            int i = 0;
            string searchRes = string.Empty;
            if (!string.IsNullOrEmpty(txtSearchText.Text))
            {
                DiscoverySearch dissearch = new DiscoverySearch();
                DiscoverySearchRepository dissearchrepo = new DiscoverySearchRepository();

                List<DiscoverySearch> discoveryList = dissearchrepo.getResultsFromKeyword(txtSearchText.Text);

                if (discoveryList.Count == 0)
                {
                        #region TwitterSearch

                    try
                    {
                        string twitterSearchUrl = "http://search.twitter.com/search.json?q=" + txtSearchText.Text;
                        var request = (HttpWebRequest)WebRequest.Create(twitterSearchUrl);
                        request.Method = "GET";
                        string output = string.Empty;
                        try
                        {
                            using (var response = request.GetResponse())
                            {
                                using (var stream = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(1252)))
                                {
                                    output = stream.ReadToEnd();
                                }
                            }
                            if (!output.StartsWith("["))
                                output = "[" + output + "]";

                            JArray twitterSearchResult = JArray.Parse(output);

                            foreach (var item in twitterSearchResult)
                            {
                                var results = item["results"];

                                foreach (var chile in results)
                                {
                                    try
                                    {
                                        dissearch.CreatedTime = SocioBoard.Helper.Extensions.ParseAnotherTwitterTime(chile["created_at"].ToString().TrimStart('"').TrimEnd('"')); ;
                                        dissearch.EntryDate = DateTime.Now;
                                        dissearch.FromId = chile["from_user_id_str"].ToString().TrimStart('"').TrimEnd('"');
                                        dissearch.FromName = chile["from_user_name"].ToString().TrimStart('"').TrimEnd('"');
                                        dissearch.ProfileImageUrl = chile["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                                        dissearch.SearchKeyword = txtSearchText.Text;
                                        dissearch.Network = "twitter";
                                        dissearch.Message = chile["text"].ToString().TrimStart('"').TrimEnd('"');
                                        dissearch.MessageId = chile["id_str"].ToString().TrimStart('"').TrimEnd('"');
                                        dissearch.Id = Guid.NewGuid();
                                        dissearch.UserId = user.Id;

                                        if (!dissearchrepo.isKeywordPresent(dissearch.SearchKeyword, dissearch.MessageId))
                                        {
                                            dissearchrepo.addNewSearchResult(dissearch);
                                        }

                                        searchRes += this.BindData(dissearch, i);

                                        i++;
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex.StackTrace);
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    #endregion
                        #region FacebookSearch
                        try
                        {
                            int j = 0;
                            string facebookSearchUrl = "https://graph.facebook.com/search?q= " + txtSearchText.Text + " &type=post";
                            var facerequest = (HttpWebRequest)WebRequest.Create(facebookSearchUrl);
                            facerequest.Method = "GET";
                            string outputface = string.Empty;
                            using (var response = facerequest.GetResponse())
                            {
                                using (var stream = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(1252)))
                                {
                                    outputface = stream.ReadToEnd();
                                }
                            }
                            if (!outputface.StartsWith("["))
                                outputface = "[" + outputface + "]";

                            JArray facebookSearchResult = JArray.Parse(outputface);

                            foreach (var item in facebookSearchResult)
                            {
                                var data = item["data"];

                                foreach (var chile in data)
                                {
                                    try
                                    {
                                        dissearch.CreatedTime = DateTime.Parse(chile["created_time"].ToString());
                                        dissearch.EntryDate = DateTime.Now;
                                        dissearch.FromId = chile["from"]["id"].ToString();
                                        dissearch.FromName = chile["from"]["name"].ToString();
                                        dissearch.ProfileImageUrl = "http://graph.facebook.com/" + chile["from"]["id"] + "/picture?type=small";
                                        dissearch.SearchKeyword = txtSearchText.Text;
                                        dissearch.Network = "facebook";
                                        dissearch.Message = chile["message"].ToString();
                                        dissearch.MessageId = chile["id"].ToString();
                                        dissearch.Id = Guid.NewGuid();
                                        dissearch.UserId = user.Id;

                                        if (!dissearchrepo.isKeywordPresent(dissearch.SearchKeyword, dissearch.MessageId))
                                        {
                                            dissearchrepo.addNewSearchResult(dissearch);
                                        }

                                        searchRes += this.BindData(dissearch, i);

                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex.StackTrace);
                                    }

                                }

                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                        #endregion
                }
                else
                {
                    foreach (DiscoverySearch item in discoveryList)
                    {
                      searchRes +=   this.BindData(item, i);
                        i++;
                    }
                }
                searchresults.InnerHtml = searchRes;

            }
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: JBNavadiya/socioboard
        private static void RunSearchDataServiceForDiscovery()
        {
            //code of search
            while (true)
            {
                try
                {
                    //code to get keywords distinct from databse

                    DiscoverySearch dissearch = new DiscoverySearch();
                    DiscoverySearchRepository dissearchrepo = new DiscoverySearchRepository();

                    List<DiscoverySearch> listDiscoverySearch = dissearchrepo.getResultsFromKeywordUser();

                    foreach (DiscoverySearch discoverySearch in listDiscoverySearch)
                    {
                        try
                        {
                            string searchKeyword = discoverySearch.SearchKeyword;//"ek villain";

                            clsSocialSiteDataFeedsFactory objclsSocialSiteDataFeedsFactory = new clsSocialSiteDataFeedsFactory(discoverySearch.Network);
                            SocialSiteDataFeeds objSocialSiteDataFeeds = objclsSocialSiteDataFeedsFactory.CreateSocialSiteDataFeedsInstance();
                            objSocialSiteDataFeeds.GetSearchData(new object[] { dissearch, dissearchrepo, discoverySearch });

                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine("Error Case Debug : " + ex.StackTrace);
                            Console.WriteLine("Error Case Debug : " + ex.Message);
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }

                    }

                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error Case Debug : " + ex.StackTrace);
                    Console.WriteLine("Error Case Debug : " + ex.Message);
                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                }
                Thread.Sleep(1000 * 60 * 15);
            }
        }
コード例 #12
0
        public string getlistresults(string keyword)
        {
            User user = (User)Session["LoggedUser"];
            int i = 0;
            string searchRes = string.Empty;
            if (!string.IsNullOrEmpty(keyword))
            {
                DiscoverySearch dissearch = new DiscoverySearch();
                DiscoverySearchRepository dissearchrepo = new DiscoverySearchRepository();

                List<DiscoverySearch> discoveryList = dissearchrepo.getResultsFromKeyword(keyword);

                if (discoveryList.Count == 0)
                {

                }
                else
                {
                    foreach (DiscoverySearch item in discoveryList)
                    {
                        string postURL = string.Empty;
                        if (item.Network == "facebook")
                        {
                            postURL = "https://www.facebook.com/" + item.MessageId; ;
                        }
                        else if (item.Network == "twitter")
                        {
                            postURL = "https://twitter.com/" + item.FromName + "/status/" + item.MessageId;
                        }

                        searchRes += this.BindData(item, i, postURL);
                        i++;
                    }
                }

            }
            return searchRes;
        }