コード例 #1
0
        public string InstagramCallback()
        {
            try
            {
                var code = Request.QueryString["code"];

                if (string.IsNullOrEmpty(code))
                {
                    return(string.Empty);
                }

                var im = new InstagramManager();

                return(im.GetAuthToken(
                           ConfigurationManager.AppSettings["Instagram.ClientId"],
                           ConfigurationManager.AppSettings["Instagram.ClientSecret"],
                           ConfigurationManager.AppSettings["Instagram.CallbackUrl"],
                           code));
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message, ex);
                return(string.Empty);
            }
        }
コード例 #2
0
        public string InstagramFeed()
        {
            try
            {
                // Get feed from cache if possible
                var cacheKey = string.Format(ModelCacheEventConsumer.INSTAGRAM_FEEDS_KEY);
                var feed     = _cacheManager.Get <string>(cacheKey);

                if (!string.IsNullOrEmpty(feed))
                {
                    return(feed);
                }

                //no value in the cache yet so let's retrieve it

                int count;
                if (!Int32.TryParse(ConfigurationManager.AppSettings["Instagram.MediaCount"], out count))
                {
                    count = 3;
                }

                var im = new InstagramManager();

                feed = im.GetRecentMedia(ConfigurationManager.AppSettings["Instagram.ClientId"],
                                         ConfigurationManager.AppSettings["Instagram.UserId"], count);

                int cacheDuration;
                if (!Int32.TryParse(ConfigurationManager.AppSettings["Instagram.CacheDuration"], out cacheDuration))
                {
                    cacheDuration = 10; // 10 minutes
                }

                //let's cache the result
                _cacheManager.Set(cacheKey, feed, cacheDuration);

                return(feed);
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message, ex);
                return(string.Empty);
            }
        }
コード例 #3
0
    /// <summary>
    /// Load control .
    /// </summary>
    private void LoadSocialBoxes()
    {
        List <String> cta_boxes   = new List <String>();
        int           total_boxes = Convert.ToInt32(SocialBoxCount);

        if (!String.IsNullOrEmpty(CTAS))
        {
            try{
                cta_boxes = Regex.Split(CTAS, "{}").ToList();
            }
            catch (Exception ex)
            {
                EventLogProvider.LogException("SocialApp control", "LoadSocialBoxes CTA", ex);
            }
        }
        int           social_count = total_boxes - cta_boxes.Count();
        List <String> obj_list     = new List <String>();

        if (!String.IsNullOrEmpty(InstagramUserID))
        {
            try
            {
                InstagramManager imgr    = new InstagramManager(InstagramOAuthConsumerID, InstagramOAuthConsumerSecret, RedirectURL);
                List <String>    instgrm = imgr.GetRandom(Convert.ToInt32(InstagramUserID), total_boxes).ToList();
                obj_list = obj_list.Concat(instgrm).ToList();
            }
            catch (Exception ex)
            {
                EventLogProvider.LogException("SocialApp control", "LoadSocialBoxes Instagram", ex);
            }
        }
        if (!String.IsNullOrEmpty(TwitterUser))
        {
            try
            {
                TwitterManager tm = new TwitterManager(TwitterOAuthConsumerID, TwitterOAuthConsumerSecret, TwitterOAuthAccessToken, TwitterOAuthAccessSecret);

                List <String> tweet = tm.GetRandomTweet(TwitterUser, total_boxes).ToList();
                obj_list = obj_list.Concat(tweet).ToList();
            }
            catch (Exception ex)
            {
                EventLogProvider.LogException("SocialApp control", "LoadSocialBoxes Twitter", ex);
            }
        }
        if (!String.IsNullOrEmpty(FacebookUserID))
        {
            try
            {
                FacebookManager fmgr   = new FacebookManager(FacebookAuthToken, FacebookAppID, FacebookClientSecret, FacebookRedirectURI);
                List <String>   fbpost = fmgr.GetRandomPost(FacebookUserID, total_boxes).ToList();
                obj_list = obj_list.Concat(fbpost).ToList();
            }
            catch (Exception ex)
            {
                EventLogProvider.LogException("SocialApp control", "LoadSocialBoxes Facebook", ex);
            }
        }
        if (!String.IsNullOrEmpty(youtube_api_key))
        {
            try
            {
                YouTubeManager ytmgr   = new YouTubeManager(youtube_api_key);
                List <String>  ytvideo = ytmgr.GetVideosByPlaylistID(youtube_playlist_id, total_boxes).ToList();
                obj_list = obj_list.Concat(ytvideo).ToList();
            }
            catch (Exception ex)
            {
                EventLogProvider.LogException("SocialApp control", "LoadSocialBoxes Youtube", ex);
            }
        }

        //Randomize the list of social items and take the top # of social boxes
        obj_list = obj_list.OrderBy(x => Guid.NewGuid()).Take(social_count).ToList();

        //CTAs are always shown, add on to the end of the main list
        if (!String.IsNullOrEmpty(CTAS))
        {
            OtherManager  cta_build = new OtherManager();
            List <String> ctas      = cta_build.BuildCTAList(cta_boxes).ToList();
            obj_list = obj_list.Concat(ctas).ToList();
        }

        //If the number of boxes are less than the number requested, fill with backup images
        if ((obj_list.Count() < total_boxes) && !String.IsNullOrEmpty(BackupImages))
        {
            try
            {
                int           num_images = total_boxes - obj_list.Count();
                OtherManager  img_build  = new OtherManager();
                List <String> imgs       = img_build.BuildImageList(s_images_list, num_images).ToList();
                obj_list = obj_list.Concat(imgs).ToList();
            }
            catch (Exception ex)
            {
                EventLogProvider.LogException("SocialApp control", "LoadSocialBoxes BackupImages", ex);
            }
        }

        //randomize again
        obj_list = obj_list.OrderBy(x => Guid.NewGuid()).ToList();

        StringBuilder sb = new StringBuilder();

        foreach (String s in obj_list)
        {
            sb.Append(s);
        }
        community_box_list.InnerHtml = sb.ToString();
    }
コード例 #4
0
ファイル: AjaxFeeds.aspx.cs プロジェクト: utkarshx/socioboard
        public void ProcessRequest()
        {
            if (!string.IsNullOrEmpty(Request.QueryString["op"]))
            {
                SocioBoard.Domain.User user = (SocioBoard.Domain.User)Session["LoggedUser"];
                if (Request.QueryString["op"] == "networkprofiles")
                {
                    #region NetworkProfiles
                    string profiles = string.Empty;
                    if (Request.QueryString["network"] == "facebook")
                    {
                        ArrayList alstfacebook = null;
                        if (Session["facebooktotalprofiles"] == null)
                        {
                            FacebookAccountRepository faceaccrepo = new FacebookAccountRepository();
                            alstfacebook = faceaccrepo.getFacebookAccountsOfUser(user.Id);
                            Session["facebooktotalprofiles"] = alstfacebook;
                        }
                        else
                        {
                            alstfacebook = (ArrayList)Session["facebooktotalprofiles"];
                        }

                        if (alstfacebook.Count == 0)
                        {
                            profiles += "<li><a  href=\"#\" class=\"active\">No Records Found</a> </li>";
                        }
                        else
                        {
                            foreach (FacebookAccount item in alstfacebook)
                            {
                                profiles += "<li><a id=\"lifb_" + item.FbUserId + "\" href=\"#\" onclick=\"facebookdetails('" + item.FbUserId + "');\" class=\"active\">" + item.FbUserName + "</a> </li>";
                            }
                        }

                    }
                    else if (Request.QueryString["network"] == "twitter")
                    {
                        ArrayList alsttwitter = null;

                        if (Session["twittertotalprofiles"] == null)
                        {
                            TwitterAccountRepository twtaccrepo = new TwitterAccountRepository();
                            alsttwitter = twtaccrepo.getAllTwitterAccountsOfUser(user.Id);
                            Session["twittertotalprofiles"] = alsttwitter;
                        }
                        else
                        {
                            alsttwitter = (ArrayList)Session["twittertotalprofiles"];
                        }

                        if (alsttwitter.Count == 0)
                        {
                            profiles += "<li><a  href=\"#\" class=\"active\">No Records Found</a> </li>";
                        }
                        else
                        {

                            foreach (TwitterAccount item in alsttwitter)
                            {
                                profiles += "<li><a id=\"litwt_" + item.TwitterUserId + "\" href=\"#\" onclick=\"twitterdetails('" + item.TwitterUserId + "');\" class=\"active\">" + item.TwitterScreenName + "</a> </li>";
                            }
                        }
                    }
                    else if (Request.QueryString["network"] == "linkedin")
                    {
                        ArrayList alstlinklist = null;
                        if (Session["linkedintotalprofiles"] == null)
                        {
                            LinkedInAccountRepository linkaccrepo = new LinkedInAccountRepository();
                            alstlinklist = linkaccrepo.getAllLinkedinAccountsOfUser(user.Id);
                        }
                        else
                        {
                            alstlinklist = (ArrayList)Session["linkedintotalprofiles"];
                        }
                        if (alstlinklist.Count == 0)
                        {
                            profiles += "<li><a  href=\"#\" class=\"active\">No Records Found</a> </li>";
                        }
                        else
                        {
                            foreach (LinkedInAccount item in alstlinklist)
                            {
                                profiles += "<li><a id=\"lilin_" + item.LinkedinUserId + "\" href=\"#\" onclick=\"linkedindetails('" + item.LinkedinUserId + "');\" class=\"active\">" + item.LinkedinUserName + "</a> </li>";
                            }
                        }
                    }
                    else if (Request.QueryString["network"] == "instagram")
                    {
                        ArrayList alstinstagram = null;
                        if (Session["instagramtotalprofiles"] == null)
                        {
                            InstagramAccountRepository insaccrepo = new InstagramAccountRepository();
                            alstinstagram = insaccrepo.getAllInstagramAccountsOfUser(user.Id);
                            Session["instagramtotalprofiles"] = alstinstagram;
                        }
                        else
                        {
                            alstinstagram = (ArrayList)Session["instagramtotalprofiles"];
                        }
                        if (alstinstagram.Count == 0)
                        {
                            profiles += "<li><a  href=\"#\" class=\"active\">No Records Found</a> </li>";
                        }
                        else
                        {
                            foreach (InstagramAccount item in alstinstagram)
                            {
                                profiles += "<li><a id=\"liins_" + item.InstagramId + "\" href=\"#\" onclick=\"Instagramdetails('" + item.InstagramId + "');\" class=\"active\">" + item.InsUserName + "</a> </li>";
                            }
                        }

                    }
                    Response.Write(profiles);
                    #endregion
                }
                else if (Request.QueryString["op"] == "facebookwallposts")
                {
                    string messages = string.Empty;
                    string profileid = string.Empty;
                    string load = Request.QueryString["load"];
                    //Session[""] = profileid;
                    if (load == "first")
                    {
                        profileid = Request.QueryString["profileid"];
                        Session["FacebookProfileIdForFeeds"] = profileid;
                        facebookwallcount = 0;
                    }
                    else
                    {
                        profileid = (string)Session["FacebookProfileIdForFeeds"];
                        facebookwallcount = facebookwallcount + 10;
                    }

                    FacebookMessageRepository fbmsgrepo = new FacebookMessageRepository();
                    FacebookAccountRepository fbAccRepo = new FacebookAccountRepository();

                    List<FacebookMessage> lsgfbmsgs = fbmsgrepo.getAllWallpostsOfProfile(profileid, facebookwallcount);

                    UrlExtractor urlext = new UrlExtractor();
                    foreach (FacebookMessage item in lsgfbmsgs)
                    {
                        try
                        {

                            string[] str = urlext.splitUrlFromString(item.Message);
                            messages += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + item.FromProfileUrl + "\" onclick=\"getFacebookProfiles('" + item.FromId + "');\">" +
                                                         "</div><div class=\"pull-left feedcontent\">" +
                                                            "<a href=\"#\" class=\"feednm\" onclick=\"getFacebookProfiles('" + item.FromId + "');\">" + item.FromName + "</a> <span>" + item.MessageDate +
                                                                " </span>" +
                                                             "<p>";

                            if (!string.IsNullOrEmpty(item.Picture))
                            {
                                //string largeimage = item.Picture.Replace("_s.jpg","_n.jpg");

                                messages += "<img src=\"" + item.Picture + "\" alt=\"\" onclick=\"fbimage('" + item.Picture + "');\" /><br/>";
                            }

                            foreach (string substritem in str)
                            {
                                if (!string.IsNullOrEmpty(substritem))
                                {
                                    if (substritem.Contains("http"))
                                    {
                                        messages += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>";
                                    }
                                    else
                                    {
                                        messages += substritem;
                                    }
                                }
                            }

                            messages += "</p>" +
                                        "<a class=\"retweets\" href=\"#\">" +
                                        "</a><p><span onclick=\"facebookLike('" + item.FbLike + "','" + profileid + "','" + item.MessageId + "')\" id=\"likefb_" + item.MessageId + "\" class=\"like\">Like</span><span id=\"commentfb_" + item.MessageId + "\" onclick=\"commentText('"+item.MessageId+"');\" class=\"comment\">Comment</span></p>" +
                                        "<p><input id=\"textfb_"+item.MessageId+"\" type=\"text\" class=\"put_comments\"></p>"+
                                      "<p><span onclick=\"commentFB('"+item.MessageId+"','"+profileid+"')\" id=\"okfb_"+item.MessageId+"\" class=\"ok\">ok</span><span id=\"cancelfb_"+item.MessageId+"\" onclick=\"cancelFB('"+item.MessageId+"');\" class=\"cancel\"> cancel</span></p>"+
                                        "</div>" +
                                        "</li>";
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }
                    }
                    Response.Write(messages);
                }
                else if (Request.QueryString["op"] == "fblike")
                {
                    try
                    {
                        //System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
                        //string line = "";
                        //line = sr.ReadToEnd();
                        //JObject jo = JObject.Parse(line);
                        //string accesstoken = Server.UrlDecode((string)jo["access"]);
                        //string id = Server.UrlDecode((string)jo["fbid"]);
                        string profileid = Request.QueryString["profileid"];
                        FacebookAccountRepository fbAccRepo = new FacebookAccountRepository();
                        FacebookAccount fbAccount = fbAccRepo.getFacebookAccountDetailsById(profileid, user.Id);
                        string id = Request.QueryString["fbid"];
                        FacebookClient fbClient = new FacebookClient(fbAccount.AccessToken);
                        var s = fbClient.Post(id + "/likes",null);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }
                }
                else if (Request.QueryString["op"] == "fbcomment")
                {
                    string profileid = Request.QueryString["profileid"];
                    string message = Request.QueryString["message"];
                    FacebookAccountRepository fbAccRepo = new FacebookAccountRepository();
                    FacebookAccount fbAccount = fbAccRepo.getFacebookAccountDetailsById(profileid, user.Id);
                    string id = Request.QueryString["fbid"];
                    FacebookClient fbClient = new FacebookClient(fbAccount.AccessToken);
                    var args = new Dictionary<string, object>();
                    args["message"] = message;
                    var s = fbClient.Post(id+"/comments",args);

                }
                else if (Request.QueryString["op"] == "twitternetworkdetails")
                {
                    string messages = string.Empty;
                    string profileid = Request.QueryString["profileid"];
                    TwitterFeedRepository fbmsgrepo = new TwitterFeedRepository();
                    List<TwitterFeed> lsgfbmsgs = fbmsgrepo.getTwitterFeedOfProfile(profileid);
                    UrlExtractor urlext = new UrlExtractor();
                    foreach (TwitterFeed item in lsgfbmsgs)
                    {
                        try
                        {
                            messages += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + item.FromProfileUrl + "\" onclick=\"detailsprofile('" + item.FromId + "');\">" +
                                                         "</div><div class=\"pull-left feedcontent\">" +
                                                            "<a href=\"#\" class=\"feednm\" onclick=\"detailsprofile('" + item.FromId + "');\">" + item.FromName + "</a> <span>" + item.FeedDate +
                                                                " </span>" +
                                                             "<p>";

                            string[] str = urlext.splitUrlFromString(item.Feed);

                            foreach (string substritem in str)
                            {
                                if (!string.IsNullOrEmpty(substritem))
                                {
                                    if (substritem.Contains("http"))
                                    {
                                        messages += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>";
                                    }
                                    else
                                    {
                                        messages += substritem;
                                    }
                                }
                            }

                            messages += "</p>" +
                                   "<a class=\"retweets\" href=\"#\">" +
                                /*"<img alt=\"\" src=\"../contents/img/admin/arrow.png\">*/"</a><span></span>" +
                               "</div>" +
                           "</li>";
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }
                    }
                    Response.Write(messages);

                }
                else if (Request.QueryString["op"] == "scheduler")
                {
                    #region Schduler
                    string message = string.Empty;
                    string profileid = Request.QueryString["profileid"];
                    string network = Request.QueryString["network"];

                    if (network == "facebook")
                    {
                        ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository();
                        List<ScheduledMessage> lstschmsg = schmsgrepo.getAllMessagesOfUser(user.Id, profileid);

                        if (lstschmsg.Count != 0)
                        {
                            foreach (ScheduledMessage item in lstschmsg)
                            {
                                FacebookAccountRepository faceaccrepo = new FacebookAccountRepository();
                                FacebookAccount faceacc = faceaccrepo.getFacebookAccountDetailsById(profileid, user.Id);
                                try
                                {
                                    message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" +
                                                                 "</div><div class=\"pull-left feedcontent\">" +
                                                                    "<a href=\"#\" class=\"feednm\">" + faceacc.FbUserName + "</a> <span>" + item.ScheduleTime +
                                                                        " </span>" +
                                                                     "<p>" + item.ShareMessage + "</p>" +
                                                                     "<a class=\"retweets\" href=\"#\">" +
                                                                      "</a><span></span>" +
                                                                 "</div>" +
                                                             "</li>";
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                }

                            }
                        }
                        else
                        {
                            message = "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" +
                                                                    "</div><div class=\"pull-left feedcontent\">" +
                                                                       "<a href=\"#\" class=\"feednm\"></a> <span>" +
                                                                           " </span>" +
                                                                        "<p>No Scheduled Messages</p>" +
                                                                        "<a class=\"retweets\" href=\"#\">" +
                                                                         "</a><span></span>" +
                                                                    "</div>" +
                                                                "</li>";
                        }

                    }
                    else if (network == "twitter")
                    {
                        ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository();
                        List<ScheduledMessage> lstschmsg = schmsgrepo.getAllMessagesOfUser(user.Id, profileid);

                        if (lstschmsg.Count != 0)
                        {
                            foreach (ScheduledMessage item in lstschmsg)
                            {
                                TwitterAccountRepository twtaccrepo = new TwitterAccountRepository();
                                TwitterAccount twtacc = twtaccrepo.getUserInformation(user.Id, profileid);
                                message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" +
                                                                "</div><div class=\"pull-left feedcontent\">" +
                                                                   "<a href=\"#\" class=\"feednm\">" + twtacc.TwitterScreenName + "</a> <span>" + item.ScheduleTime +
                                                                       " </span>" +
                                                                    "<p>" + item.ShareMessage + "</p>" +
                                                                    "<a class=\"retweets\" href=\"#\">" +
                                                                     "</a><span></span>" +
                                                                "</div>" +
                                                            "</li>";
                            }
                        }
                        else
                        {
                            message = "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" +
                                                                  "</div><div class=\"pull-left feedcontent\">" +
                                                                     "<a href=\"#\" class=\"feednm\"></a> <span>" +
                                                                         " </span>" +
                                                                      "<p>No Scheduled Messages</p>" +
                                                                      "<a class=\"retweets\" href=\"#\">" +
                                                                       "</a><span></span>" +
                                                                  "</div>" +
                                                              "</li>";
                        }
                    }
                    else if (network == "linkedin")
                    {
                        ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository();
                        List<ScheduledMessage> lstschmsg = schmsgrepo.getAllMessagesOfUser(user.Id, profileid);

                        if (lstschmsg.Count != 0)
                        {
                            foreach (ScheduledMessage item in lstschmsg)
                            {
                                LinkedInAccountRepository linkedinrepo = new LinkedInAccountRepository();
                                LinkedInAccount linkedacc = linkedinrepo.getUserInformation(user.Id, profileid);
                                message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" +
                                                                    "</div><div class=\"pull-left feedcontent\">" +
                                                                       "<a href=\"#\" class=\"feednm\">" + linkedacc.LinkedinUserName + "</a> <span>" + item.ScheduleTime +
                                                                           " </span>" +
                                                                        "<p>" + item.ShareMessage + "</p>" +
                                                                        "<a class=\"retweets\" href=\"#\">" +
                                                                         "</a><span></span>" +
                                                                    "</div>" +
                                                                "</li>";
                            }
                        }
                        else
                        {
                            message = "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" +
                                                                 "</div><div class=\"pull-left feedcontent\">" +
                                                                    "<a href=\"#\" class=\"feednm\"></a> <span>" +
                                                                        " </span>" +
                                                                     "<p>No Scheduled Messages</p>" +
                                                                     "<a class=\"retweets\" href=\"#\">" +
                                                                      "</a><span></span>" +
                                                                 "</div>" +
                                                             "</li>";

                        }

                    }

                    Response.Write(message);
                    #endregion
                }
                else if (Request.QueryString["op"] == "facebookfeeds")
                {
                    string message = string.Empty;
                    string profileid = Request.QueryString["profileid"];
                    FacebookAccountRepository faceaccrepo = new FacebookAccountRepository();
                    FacebookAccount faceaac = faceaccrepo.getFacebookAccountDetailsById(profileid, user.Id);
                    FacebookFeedRepository facefeedrepo = new FacebookFeedRepository();
                    List<FacebookFeed> lstfbfeed = facefeedrepo.getAllFacebookUserFeeds(profileid);
                    UrlExtractor urlext = new UrlExtractor();
                    foreach (FacebookFeed item in lstfbfeed)
                    {
                        message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"https://www.facebook.com/" + item.ProfileId + "/picture?type=small\" onclick=\"getFacebookProfiles('" + item.FromId + "');\">" +
                                                                 "</div><div class=\"pull-left feedcontent\">" +
                                                                    "<a href=\"#\" class=\"feednm\" onclick=\"getFacebookProfiles('" + item.FromId + "');\">" + faceaac.FbUserName + "</a> <span>" + item.FeedDate +
                                                                        " </span>" +
                                                                     "<p>";

                        string[] str = urlext.splitUrlFromString(item.FeedDescription);

                        foreach (string substritem in str)
                        {
                            if (!string.IsNullOrEmpty(substritem))
                            {
                                if (substritem.Contains("http"))
                                {
                                    message += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>";
                                }
                                else
                                {
                                    message += substritem;
                                }
                            }
                        }

                        message += "</p>" +
                                     "<a class=\"retweets\" href=\"#\">" +
                                      "</a><span></span>" +
                                 "</div>" +
                             "</li>";
                    }
                    Response.Write(message);
                }
                else if (Request.QueryString["op"] == "twitterfeeds")
                {
                    string message = string.Empty;
                    string profileid = Request.QueryString["profileid"];
                    TwitterMessageRepository twtmsgreop = new TwitterMessageRepository();
                    List<TwitterMessage> lstmsg = twtmsgreop.getAllTwitterMessagesOfProfile(profileid);
                    //TwitterFeedRepository twtmsgrepo = new TwitterFeedRepository();
                    //List<TwitterFeed>  lstfeed =  twtmsgrepo.getTwitterFeedOfProfile(profileid);
                    UrlExtractor urlext = new UrlExtractor();
                    foreach (TwitterMessage item in lstmsg)
                    {
                        try
                        {
                            message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + item.FromProfileUrl + "\" onclick=\"detailsprofile('" + item.FromId + "');\">" +
                                                         "</div><div class=\"pull-left feedcontent\">" +
                                                            "<a href=\"#\" class=\"feednm\" onclick=\"detailsprofile('" + item.FromId + "');\">" + item.FromName + "</a> <span>" + item.MessageDate +
                                                                " </span>" +
                                                             "<p>";

                            string[] str = urlext.splitUrlFromString(item.TwitterMsg);

                            foreach (string substritem in str)
                            {
                                if (!string.IsNullOrEmpty(substritem))
                                {
                                    if (substritem.Contains("http"))
                                    {
                                        message += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>";
                                    }
                                    else
                                    {
                                        message += substritem;
                                    }
                                }
                            }
                            message += "</p>" +
                                                              "<a class=\"retweets\" href=\"#\">" +
                                /*"<img alt=\"\" src=\"../Contents/img/admin/arrow.png\">*/"</a><span></span>" +
                                                          "</div>" +
                                                      "</li>";
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }
                    }
                    Response.Write(message);
                }
                else if (Request.QueryString["op"] == "linkedinwallposts")
                {
                    string message = string.Empty;
                    string profileid = Request.QueryString["profileid"];

                    LinkedInFeedRepository linkedinfeedrepo = new LinkedInFeedRepository();
                    List<LinkedInFeed> lstfeed = linkedinfeedrepo.getAllLinkedInFeedsOfProfile(profileid);

                    if (lstfeed != null)
                    {
                        if (lstfeed.Count != 0)
                        {
                            foreach (LinkedInFeed item in lstfeed)
                            {
                                message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + item.FromPicUrl + "\">" +
                                                               "</div><div class=\"pull-left feedcontent\">" +
                                                                  "<a href=\"#\" class=\"feednm\">" + item.FromName + "</a> <span>" + item.FeedsDate +
                                                                      " </span>" +
                                                                   "<p>" + item.Feeds + "</p>" +
                                                                   "<a class=\"retweets\" href=\"#\">" +
                                                                   "</a><span></span>" +
                                                               "</div>" +
                                                           "</li>";
                            }
                        }
                        else
                        {
                            message = "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" +
                                                                   "</div><div class=\"pull-left feedcontent\">" +
                                                                      "<a href=\"#\" class=\"feednm\"></a> <span>" +
                                                                          " </span>" +
                                                                       "<p>No Messages Found</p>" +
                                                                       "<a class=\"retweets\" href=\"#\">" +
                                                                        "</a><span></span>" +
                                                                   "</div>" +
                                                               "</li>";
                        }
                    }
                    Response.Write(message);

                }
                else if (Request.QueryString["op"] == "linkedinfeeds")
                {
                    string profileid = Request.QueryString["profileid"];
                    LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository();
                    LinkedInAccount linkacc = linkedinAccRepo.getUserInformation(user.Id, profileid);
                    oAuthLinkedIn oauthlin = new oAuthLinkedIn();
                    oauthlin.ConsumerKey = ConfigurationManager.AppSettings["LiApiKey"];
                    oauthlin.ConsumerSecret = ConfigurationManager.AppSettings["LiSecretKey"];
                    oauthlin.FirstName = linkacc.LinkedinUserName;
                    oauthlin.Id = linkacc.LinkedinUserId;
                    oauthlin.Token = linkacc.OAuthToken;
                    oauthlin.TokenSecret = linkacc.OAuthSecret;
                    oauthlin.Verifier = linkacc.OAuthVerifier;

                    LinkedInUser l = new LinkedInUser();
                    List<LinkedInUser.User_Updates> lst = l.GetUserUpdates(oauthlin, linkacc.LinkedinUserId, 10);
                    string message = string.Empty;
                    if (lst.Count != 0)
                    {
                        foreach (LinkedInUser.User_Updates item in lst)
                        {
                            try
                            {
                                string picurl = string.Empty;
                                if (string.IsNullOrEmpty(item.PictureUrl))
                                {
                                    picurl = "../Contents/img/blank_img.png";
                                }
                                else
                                {
                                    picurl = item.PictureUrl;
                                }
                                message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + picurl + "\">" +
                                                                       "</div><div class=\"pull-left feedcontent\">" +
                                                                          "<a href=\"#\" class=\"feednm\">" + item.PersonFirstName + " " + item.PersonLastName + "</a> <span>" + item.DateTime +
                                                                              " </span>" +
                                                                           "<p>" + item.Message + "</p>" +
                                                                           "<a class=\"retweets\" href=\"#\">" +
                                                                           "</a><span></span>" +
                                                                       "</div>" +
                                                                   "</li>";
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.Message);
                            }

                        }
                    }
                    else
                    {
                        message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" +
                                                                                             "</div><div class=\"pull-left feedcontent\">" +
                                                                                                "<a href=\"#\" class=\"feednm\"></a> <span>" +
                                                                                                    " </span>" +
                                                                                                 "<p>No Messages Found</p>" +
                                                                                                 "<a class=\"retweets\" href=\"#\">" +
                                                                                                  "</a><span></span>" +
                                                                                             "</div>" +
                                                                                         "</li>";
                    }
                    Response.Write(message);
                }
                else if (Request.QueryString["op"] == "facebookapi")
                {
                    try
                    {
                        string profileid = Request.QueryString["profileid"];
                        FacebookAccountRepository facerepo = new FacebookAccountRepository();
                        FacebookAccount faceaccount = facerepo.getFacebookAccountDetailsById(profileid, user.Id);
                        FacebookHelper fbhelper = new FacebookHelper();
                        FacebookClient fbclient = new FacebookClient(faceaccount.AccessToken);
                        dynamic profile = fbclient.Get("me");
                        var feeds = fbclient.Get("/me/feed");
                        var home = fbclient.Get("me/home");
                        fbhelper.getFacebookUserFeeds(feeds, profile);
                        fbhelper.getFacebookUserHome(home, profile);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        Console.WriteLine(ex.Message);
                    }
                }
                else if (Request.QueryString["op"] == "twitterapi")
                {
                    string profileid = Request.QueryString["profileid"];
                    TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository();
                    TwitterAccount twtAccount = twtAccountRepo.getUserInformation(user.Id, profileid);
                    oAuthTwitter oAuth = new oAuthTwitter();
                    TwitterHelper twthelper = new TwitterHelper();
                    oAuth.AccessToken = twtAccount.OAuthToken;
                    oAuth.AccessTokenSecret = twtAccount.OAuthSecret;
                    twthelper.SetCofigDetailsForTwitter(oAuth);
                    oAuth.TwitterScreenName = twtAccount.TwitterScreenName;
                    oAuth.TwitterUserId = twtAccount.TwitterUserId;
                    twthelper.getUserTweets(oAuth, twtAccount, user.Id);
                    twthelper.getUserFeed(oAuth, twtAccount, user.Id);
                    twthelper.getSentDirectMessages(oAuth, twtAccount, user.Id);
                    twthelper.getReTweetsOfUser(oAuth, twtAccount, user.Id);

                }
                else if (Request.QueryString["op"] == "instagramlike")
                {
                    string mediaid = Request.QueryString["mediaid"];
                    bool b = this.likefunction(mediaid, Request.QueryString["userid"], Request.QueryString["access"]);
                }
                else if (Request.QueryString["op"] == "instagramunlike")
                {
                    string mediaid = Request.QueryString["mediaid"];
                    bool b = this.unlikefunction(mediaid, Request.QueryString["userid"], Request.QueryString["access"]);

                }
                else if (Request.QueryString["op"] == "instagramimages")
                {
                    if (Request.QueryString["loadtime"] != "first")
                    {
                        instagramcount = instagramcount + 10;
                    }
                    else
                    {
                        instagramcount = 0;
                    }

                    InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository();
                    InstagramFeedRepository objInsFeedRepo = new InstagramFeedRepository();
                    InstagramFeed objInsFeed = new InstagramFeed();
                    InstagramCommentRepository objInsCmtRepo = new InstagramCommentRepository();
                    List<SocioBoard.Domain.InstagramComment> lstInsCmt = new List<SocioBoard.Domain.InstagramComment>();

                    string strInsImage = string.Empty;

                    try
                    {
                        string profileid = Request.QueryString["profileid"];
                        InstagramAccount insaccount = objInsAccRepo.getInstagramAccountDetailsById(profileid, user.Id);
                        List<InstagramFeed> lstInsFeed = objInsFeedRepo.getAllInstagramFeedsOfUser(user.Id, profileid, instagramcount);
                        if (lstInsFeed.Count != 0)
                        {
                            strInsImage += "<div class=\"feedcontainer\">";
                            foreach (InstagramFeed feed in lstInsFeed)
                            {

                                try
                                {
                                    lstInsCmt = objInsCmtRepo.getAllInstagramCommentsOfUser(user.Id, profileid, feed.FeedId);
                                }
                                catch (Exception ex)
                                {
                                    logger.Error(ex.Message);
                                    Console.WriteLine(ex.Message);
                                }
                                try
                                {
                                    strInsImage += "<div class=\"span3\" class=\"row-fluid\"><div class=\"span12 box whitebg feedwrap\"><div class=\"topicon\"><div class=\"pull-left\">" +

                                                                    "</div><div class=\"pull-right\" id=\"like\"><a title=\"\" href=\"#\" onClick=\"insUser('" + feed.FeedId + "','" + insaccount.AccessToken + "')\" ><img id=\"heartEmpty_" + feed.FeedId + "\" width=\"14\" alt=\"\" src=\"../Contents/img/admin/heart-empty.png\"  style=\"margin-top: 9px;\"></a><a title=\"\" href=\"#\"><img width=\"14\" alt=\"\" src=\"../Contents/img/admin/speech-bubble-left.png\"  style=\"margin-top: 9px;\"></a>" +
                                                                    "</div></div><div class=\"pic\"><img alt=\"\" src=\"" + feed.FeedImageUrl + "\"></div><div class=\"desc\"><p></p><span class=\"pull-left span3\">" +
                                                                    "<img width=\"12\" alt=\"\" src=\"../Contents/img/admin/heart-empty.png\"> " + feed.LikeCount + "</span><span class=\"pull-left span3\"><img width=\"12\" alt=\"\" src=\"../Contents/img/admin/speech-bubble-left.png\"> "+ lstInsCmt.Count +"</span><div class=\"clearfix\"></div>";

                                    foreach (InstagramComment insCmt in lstInsCmt)
                                    {
                                        try
                                        {
                                            strInsImage += "<div class=\"userprof\"><div class=\"pull-left\"><a href=\"#\">" +
                                              "<img width=\"36\" alt=\"\" src=\"" + insCmt.FromProfilePic + "\"></a></div><div class=\"pull-left descr\"><p>" + insCmt.Comment + "</p>" +
                                               "<span class=\"usert\">" + DateExtension.ToDateTime(DateTime.Now, (long)Convert.ToDouble(insCmt.CommentDate)) + "</span></div></div>";

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

                                    }

                                    strInsImage += "</div></div></div>";
                                }
                                catch (Exception ex)
                                {
                                    logger.Error(ex.Message);
                                    Console.WriteLine(ex.Message);
                                }
                            }
                            strInsImage += "</div>";
                        }
                        else
                        {
                            if (instagramcount == 0)
                            {
                                strInsImage = "<div class=\"grid\"><div class=\"box whitebg feedwrap\">" +
                                             "<div class=\"topicon\"><div class=\"pull-left\"></div><div class=\"pull-right\">" +
                                 "<a href=\"#\" title=\"\"></a><a href=\"#\" title=\"\"></a></div></div><div class=\"pic\">" +
                                 "<img src=\"../Contents/img/no_image_found.png\" alt=\"\"></div><div class=\"desc\"><p></p></div></div></div>";
                            }
                        }

                        Response.Write(strInsImage);

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

                }
                else if (Request.QueryString["op"] == "instagramApi")
                {
                    try
                    {
                        InstagramManager insManager = new InstagramManager();
                        string profileid = Request.QueryString["profileid"];
                        InstagramAccountRepository insAccRepo = new InstagramAccountRepository();
                        InstagramAccount instagramAccount = insAccRepo.getInstagramAccountDetailsById(profileid, user.Id);
                        insManager.getIntagramImages(instagramAccount);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        Console.WriteLine(ex.Message);
                    }
                }

            }
        }
コード例 #5
0
        public void ProcessRequest()
        {
            SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)Session["GroupName"];
            TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository();
            TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository();
            FacebookAccountRepository facerepo = new FacebookAccountRepository();
            LinkedInAccountRepository linkaccrepo = new LinkedInAccountRepository();
            InstagramAccountRepository insaccrepo = new InstagramAccountRepository();
            TumblrAccountRepository tumblraccrepo = new TumblrAccountRepository();
            TumblrFeedRepository objTumblrFeedRepository = new TumblrFeedRepository();
            YoutubeAccountRepository ytaccrepo = new YoutubeAccountRepository();
            YoutubeChannelRepository ytrchannelrpo = new YoutubeChannelRepository();


            if (!string.IsNullOrEmpty(Request.QueryString["op"]))
            {
                SocioBoard.Domain.User user = (SocioBoard.Domain.User)Session["LoggedUser"];
                if (Request.QueryString["op"] == "networkprofiles")
                {
                    #region NetworkProfiles
                    string profiles = string.Empty;
                    List<TeamMemberProfile> allprofiles = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(team.Id);

                    int facebookcount = 0;
                    int twittercount = 0;
                    int linkedincount = 0;
                    int instagramcount = 0;
                    int tumblrcount = 0;
                    int youtubecount = 0;
                    int totalcounts = 0;

                    foreach (TeamMemberProfile items in allprofiles)
                    {
                        totalcounts++;

                        if (Request.QueryString["network"] == "facebook")
                        {

                            if (items.ProfileType == "facebook")
                            {
                                facebookcount++;
                                FacebookAccount faceaccount = facerepo.getFacebookAccountDetailsById(items.ProfileId);
                                if (faceaccount.Type != "page")
                                {
                                    profiles += "<li><a id=\"lifb_" + faceaccount.FbUserId + "\" href=\"#\" onclick=\"facebookdetails('" + faceaccount.FbUserId + "');\" class=\"active\">" + faceaccount.FbUserName + "</a> </li>";
                                }
                            }
                            if (totalcounts == allprofiles.Count)
                            {
                                if (facebookcount == 0)
                                { profiles = "<li>No Records Found !</li>"; }

                            }

                        }

                        else if (Request.QueryString["network"] == "twitter")
                        {
                            if (items.ProfileType == "twitter")
                            {
                                twittercount++;
                                TwitterAccount twtaccount = twtaccountrepo.getUserInformation(items.ProfileId);

                                profiles += "<li><a id=\"litwt_" + twtaccount.TwitterUserId + "\" href=\"#\" onclick=\"twitterdetails('" + twtaccount.TwitterUserId + "');\" class=\"active\">" + twtaccount.TwitterScreenName + "</a> </li>";
                            }
                            if (totalcounts == allprofiles.Count)
                            {
                                if (twittercount == 0)
                                { profiles = "<li>No Records Found !</li>"; }

                            }

                        }

                        else if (Request.QueryString["network"] == "linkedin")
                        {
                            if (items.ProfileType == "linkedin")
                            {
                                linkedincount++;
                                LinkedInAccount linkedinaccount = linkaccrepo.getLinkedinAccountDetailsById(items.ProfileId);

                                profiles += "<li><a id=\"lilin_" + linkedinaccount.LinkedinUserId + "\" href=\"#\" onclick=\"linkedindetails('" + linkedinaccount.LinkedinUserId + "');\" class=\"active\">" + linkedinaccount.LinkedinUserName + "</a> </li>";
                            }
                            if (totalcounts == allprofiles.Count)
                            {
                                if (linkedincount == 0)
                                { profiles = "<li>No Records Found !</li>"; }

                            }


                        }

                        else if (Request.QueryString["network"] == "tumblr")
                        {
                            if (items.ProfileType == "tumblr")
                            {
                                tumblrcount++;
                                TumblrAccount tumblraccount = tumblraccrepo.getTumblrAccountDetailsById(items.ProfileId);

                                profiles += "<li><a id=\"lilin_" + tumblraccount.tblrUserName + "\" href=\"#\" onclick=\"tumblrdetails('" + tumblraccount.tblrUserName + "');\" class=\"active\">" + tumblraccount.tblrUserName + "</a> </li>";
                            }
                            if (totalcounts == allprofiles.Count)
                            {
                                if (tumblrcount == 0)
                                { profiles = "<li>No Records Found !</li>"; }

                            }
                        }


                        else if (Request.QueryString["network"] == "youtube")
                        {
                            if (items.ProfileType == "youtube")
                            {
                                youtubecount++;
                                YoutubeAccount youtubeaccount = ytaccrepo.getYoutubeAccountDetailsById(items.ProfileId);

                                profiles += "<li><a id=\"lilin_" + youtubeaccount.Ytusername + "\" href=\"#\" onclick=\"youtubedetails('" + youtubeaccount.Ytuserid + "','" + youtubeaccount.Refreshtoken + "');\" class=\"active\">" + youtubeaccount.Ytusername + "</a> </li>";
                            }
                            if (totalcounts == allprofiles.Count)
                            {
                                if (youtubecount == 0)
                                { profiles = "<li>No Records Found !</li>"; }

                            }
                        }





                        else if (Request.QueryString["network"] == "instagram")
                        {
                            if (items.ProfileType == "instagram")
                            {
                                instagramcount++;
                                InstagramAccount alstinstagram = insaccrepo.getInstagramAccountDetailsById(items.ProfileId);

                                profiles += "<li><a id=\"liins_" + alstinstagram.InstagramId + "\" href=\"#\" onclick=\"Instagramdetails('" + alstinstagram.InstagramId + "');\" class=\"active\">" + alstinstagram.InsUserName + "</a> </li>";
                            }
                            if (totalcounts == allprofiles.Count)
                            {
                                if (instagramcount == 0)
                                { profiles = "<li>No Records Found !</li>"; }
                            }
                        }

                    }

                    Response.Write(profiles);
                    #endregion
                }


                else if (Request.QueryString["op"] == "facebookwallposts")
                {
                    #region facebookwallposts
                    string messages = string.Empty;
                    string profileid = string.Empty;
                    string load = Request.QueryString["load"];
                    //Session[""] = profileid;
                    if (load == "first")
                    {
                        profileid = Request.QueryString["profileid"];
                        Session["FacebookProfileIdForFeeds"] = profileid;
                        facebookwallcount = 0;
                    }
                    else
                    {
                        profileid = (string)Session["FacebookProfileIdForFeeds"];
                        facebookwallcount = facebookwallcount + 10;
                    }


                    FacebookMessageRepository fbmsgrepo = new FacebookMessageRepository();
                    FacebookAccountRepository fbAccRepo = new FacebookAccountRepository();

                    List<FacebookMessage> lsgfbmsgs = fbmsgrepo.getAllWallpostsOfProfile(profileid, facebookwallcount);

                    UrlExtractor urlext = new UrlExtractor();
                    foreach (FacebookMessage item in lsgfbmsgs)
                    {
                        try
                        {

                            string[] str = urlext.splitUrlFromString(item.Message);
                            messages += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + item.FromProfileUrl + "\" onclick=\"getFacebookProfiles('" + item.FromId + "');\">" +
                                                         "</div><div class=\"pull-left feedcontent\">" +
                                //"<a href=\"#\" class=\"feednm\" onclick=\"getFacebookProfiles('" + item.FromId + "');\">" + item.FromName + "</a> <span>" + item.MessageDate +
                                                            "<a target=\"_blank\" href=\"http://www.facebook.com/" + item.FromId + "\" class=\"feednm\">" + item.FromName + "</a> <span>" + item.MessageDate +
                                                                " </span>" +
                                                             "<p>";

                            if (!string.IsNullOrEmpty(item.Picture))
                            {
                                //string largeimage = item.Picture.Replace("_s.jpg","_n.jpg");

                                messages += "<img src=\"" + item.Picture + "\" alt=\"\" onclick=\"fbimage('" + item.Picture + "');\" /><br/>";
                            }

                            foreach (string substritem in str)
                            {
                                try
                                {
                                    if (!string.IsNullOrEmpty(substritem))
                                    {
                                        if (substritem.Contains("http"))
                                        {
                                            messages += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>";
                                        }
                                        else
                                        {
                                            string hrefPost = string.Empty;

                                            try
                                            {
                                                hrefPost = "https://www.facebook.com/" + item.FromId + "/posts/" + item.MessageId.Replace(item.FromId, string.Empty).Replace("_", string.Empty).Trim();

                                            }
                                            catch (Exception ex)
                                            {
                                                Console.WriteLine("Error : " + ex.StackTrace);

                                            }
                                            if (!string.IsNullOrEmpty(hrefPost))
                                            {
                                                messages += "<a target=\"_blank\" href=\"" + hrefPost + "\">" + substritem + "</a>";//substritem;
                                            }
                                            else
                                            {
                                                messages += substritem;

                                            }
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine("Error : " + ex.StackTrace);

                                }
                            }

                            //    messages += "</p>" +
                            //                "<a class=\"retweets\" href=\"#\">" +
                            //                "</a><p><span onclick=\"facebookLike('" + item.FbLike + "','" + profileid + "','" + item.MessageId + "')\" id=\"likefb_" + item.MessageId + "\" class=\"like\">Like</span><span id=\"commentfb_" + item.MessageId + "\" onclick=\"commentText('" + item.MessageId + "');\" class=\"comment\">Comment</span></p>" +
                            //                "<p class=\"commeent_box\"><input id=\"textfb_" + item.MessageId + "\" type=\"text\" class=\"put_comments\"></p>" +
                            //              "<p><span onclick=\"commentFB('" + item.MessageId + "','" + profileid + "')\" id=\"okfb_" + item.MessageId + "\" class=\"ok\">ok</span><span id=\"cancelfb_" + item.MessageId + "\" onclick=\"cancelFB('" + item.MessageId + "');\" class=\"cancel\"> cancel</span></p>" +
                            //                "</div>" +
                            //                "</li>";
                            //}



                            //messages += "</p>" +
                            //           "<a class=\"retweets\" href=\"#\">" +
                            //           "</a><p><span onclick=\"facebookShare('" + profileid + "','" + item.MessageId + "')\" id=\"likefb_" + item.MessageId + "\" class=\"like\">Share</span><span onclick=\"facebookLike('" + item.FbLike + "','" + profileid + "','" + item.MessageId + "')\" id=\"likefb_" + item.MessageId + "\" class=\"like\">Like</span><span id=\"commentfb_" + item.MessageId + "\" onclick=\"commentText('" + item.MessageId + "');\" class=\"comment\">Comment</span></p>" +
                            //           "<p class=\"commeent_box\"><input id=\"textfb_" + item.MessageId + "\" type=\"text\" class=\"put_comments\"></p>" +
                            //         "<p><span onclick=\"commentFB('" + item.MessageId + "','" + profileid + "')\" id=\"okfb_" + item.MessageId + "\" class=\"ok\">ok</span><span id=\"cancelfb_" + item.MessageId + "\" onclick=\"cancelFB('" + item.MessageId + "');\" class=\"cancel\"> cancel</span></p>" +
                            //           "</div>" +
                            //           "</li>";

                            messages += "</p>" +
                                     "<a class=\"retweets\" href=\"#\">" +
                                     "</a><p><span onclick=\"facebookLike('" + item.FbLike + "','" + profileid + "','" + item.MessageId + "')\" id=\"likefb_" + item.MessageId + "\" class=\"like\">Like</span><span id=\"commentfb_" + item.MessageId + "\" onclick=\"commentText('" + item.MessageId + "');\" class=\"comment\">Comment</span></p>" +
                                     "<p class=\"commeent_box\"><input id=\"textfb_" + item.MessageId + "\" type=\"text\" class=\"put_comments\"></p>" +
                                   "<p><span onclick=\"commentFB('" + item.MessageId + "','" + profileid + "')\" id=\"okfb_" + item.MessageId + "\" class=\"ok\">ok</span><span id=\"cancelfb_" + item.MessageId + "\" onclick=\"cancelFB('" + item.MessageId + "');\" class=\"cancel\"> cancel</span></p>" +
                                     "</div>" +
                                     "</li>";
                        }




                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }
                    }
                    Response.Write(messages);
                    #endregion
                }
                else if (Request.QueryString["op"] == "fblike")
                {
                    #region fblikes
                    try
                    {
                        //System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
                        //string line = "";
                        //line = sr.ReadToEnd();
                        //JObject jo = JObject.Parse(line);
                        //string accesstoken = Server.UrlDecode((string)jo["access"]);
                        //string id = Server.UrlDecode((string)jo["fbid"]);
                        string profileid = Request.QueryString["profileid"];
                        FacebookAccountRepository fbAccRepo = new FacebookAccountRepository();
                        FacebookAccount fbAccount = fbAccRepo.getFacebookAccountDetailsById(profileid, user.Id);
                        string id = Request.QueryString["fbid"];
                        FacebookClient fbClient = new FacebookClient(fbAccount.AccessToken);
                        var s = fbClient.Post(id + "/likes", null);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }
                    #endregion
                }


                else if (Request.QueryString["op"] == "fbshare")
                {
                    try
                    {
                        string profileid = Request.QueryString["profileid"];
                        string id = Request.QueryString["msgid"];
                        FacebookAccountRepository fbAccRepo = new FacebookAccountRepository();
                        FacebookAccount fbAccount = fbAccRepo.getFacebookAccountDetailsById(profileid);
                        FacebookClient fbClient = new FacebookClient(fbAccount.AccessToken);
                        var s = fbClient.Post(id + "/sharedposts", null);

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



                else if (Request.QueryString["op"] == "fbcomment")
                {
                    #region fbcomment
                    string profileid = Request.QueryString["profileid"];
                    string message = Request.QueryString["message"];
                    FacebookAccountRepository fbAccRepo = new FacebookAccountRepository();
                    FacebookAccount fbAccount = fbAccRepo.getFacebookAccountDetailsById(profileid, user.Id);
                    string id = Request.QueryString["fbid"];
                    FacebookClient fbClient = new FacebookClient(fbAccount.AccessToken);
                    var args = new Dictionary<string, object>();
                    args["message"] = message;
                    var s = fbClient.Post(id + "/comments", args);

                    #endregion
                }
                else if (Request.QueryString["op"] == "twitternetworkdetails")
                {
                    #region twitternetworkdetails
                    string messages = string.Empty;
                    string profileid = Request.QueryString["profileid"];
                    TwitterFeedRepository fbmsgrepo = new TwitterFeedRepository();
                    List<TwitterFeed> lsgfbmsgs = fbmsgrepo.getTwitterFeedOfProfile(profileid);
                    UrlExtractor urlext = new UrlExtractor();
                    foreach (TwitterFeed item in lsgfbmsgs)
                    {
                        try
                        {
                            messages += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + item.FromProfileUrl + "\" onclick=\"detailsdiscoverytwitter('" + item.FromId + "');\">" +
                                                         "</div><div class=\"pull-left feedcontent\">" +
                                                            "<a href=\"#\" class=\"feednm\" onclick=\"detailsdiscoverytwitter('" + item.FromId + "');\">" + item.FromName + "</a> <span>" + item.FeedDate +
                                                                " </span>" +
                                                             "<p>";

                            string[] str = urlext.splitUrlFromString(item.Feed);

                            foreach (string substritem in str)
                            {
                                try
                                {
                                    if (!string.IsNullOrEmpty(substritem))
                                    {
                                        if (substritem.Contains("http"))
                                        {
                                            messages += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>";
                                        }
                                        else
                                        {
                                            string hrefPost = string.Empty;

                                            try
                                            {
                                                //https://twitter.com/265982289/status/431552741341941760
                                                hrefPost = "https://twitter.com/" + item.FromId + "/status/" + item.MessageId.Replace(item.FromId, string.Empty).Replace("_", string.Empty).Trim();

                                            }
                                            catch (Exception ex)
                                            {
                                                Console.WriteLine("Error : " + ex.StackTrace);

                                            }
                                            if (!string.IsNullOrEmpty(hrefPost))
                                            {
                                                messages += "<a target=\"_blank\" href=\"" + hrefPost + "\">" + substritem + "</a>";//substritem;
                                            }
                                            else
                                            {
                                                messages += substritem;

                                            }
                                        }
                                    }
                                }
                                catch (Exception)
                                {

                                }
                            }

                            messages += "</p>" +
                                   "<a class=\"retweets\" href=\"#\">" +
                                /*"<img alt=\"\" src=\"../contents/img/admin/arrow.png\">*/"</a><span></span>" +
                               "</div>" +
                           "</li>";
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }
                    }
                    Response.Write(messages);
                    #endregion
                }
                else if (Request.QueryString["op"] == "scheduler")
                {
                    #region Schduler
                    string message = string.Empty;
                    string profileid = Request.QueryString["profileid"];
                    string network = Request.QueryString["network"];

                    if (network == "facebook")
                    {
                        ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository();
                        List<ScheduledMessage> lstschmsg = schmsgrepo.getAllMessagesOfUser(profileid);

                        if (lstschmsg.Count != 0)
                        {
                            foreach (ScheduledMessage item in lstschmsg)
                            {
                                try
                                {
                                    FacebookAccountRepository faceaccrepo = new FacebookAccountRepository();
                                    FacebookAccount faceacc = faceaccrepo.getFacebookAccountDetailsById(profileid);
                                    try
                                    {
                                        message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\"  src=\"https://graph.facebook.com/" + item.ProfileId + "/picture?type=small\">" +
                                                                     "</div><div class=\"pull-left feedcontent\">" +
                                                                        "<a href=\"#\" class=\"feednm\">" + faceacc.FbUserName + "</a> <span>" + item.ScheduleTime +
                                                                            " </span>" +
                                                                         "<p>" + item.ShareMessage + "</p>" +
                                                                         "<a class=\"retweets\" href=\"#\">" +
                                                                          "</a><span></span>" +
                                                                     "</div>" +
                                                                 "</li>";
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex.Message);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                }

                            }
                        }
                        else
                        {
                            message = "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" +
                                                                    "</div><div class=\"pull-left feedcontent\">" +
                                                                       "<a href=\"#\" class=\"feednm\"></a> <span>" +
                                                                           " </span>" +
                                                                        "<p>No Scheduled Messages</p>" +
                                                                        "<a class=\"retweets\" href=\"#\">" +
                                                                         "</a><span></span>" +
                                                                    "</div>" +
                                                                "</li>";
                        }



                    }
                    else if (network == "twitter")
                    {
                        ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository();
                        List<ScheduledMessage> lstschmsg = schmsgrepo.getAllMessagesOfUser(profileid);

                        if (lstschmsg.Count != 0)
                        {
                            foreach (ScheduledMessage item in lstschmsg)
                            {
                                try
                                {
                                    TwitterAccountRepository twtaccrepo = new TwitterAccountRepository();
                                    TwitterAccount twtacc = twtaccrepo.getUserInformation(profileid);
                                    message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\"  src=\"" + twtacc.ProfileImageUrl + "\">" +
                                                                    "</div><div class=\"pull-left feedcontent\">" +
                                                                       "<a href=\"#\" class=\"feednm\">" + twtacc.TwitterScreenName + "</a> <span>" + item.ScheduleTime +
                                                                           " </span>" +
                                                                        "<p>" + item.ShareMessage + "</p>" +
                                                                        "<a class=\"retweets\" href=\"#\">" +
                                                                         "</a><span></span>" +
                                                                    "</div>" +
                                                                "</li>";
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                }
                            }
                        }
                        else
                        {
                            message = "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" +
                                                                  "</div><div class=\"pull-left feedcontent\">" +
                                                                     "<a href=\"#\" class=\"feednm\"></a> <span>" +
                                                                         " </span>" +
                                                                      "<p>No Scheduled Messages</p>" +
                                                                      "<a class=\"retweets\" href=\"#\">" +
                                                                       "</a><span></span>" +
                                                                  "</div>" +
                                                              "</li>";
                        }
                    }
                    else if (network == "linkedin")
                    {
                        ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository();
                        List<ScheduledMessage> lstschmsg = schmsgrepo.getAllMessagesOfUser(profileid);

                        if (lstschmsg.Count != 0)
                        {
                            foreach (ScheduledMessage item in lstschmsg)
                            {
                                try
                                {
                                    LinkedInAccountRepository linkedinrepo = new LinkedInAccountRepository();
                                    LinkedInAccount linkedacc = linkedinrepo.getUserInformation(profileid);
                                    message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\"  src=\"" + linkedacc.ProfileImageUrl + "\">" +
                                                                        "</div><div class=\"pull-left feedcontent\">" +
                                                                           "<a href=\"#\" class=\"feednm\">" + linkedacc.LinkedinUserName + "</a> <span>" + item.ScheduleTime +
                                                                               " </span>" +
                                                                            "<p>" + item.ShareMessage + "</p>" +
                                                                            "<a class=\"retweets\" href=\"#\">" +
                                                                             "</a><span></span>" +
                                                                        "</div>" +
                                                                    "</li>";
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine("Error : " + ex.StackTrace);

                                }
                            }
                        }
                        else
                        {
                            message = "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" +
                                                                 "</div><div class=\"pull-left feedcontent\">" +
                                                                    "<a href=\"#\" class=\"feednm\"></a> <span>" +
                                                                        " </span>" +
                                                                     "<p>No Scheduled Messages</p>" +
                                                                     "<a class=\"retweets\" href=\"#\">" +
                                                                      "</a><span></span>" +
                                                                 "</div>" +
                                                             "</li>";

                        }

                    }




                    Response.Write(message);
                    #endregion
                }
                else if (Request.QueryString["op"] == "facebookfeeds")
                {
                    #region facebookfeeds
                    string message = string.Empty;
                    string profileid = Request.QueryString["profileid"];
                    FacebookAccountRepository faceaccrepo = new FacebookAccountRepository();
                    FacebookAccount faceaac = faceaccrepo.getFacebookAccountDetailsById(profileid);
                    FacebookFeedRepository facefeedrepo = new FacebookFeedRepository();
                    List<FacebookFeed> lstfbfeed = facefeedrepo.getAllFacebookUserFeeds(profileid);
                    UrlExtractor urlext = new UrlExtractor();
                    foreach (FacebookFeed item in lstfbfeed)
                    {
                        try
                        {
                            message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"https://graph.facebook.com/" + item.ProfileId + "/picture?type=small\" onclick=\"getFacebookProfiles('" + item.FromId + "');\">" +
                                                                                     "</div><div class=\"pull-left feedcontent\">" +
                                                                                        "<a href=\"#\" class=\"feednm\" onclick=\"getFacebookProfiles('" + item.FromId + "');\">" + faceaac.FbUserName + "</a> <span>" + item.FeedDate +
                                                                                            " </span>" +
                                                                                         "<p>";

                            string[] str = urlext.splitUrlFromString(item.FeedDescription);

                            foreach (string substritem in str)
                            {
                                try
                                {
                                    if (!string.IsNullOrEmpty(substritem))
                                    {
                                        if (substritem.Contains("http"))
                                        {
                                            message += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>";
                                        }
                                        else
                                        {
                                            string hrefPost = string.Empty;

                                            try
                                            {
                                                hrefPost = "https://www.facebook.com/" + item.FromId + "/posts/" + item.FeedId.Replace(item.FromId, string.Empty).Replace("_", string.Empty).Trim();

                                            }
                                            catch (Exception ex)
                                            {
                                                Console.WriteLine("Error : " + ex.StackTrace);

                                            }
                                            if (!string.IsNullOrEmpty(hrefPost))
                                            {
                                                message += "<a target=\"_blank\" href=\"" + hrefPost + "\">" + substritem + "</a>";//substritem;
                                            }
                                            else
                                            {
                                                message += substritem;

                                            }
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine("Error : " + ex.StackTrace);

                                }
                            }


                            message += "</p>" +
                                         "<a class=\"retweets\" href=\"#\">" +
                                          "</a><span></span>" +
                                     "</div>" +
                                 "</li>";
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine("Error : " + ex.StackTrace);

                        }
                    }
                    Response.Write(message);
                    #endregion
                }
                else if (Request.QueryString["op"] == "twitterfeeds")
                {
                    #region twitternfeeds
                    string message = string.Empty;
                    string profileid = Request.QueryString["profileid"];
                    TwitterMessageRepository twtmsgreop = new TwitterMessageRepository();
                    List<TwitterMessage> lstmsg = twtmsgreop.getAllTwitterMessagesOfProfile(profileid);
                    //TwitterFeedRepository twtmsgrepo = new TwitterFeedRepository();
                    //List<TwitterFeed>  lstfeed =  twtmsgrepo.getTwitterFeedOfProfile(profileid);
                    UrlExtractor urlext = new UrlExtractor();
                    foreach (TwitterMessage item in lstmsg)
                    {
                        try
                        {
                            message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + item.FromProfileUrl + "\" onclick=\"detailsdiscoverytwitter('" + item.FromId + "');\">" +
                                                         "</div><div class=\"pull-left feedcontent\">" +
                                                            "<a href=\"#\" class=\"feednm\" onclick=\"detailsdiscoverytwitter('" + item.FromId + "');\">" + item.FromName + "</a> <span>" + item.MessageDate +
                                                                " </span>" +
                                                             "<p>";

                            string[] str = urlext.splitUrlFromString(item.TwitterMsg);

                            foreach (string substritem in str)
                            {
                                try
                                {
                                    if (!string.IsNullOrEmpty(substritem))
                                    {
                                        if (substritem.Contains("http"))
                                        {
                                            message += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>";
                                        }
                                        else
                                        {
                                            string hrefPost = string.Empty;

                                            try
                                            {
                                                //https://twitter.com/265982289/status/431552741341941760

                                                hrefPost = "https://twitter.com/" + item.FromId + "/status/" + item.MessageId.Replace(item.FromId, string.Empty).Replace("_", string.Empty).Trim();

                                            }
                                            catch (Exception ex)
                                            {
                                                Console.WriteLine("Error : " + ex.StackTrace);

                                            }
                                            if (!string.IsNullOrEmpty(hrefPost))
                                            {
                                                message += "<a target=\"_blank\" href=\"" + hrefPost + "\">" + substritem + "</a>";//substritem;
                                            }
                                            else
                                            {
                                                message += substritem;

                                            }
                                        }
                                    }
                                }
                                catch (Exception)
                                {

                                }
                            }
                            message += "</p>" +
                                                              "<a class=\"retweets\" href=\"#\">" +
                                /*"<img alt=\"\" src=\"../Contents/img/admin/arrow.png\">*/"</a><span></span>" +
                                                          "</div>" +
                                                      "</li>";
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }
                    }
                    Response.Write(message);
                    #endregion
                }
                else if (Request.QueryString["op"] == "linkedinwallposts")
                {
                    #region linkedinwallposts
                    string message = string.Empty;
                    string profileid = Request.QueryString["profileid"];

                    LinkedInFeedRepository linkedinfeedrepo = new LinkedInFeedRepository();
                    List<LinkedInFeed> lstfeed = linkedinfeedrepo.getAllLinkedInFeedsOfProfile(profileid);





                    if (lstfeed != null)
                    {
                        if (lstfeed.Count != 0)
                        {
                            if (lstfeed.Count > 500)
                            {
                                int check = 0;
                                foreach (LinkedInFeed item in lstfeed)
                                {

                                    string PicUrl = string.Empty;
                                    if (string.IsNullOrEmpty(item.FromPicUrl))
                                    {
                                        PicUrl = "../Contents/img/blank_img.png";
                                    }
                                    else
                                    {
                                        PicUrl = item.FromPicUrl;
                                    }






                                    check++;
                                    try
                                    {
                                        message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + PicUrl + "\">" +
                                                                                              "</div><div class=\"pull-left feedcontent\">" +
                                                                                                 "<a style=\"cursor:default\" class=\"feednm\">" + item.FromName + "</a> <span>" + item.FeedsDate +
                                                                                                     " </span>" +
                                                                                                   " <a href=\"#\">" + item.Feeds + "</a>"+
                                                                                                  "<a class=\"retweets\" href=\"#\">" +
                                                                                                  "</a><span></span>" +
                                                                                              "</div>" +
                                                                                          "</li>";
                                    }
                                    catch (Exception ex)
                                    {
                                        logger.Error(ex.Message);
                                        Console.WriteLine(ex.Message);
                                    }
                                    if (check == 500)
                                    {
                                        break;
                                    }
                                }
                            }
                            else
                            {

                                foreach (LinkedInFeed item in lstfeed)
                                {
                                    try
                                    {
                                        string PicUrl = string.Empty;
                                        if (string.IsNullOrEmpty(item.FromPicUrl))
                                        {
                                            PicUrl = "../Contents/img/blank_img.png";
                                        }
                                        else
                                        {
                                            PicUrl = item.FromPicUrl;
                                        }





                                        message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + PicUrl + "\">" +
                                                                                              "</div><div class=\"pull-left feedcontent\">" +
                                                                                                 "<a style=\"cursor:default\" class=\"feednm\">" + item.FromName + "</a> <span>" + item.FeedsDate +
                                                                                                     " </span>" +
                                                                                                  " <a href=\"#\">" + item.Feeds + "</a>" +
                                                                                                  "<a class=\"retweets\" href=\"#\">" +
                                                                                                  "</a><span></span>" +
                                                                                              "</div>" +
                                                                                          "</li>";
                                    }
                                    catch (Exception ex)
                                    {
                                        logger.Error(ex.Message);
                                        Console.WriteLine(ex.Message);
                                    }
                                }
                            }
                        }
                        else
                        {
                            message = "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" +
                                                                   "</div><div class=\"pull-left feedcontent\">" +
                                                                      "<a href=\"#\" class=\"feednm\"></a> <span>" +
                                                                          " </span>" +
                                                                       "<p>No Messages Found</p>" +
                                                                       "<a class=\"retweets\" href=\"#\">" +
                                                                        "</a><span></span>" +
                                                                   "</div>" +
                                                               "</li>";
                        }
                    }
                    Response.Write(message);
                    #endregion
                }

                else if (Request.QueryString["op"] == "tumblrimages")
                {

                    #region tumblrBlog
                    string messages = string.Empty;
                    string profileid = Request.QueryString["profileid"];
                    TumblrAccount objTumblrAccount = tumblraccrepo.getTumblrAccountDetailsById(profileid);
                    List<TumblrFeed> lstfeed = objTumblrFeedRepository.getFeedOfProfile(profileid);

                    string strTumblrImage = string.Empty;
                    string image = string.Empty;
                    try
                    {

                        if (lstfeed.Count != 0)
                        {


                            strTumblrImage += "<div class=\"feedcontainer\"><div class=\"pull-left span\"><div id=\"tumblrcontents\">" +
                       "<a href=\"#\"><img onClick=\"Bpopup()\" src=\"../Contents/img/share.png\" width=\"20\" title=\"Share Content\" /></a>" +
                    "</div></div>";


                            foreach (TumblrFeed feed in lstfeed)
                            {
                                if (string.IsNullOrEmpty(feed.imageurl))
                                {
                                    image = "../../Contents/img/admin/Demo-Image.png";


                                }
                                else
                                {
                                    image = feed.imageurl;
                                }



                                try
                                {
                                    //    strTumblrImage += "<div class=\"span3\" class=\"row-fluid\"><div class=\"span box whitebg tumb_bg feedwrap\"><div class=\"tumb_title\"><span class=\"tumb_span\">" + feed.blogname+ "</span></div><div class=\"pic tumb_pic\"><img onclick=\"tumblrimage('" + feed.imageurl + "')\" alt=\"\" src=\"" + image + "\"></div><div class=\"topicon\">" +
                                    //"<div class=\"pull-right\" id=\"like\"><a title=\"\" href=\"#\" onClick=\"LikePic('" + feed.ProfileId + "','" + feed.Id + "','" + objTumblrAccount.tblrAccessToken + "','" + objTumblrAccount.tblrAccessTokenSecret + "','" + feed.liked + "','" + feed.notes + "')\" >" + getlike(feed.liked, feed.ProfileId) + "</a><a title=\"\" href=\"#\"><img onClick=\"UnfollowBlog('" + feed.ProfileId + "','" + feed.Id + "','" + objTumblrAccount.tblrAccessToken + "','" + objTumblrAccount.tblrAccessTokenSecret + "','" + feed.blogname + "')\"   width=\"14\" alt=\"\" src=\"../Contents/img/admin/speech-bubble-left.png\"  style=\"margin-top: 9px;\"></a>" +
                                    //"</div></div><div class=\"desc\"><p></p><span class=\"pull-left pics_space span4\">" +
                                    //"<img width=\"12\" alt=\"\" src=\"../Contents/img/admin/dil.png\"> " + feed.notes + "</span><div class=\"clearfix\">" +
                                    //"<div class=\"tumb_description\"><p class=\"feed_slug\"><strong>" + feed.slug + "</strong></p><p class=\"teaser\">" + feed.description + "</p></div></div>";





                                    strTumblrImage += "<div class=\"span3\" class=\"row-fluid\"><div class=\"span box whitebg tumb_bg feedwrap\"><div class=\"tumb_title\"><span class=\"tumb_span\">" + feed.blogname + "</span></div><div class=\"pic tumb_pic\"><img onclick=\"tumblrimage('" + feed.imageurl + "')\" alt=\"\" src=\"" + image + "\"></div><div class=\"topicon\">" +
                                                                    "<div class=\"pull-right\" id=\"like\"><a title=\"\" href=\"#\" onClick=\"LikePic('" + feed.ProfileId + "','" + feed.Id + "','" + objTumblrAccount.tblrAccessToken + "','" + objTumblrAccount.tblrAccessTokenSecret + "','" + feed.liked + "','" + feed.notes + "')\" >" + getlike(feed.liked, feed.ProfileId) + "</a><a title=\"\" href=\"#\"><img onClick=\"UnfollowBlog('" + feed.ProfileId + "','" + feed.Id + "','" + objTumblrAccount.tblrAccessToken + "','" + objTumblrAccount.tblrAccessTokenSecret + "','" + feed.blogname + "')\"   width=\"14\" alt=\"\" src=\"../Contents/img/admin/speech-bubble-left.png\"  style=\"margin-top: 9px;\"></a>" +
                                                                    "</div></div><div class=\"desc\"><p></p><span class=\"pull-left pics_space span4\">" +
                                                                    "<img width=\"12\" alt=\"\" src=\"../Contents/img/admin/dil.png\"> " + feed.notes + "</span><div class=\"clearfix\">" +
                                                                    "<div class=\"tumb_description\"><p class=\"feed_slug\"><strong>" + feed.slug + "</strong></p><p class=\"teaser\">" + feed.description + "</p></div></div>";





                                    strTumblrImage += "</div></div></div>";
                                }
                                catch (Exception ex)
                                {
                                    logger.Error(ex.Message);
                                    Console.WriteLine(ex.Message);
                                }
                            }
                            strTumblrImage += "</div>";
                        }
                        else
                        {
                            if (instagramcount == 0)
                            {
                                strTumblrImage = "<div class=\"grid\"><div class=\"box whitebg feedwrap\">" +
                                             "<div class=\"topicon\"><div class=\"pull-left\"></div><div class=\"pull-right\">" +
                                 "<a href=\"#\" title=\"\"></a><a href=\"#\" title=\"\"></a></div></div><div class=\"pic\">" +
                                 "<img src=\"../Contents/img/no_image_found.png\" alt=\"\"></div><div class=\"desc\"><p></p></div></div></div>";
                            }
                        }


                        Response.Write(strTumblrImage);


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



                    #endregion
                }
                //VIDEOS
                else if (Request.QueryString["op"] == "youtubechannel")
                {
                    #region youtube_channel
                    string thumbnail = string.Empty;
                    string videoid = string.Empty;
                    string strYoutubechanell = string.Empty;
                    string GooglePlusUserId = Request.QueryString["profileid"];
                    string accesstoken = Request.QueryString["accesstoken"];
                    oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube();
                    string finaltoken = objoAuthTokenYoutube.GetAccessToken(accesstoken);
                    string strfinaltoken = string.Empty;


                    try
                    {

                        if (!finaltoken.StartsWith("["))
                            finaltoken = "[" + finaltoken + "]";
                        JArray objArray = JArray.Parse(finaltoken);


                        foreach (var item in objArray)
                        {
                            try
                            {
                                strfinaltoken = item["access_token"].ToString();
                                break;
                            }
                            catch (Exception ex)
                            {
                                //logger.Error(ex.StackTrace);
                                Console.WriteLine(ex.StackTrace);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        //logger.Error(ex.StackTrace);
                        Console.WriteLine(ex.StackTrace);
                    }


                    YoutubeChannel objChnnelData = ytrchannelrpo.getYoutubeChannelDetailsById(GooglePlusUserId);
                    PlaylistItems objPlaylistItems = new PlaylistItems();
                    string objDetails = objPlaylistItems.Get_PlaylistItems_List(strfinaltoken, GlobusGooglePlusLib.Authentication.oAuthTokenYoutube.Parts.snippet.ToString(), objChnnelData.Uploadsid);

                    JObject obj = JObject.Parse(objDetails);

                    JArray array = (JArray)obj["items"];


                    //strYoutubechanell = " <div class=\"row\"> ";

                    int rowCount = 0;
                    int columnCount = 0;

                    //strYoutubechanell = "<div class=\"row top_select\"> <div class=\"pull-left\"><a href=\"#\"><div class=\"YtIns\">Hello</div></a></div> <div class=\"pull-right\"><select class=\"form-control\" onchange=\"dropDownChange(this,'" + GooglePlusUserId + "','" + accesstoken + "')\"><option>Video</option> <option>Play list</option> <option>Activities</option></select></div></div><div class=\"container yt_details\">";
                    //strYoutubechanell = "<div class=\"row\">  <div class=\"pull-right\"><select class=\"form-control\" onchange=\"dropDownChange(this,'" + GooglePlusUserId + "','" + accesstoken + "')\"><option>Video</option> <option>Play list</option> <option>Activities</option></select></div></div>";
                    strYoutubechanell = "<div class=\"row top_select\"> <div class=\"pull-left\"><a href=\"#\"><div class=\"YtIns\"></div></a></div> <div class=\"pull-right\">"
                                        + "<ul class=\"nav nav-tabs\"><li class=\"active\"><a href=\"#VIDEO\" onclick=\"dropDownChange(this,'" + GooglePlusUserId + "','" + accesstoken + "')\" data-toggle=\"tab\">VIDEO</a></li><li><a href=\"#ACT\" onclick=\"dropDownChange(this,'" + GooglePlusUserId + "','" + accesstoken + "')\" data-toggle=\"tab\">ACTIVITES</a></li><li>"
                    + "<a href=\"#SUB\" onclick=\"dropDownChange(this,'" + GooglePlusUserId + "','" + accesstoken + "')\" data-toggle=\"tab\">SUBSCRIBTIONS</a></li></ul></div></div><div class=\"tab-content yt_details_container\"><div class=\"tab-pane active\" id=\"ACT\">"
                    + "<div class=\"container yt_details\">";



                    string strYoutubechanell1 = string.Empty;

                    foreach (var item in array)
                    {
                        columnCount++;
                        try
                        {
                            thumbnail = item["snippet"]["thumbnails"]["maxres"]["url"].ToString();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);

                        }
                        if (string.IsNullOrEmpty(thumbnail))
                        {
                            try
                            {
                                thumbnail = item["snippet"]["thumbnails"]["high"]["url"].ToString();
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.StackTrace);
                            }
                        }

                        try
                        {
                            videoid = item["snippet"]["resourceId"]["videoId"].ToString();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);

                        }


                        string viewCount = string.Empty;
                        string likeCount = string.Empty;
                        string dislikeCount = string.Empty;
                        string favoriteCount = string.Empty;
                        string commentCount = string.Empty;
                        if (!string.IsNullOrEmpty(videoid))
                        {

                            try
                            {
                                GlobusGooglePlusLib.Youtube.Core.Video ObjClsVideo = new Video();

                                string videoDetails = ObjClsVideo.Get_VideoDetails_byId(videoid, strfinaltoken, "snippet,statistics");

                                JObject JobjvideoDetails = JObject.Parse(videoDetails);

                                var JArrvideoDetails = (JArray)(JobjvideoDetails["items"]);

                                foreach (var DataVal in JArrvideoDetails)
                                {
                                    viewCount = DataVal["statistics"]["viewCount"].ToString();
                                    likeCount = DataVal["statistics"]["likeCount"].ToString();
                                    dislikeCount = DataVal["statistics"]["dislikeCount"].ToString();
                                    favoriteCount = DataVal["statistics"]["favoriteCount"].ToString();
                                    commentCount = DataVal["statistics"]["commentCount"].ToString();
                                    break;
                                }


                            }
                            catch (Exception)
                            {
                            }

                        }


                        //strYoutubechanell1 += "<div class=\"span4\">" +
                        //                    "<div class=\"well\">" +
                        //                     "<div class=\"video-containers thumbnail\">" +
                        //                     "<img onclick=\"youtubevideo('" + videoid + "')\" alt=\"\" src=\"" + thumbnail + "\">" +
                        //                     "</div><span class=\"pull-left\"><a href=\"#\"> &nbsp;<i class=\"icon-eye-open\"></i></a>" +
                        //                     "</span></div></div>";

                        strYoutubechanell1 += "<div class=\"span3\">" +
                                            "<div class=\"span box whitebg tumb_bg\">" +
                                             "<div class=\"yt_title\"></div><div class=\"video-containers thumbnail\">" +
                                             "<img onclick=\"youtubevideo('" + videoid + "')\" alt=\"\" src=\"" + thumbnail + "\">" +
                                             "</div><div class=\"icons\" style=\"width: 225px; float: left;\"><span class=\"span6 pull-left\">" +
                                             "<a href=\"#\" style=\"float: left;\"> &nbsp;<i style=\"color: green;\" class=\"icon-hand-up\"></i></a><span class=\"pull-left\">" + likeCount + "</span></a><a href=\"#\" style=\"float: left;\"> &nbsp;<i style=\"color: red;\" class=\"icon-hand-down\"></i><span>" + dislikeCount + "</span>" +
                                             "</a></span><span class=\"pull-right\"><a href=\"#\"> &nbsp;<i style=\"color: red;\" class=\"icon-eye-open\"></i><span>" + viewCount + "</span></a></span></div><div class=\"yt_description\"></div></div></div>";


                        try
                        {

                            if (rowCount == 3)
                            {
                                //strYoutubechanell += " <div class=\"row space\">" + strYoutubechanell1 + "</div></div></div>";
                                strYoutubechanell += " <div class=\"row space\">" + strYoutubechanell1 + "</div>";
                                strYoutubechanell1 = string.Empty;
                                rowCount = 0;
                            }
                            else
                            {
                                rowCount++;
                            }
                            if (!strYoutubechanell.Contains(strYoutubechanell1) && array.Count == columnCount)
                            {
                                //strYoutubechanell += " <div class=\"row space\">" + strYoutubechanell1 + "</div></div>";
                                strYoutubechanell += " <div class=\"row space\">" + strYoutubechanell1 + "</div>";
                            }

                        }
                        catch (Exception)
                        {

                        }



                        //strYoutubechanell += "<div class=\"span3\" class=\"row-fluid\"><div class=\"span12 box whitebg feedwrap\"><div class=\"topicon\"><div class=\"pull-left\">" +

                        //                                        "</div><div class=\"pull-right\" id=\"like\"><a title=\"\" href=\"#\" onClick=\"LikePic()\" ></a><a title=\"\" href=\"#\"></a>" +
                        //                                        "</div></div><div class=\"pic\"><img onclick=\"youtubevideo('" + videoid + "')\" alt=\"\" src=\"" + thumbnail + "\"></div><div class=\"desc\"><p></p><span class=\"pull-left span3\">" +
                        //                                        "<img width=\"12\" alt=\"\" src=\"../Contents/img/admin/dil.png\"></span><div class=\"clearfix\">" +
                        //                                        "</div>";



                        //strYoutubechanell += "</div></div></div>";



                    }

                    Response.Write("<div id=\"ACT\" class=\"tab-pane active\"><div class=\"container yt_details\">" + strYoutubechanell + "\"</div></div>");

                    #endregion
                }

                //ACTIVITIES
                else if (Request.QueryString["op"] == "youtubeactivity")
                {
                    #region youtube_ACTIVITIES

                    string strYoutubechanell = string.Empty;
                    string GooglePlusUserId = Request.QueryString["profileid"];
                    string accesstoken = Request.QueryString["accesstoken"];
                    oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube();
                    string finaltoken = objoAuthTokenYoutube.GetAccessToken(accesstoken);
                    string strfinaltoken = string.Empty;

                    try
                    {

                        if (!finaltoken.StartsWith("["))
                            finaltoken = "[" + finaltoken + "]";
                        JArray objArray = JArray.Parse(finaltoken);


                        foreach (var item in objArray)
                        {
                            try
                            {

                                strfinaltoken = item["access_token"].ToString();

                                break;

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

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


                    YoutubeChannel objChnnelData = ytrchannelrpo.getYoutubeChannelDetailsById(GooglePlusUserId);
                    GlobusGooglePlusLib.Youtube.Core.Activities objActivities = new Activities();
                    string objDetails = objActivities.Get_All_Activities(strfinaltoken, oAuthTokenYoutube.Parts.snippet, true, 50);

                    JObject obj = JObject.Parse(objDetails);

                    JArray array = (JArray)obj["items"];

                    int rowCount = 0;
                    int columnCount = 0;

                    strYoutubechanell = "";

                    string strYoutubechanell1 = string.Empty;

                    foreach (var item in array)
                    {
                        string title = string.Empty;
                        string description = string.Empty;
                        string thumbnail = string.Empty;
                        string videoid = string.Empty;

                        columnCount++;

                        #region << Title >>

                        try
                        {
                            title = item["snippet"]["title"].ToString();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);

                        }
                        #endregion

                        #region << Description >>

                        try
                        {
                            description = item["snippet"]["description"].ToString();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);

                        }
                        #endregion

                        #region  << Thumbnail >>

                        try
                        {
                            thumbnail = item["snippet"]["thumbnails"]["maxres"]["url"].ToString();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);

                        }
                        if (string.IsNullOrEmpty(thumbnail))
                        {

                            try
                            {
                                thumbnail = item["snippet"]["thumbnails"]["high"]["url"].ToString();
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.StackTrace);
                            }
                        }
                        #endregion

                        try
                        {
                            videoid = item["snippet"]["resourceId"]["videoId"].ToString();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }


                        string viewCount = string.Empty;
                        string likeCount = string.Empty;
                        string dislikeCount = string.Empty;
                        string favoriteCount = string.Empty;
                        string commentCount = string.Empty;
                        if (!string.IsNullOrEmpty(videoid))
                        {

                            try
                            {
                                GlobusGooglePlusLib.Youtube.Core.Video ObjClsVideo = new Video();

                                string videoDetails = ObjClsVideo.Get_VideoDetails_byId(videoid, strfinaltoken, "snippet,statistics");

                                JObject JobjvideoDetails = JObject.Parse(videoDetails);

                                var JArrvideoDetails = (JArray)(JobjvideoDetails["items"]);

                                foreach (var DataVal in JArrvideoDetails)
                                {
                                    viewCount = DataVal["statistics"]["viewCount"].ToString();
                                    likeCount = DataVal["statistics"]["likeCount"].ToString();
                                    dislikeCount = DataVal["statistics"]["dislikeCount"].ToString();
                                    favoriteCount = DataVal["statistics"]["favoriteCount"].ToString();
                                    commentCount = DataVal["statistics"]["commentCount"].ToString();
                                    break;
                                }


                            }
                            catch (Exception)
                            {
                            }

                        }


                        if (string.IsNullOrEmpty(title) && thumbnail.EndsWith("hq1.jpg") && string.IsNullOrEmpty(videoid) && string.IsNullOrEmpty(description))
                        {
                            continue;
                        }



                        strYoutubechanell1 += "<div class=\"span3\">" +
                                              "<div class=\"span box whitebg tumb_bg\">" +
                                             "<div class=\"yt_title\">" + title + "</div><div class=\"video-containers thumbnail\">" +
                                             "<img onclick=\"youtubevideo('" + videoid + "')\" alt=\"\" src=\"" + thumbnail + "\">" +
                                             "</div><div class=\"yt_description\">" + description + "</div></div></div>";



                        try
                        {
                            if (rowCount == 3)
                            {
                                strYoutubechanell += " <div class=\"row space\">" + strYoutubechanell1 + "</div>";
                                strYoutubechanell1 = string.Empty;
                                rowCount = 0;
                            }
                            else
                            {
                                rowCount++;
                            }
                            if (!strYoutubechanell.Contains(strYoutubechanell1) && array.Count == columnCount)
                            {
                                strYoutubechanell += " <div class=\"row space\">" + strYoutubechanell1 + "</div>";
                            }
                        }
                        catch (Exception)
                        {

                        }
                    }

                    Response.Write(strYoutubechanell);

                    #endregion
                }
                //SUBSCRIBTIONS
                else if (Request.QueryString["op"] == "youtubesubscribe")
                {
                    #region youtube_SUBSCRIBE

                    string strYoutubechanell = string.Empty;
                    string GooglePlusUserId = Request.QueryString["profileid"];
                    string accesstoken = Request.QueryString["accesstoken"];
                    oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube();
                    string finaltoken = objoAuthTokenYoutube.GetAccessToken(accesstoken);
                    string strfinaltoken = string.Empty;

                    try
                    {

                        if (!finaltoken.StartsWith("["))
                            finaltoken = "[" + finaltoken + "]";
                        JArray objArray = JArray.Parse(finaltoken);


                        foreach (var item in objArray)
                        {
                            try
                            {

                                strfinaltoken = item["access_token"].ToString();

                                break;

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

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


                    Subscriptions _Subscriptions = new Subscriptions();


                    string _strSubscriptions = _Subscriptions.Get_Subscriptions_List(strfinaltoken, oAuthTokenYoutube.Parts.snippet.ToString());

                    //YoutubeChannel objChnnelData = ytrchannelrpo.getYoutubeChannelDetailsById(GooglePlusUserId);
                    //GlobusGooglePlusLib.Youtube.Core.Activities objActivities = new Activities();
                    //string objDetails = objActivities.Get_All_Activities(strfinaltoken, oAuthTokenYoutube.Parts.snippet, true, 50);

                    JObject obj = JObject.Parse(_strSubscriptions);

                    JArray array = (JArray)obj["items"];

                    int rowCount = 0;
                    int columnCount = 0;

                    strYoutubechanell = "";

                    string strYoutubechanell1 = string.Empty;

                    foreach (var item in array)
                    {
                        string title = string.Empty;
                        string description = string.Empty;
                        string _resoucechannelId = string.Empty;
                        string thumbnail = string.Empty;

                        columnCount++;

                        #region << Title >>

                        try
                        {
                            title = item["snippet"]["title"].ToString();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);

                        }
                        #endregion

                        #region << Description >>

                        try
                        {
                            description = item["snippet"]["description"].ToString();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);

                        }
                        #endregion

                        #region  << Thumbnail >>

                        try
                        {
                            thumbnail = item["snippet"]["thumbnails"]["maxres"]["url"].ToString();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);

                        }
                        if (string.IsNullOrEmpty(thumbnail))
                        {

                            try
                            {
                                thumbnail = item["snippet"]["thumbnails"]["high"]["url"].ToString();
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.StackTrace);
                            }
                        }
                        #endregion

                        try
                        {
                            _resoucechannelId = item["snippet"]["resourceId"]["channelId"].ToString();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }


                        string viewCount = string.Empty;
                        string subscriberCount = string.Empty;
                        string hiddenSubscriberCount = string.Empty;
                        string videoCount = string.Empty;
                        string commentCount = string.Empty;
                        if (!string.IsNullOrEmpty(_resoucechannelId))
                        {

                            try
                            {
                                GlobusGooglePlusLib.Youtube.Core.Channels _Channels = new Channels();

                                string videoDetails = _Channels.Get_Channel_List(strfinaltoken, (oAuthTokenYoutube.Parts.snippet.ToString() + "," + oAuthTokenYoutube.Parts.statistics.ToString()), _resoucechannelId);

                                JObject JobjvideoDetails = JObject.Parse(videoDetails);

                                var JArrvideoDetails = (JArray)(JobjvideoDetails["items"]);

                                foreach (var DataVal in JArrvideoDetails)
                                {
                                    viewCount = DataVal["statistics"]["viewCount"].ToString();
                                    subscriberCount = DataVal["statistics"]["subscriberCount"].ToString();
                                    hiddenSubscriberCount = DataVal["statistics"]["hiddenSubscriberCount"].ToString();
                                    videoCount = DataVal["statistics"]["videoCount"].ToString();
                                    commentCount = DataVal["statistics"]["commentCount"].ToString();
                                    break;
                                }


                            }
                            catch (Exception)
                            {
                            }

                        }



                        //strYoutubechanell1 += "<div class=\"span3\">" +
                        //                      "<div class=\"span box whitebg tumb_bg\">" +
                        //                     "<div class=\"yt_title\">" + title + "</div><div class=\"video-containers thumbnail\">" +
                        //                     "<img onclick=\"#\" alt=\"\" src=\"" + thumbnail + "\">" +
                        //                     "</div><div class=\"icons\" style=\"width: 225px; float: left;\"><span class=\"span6 pull-left\">" +
                        //                     "<a href=\"#\" style=\"float: left;\"> &nbsp;<i style=\"color: green;\" class=\"icon-facetime-video\"></i></a>" +
                        //                     "<span class=\"pull-left\">&nbsp;" + videoCount + "</span></a><a href=\"#\" style=\"float: left;\"> &nbsp;<i style=\"color: red;\" class=\"icon-comment\"></i>" +
                        //                     "<span>&nbsp;" + commentCount + "</span></a></span><span class=\"pull-right\"><a href=\"#\"> &nbsp;<i style=\"color: red; padding-right: 5px;\" class=\"icon-eye-open\"></i><span>&nbsp;" + viewCount + "</span></a>" +
                        //                     "</span></div><div class=\"yt_description\">" + description + "</div></div></div>";


                        strYoutubechanell1 += "<div class=\"span3\">" +
                                             "<div class=\"span box whitebg tumb_bg\">" +
                                            "<div class=\"yt_title\">" + title + "</div><div class=\"video-containers thumbnail\">" +
                                            "<img onclick=\"#\" alt=\"\" src=\"" + thumbnail + "\">" +
                                            "</div><div class=\"icons\" style=\"width: 225px; float: left;\"><span class=\"span7 pull-left\">" +
                                            "<a href=\"#\" style=\"float: left;\"> &nbsp;<i style=\"color: green;\" class=\"icon-facetime-video\"></i></a>" +
                                            "<span class=\"pull-left\">&nbsp;" + ConvertMillionAndBillion(videoCount) + "</span></a><a href=\"#\" style=\"float: left;\"> &nbsp;<i style=\"color: red;\" class=\"icon-comment\"></i>" +
                                            "<span>&nbsp;" + ConvertMillionAndBillion(commentCount) + "</span></a></span><span class=\"pull-right\"><a href=\"#\"> &nbsp;<i style=\"color: red; padding-right: 5px;\" class=\"icon-eye-open\"></i><span>&nbsp;" + ConvertMillionAndBillion(viewCount) + "</span></a>" +
                                            "</span></div><div class=\"yt_description\">" + description + "</div></div></div>";


                        try
                        {
                            if (rowCount == 3)
                            {
                                strYoutubechanell += " <div class=\"row space\">" + strYoutubechanell1 + "</div>";
                                strYoutubechanell1 = string.Empty;
                                rowCount = 0;
                            }
                            else
                            {
                                rowCount++;
                            }
                            if (!strYoutubechanell.Contains(strYoutubechanell1) && array.Count == columnCount)
                            {
                                strYoutubechanell += " <div class=\"row space\">" + strYoutubechanell1 + "</div>";
                            }
                        }
                        catch (Exception)
                        {

                        }
                    }

                    Response.Write(strYoutubechanell);

                    #endregion
                }
                else if (Request.QueryString["op"] == "linkedinfeeds")
                {
                    #region linkedinfeeds
                    string profileid = Request.QueryString["profileid"];
                    LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository();
                    LinkedInAccount linkacc = linkedinAccRepo.getUserInformation(profileid);
                    oAuthLinkedIn oauthlin = new oAuthLinkedIn();
                    oauthlin.ConsumerKey = ConfigurationManager.AppSettings["LiApiKey"];
                    oauthlin.ConsumerSecret = ConfigurationManager.AppSettings["LiSecretKey"];
                    oauthlin.FirstName = linkacc.LinkedinUserName;
                    oauthlin.Id = linkacc.LinkedinUserId;
                    oauthlin.Token = linkacc.OAuthToken;
                    oauthlin.TokenSecret = linkacc.OAuthSecret;
                    oauthlin.Verifier = linkacc.OAuthVerifier;


                    LinkedInUser l = new LinkedInUser();
                    List<LinkedInUser.User_Updates> lst = l.GetUserUpdates(oauthlin, linkacc.LinkedinUserId, 10);
                    string message = string.Empty;
                    if (lst.Count != 0)
                    {
                        foreach (LinkedInUser.User_Updates item in lst)
                        {
                            try
                            {
                                string picurl = string.Empty;
                                if (string.IsNullOrEmpty(item.PictureUrl))
                                {
                                    picurl = "../Contents/img/blank_img.png";
                                }
                                else
                                {
                                    picurl = item.PictureUrl;
                                }
                                message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + picurl + "\">" +
                                                                       "</div><div class=\"pull-left feedcontent\">" +
                                                                          "<a href=\"" + linkacc.ProfileUrl + "\" target=\"_blank\" class=\"feednm\">" + item.PersonFirstName + " " + item.PersonLastName + "</a> <span>" + item.DateTime +
                                                                              " </span>" +
                                                                           "<p>" + item.Message + "</p>" +
                                                                           "<a class=\"retweets\" href=\"#\">" +
                                                                           "</a><span></span>" +
                                                                       "</div>" +
                                                                   "</li>";
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.Message);
                            }

                        }
                    }
                    else
                    {
                        message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" +
                                                                                             "</div><div class=\"pull-left feedcontent\">" +
                                                                                                "<a href=\"#\" class=\"feednm\"></a> <span>" +
                                                                                                    " </span>" +
                                                                                                 "<p>No Messages Found</p>" +
                                                                                                 "<a class=\"retweets\" href=\"#\">" +
                                                                                                  "</a><span></span>" +
                                                                                             "</div>" +
                                                                                         "</li>";
                    }
                    Response.Write(message);
                    #endregion
                }
                else if (Request.QueryString["op"] == "facebookapi")
                {
                    #region facebookapi
                    try
                    {
                        string profileid = Request.QueryString["profileid"];
                        // FacebookAccountRepository facerepo = new FacebookAccountRepository();
                        FacebookAccount faceaccount = facerepo.getFacebookAccountDetailsById(profileid);
                        FacebookHelper fbhelper = new FacebookHelper();
                        FacebookClient fbclient = new FacebookClient(faceaccount.AccessToken);
                        dynamic profile = fbclient.Get("me");
                        var feeds = fbclient.Get("/me/feed");
                        var home = fbclient.Get("me/home");
                        fbhelper.getFacebookUserFeeds(feeds, profile);
                        fbhelper.getFacebookUserHome(home, profile);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        Console.WriteLine(ex.Message);
                    }
                    #endregion
                }
                else if (Request.QueryString["op"] == "twitterapi")
                {
                    string profileid = Request.QueryString["profileid"];
                    TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository();
                    TwitterAccount twtAccount = twtAccountRepo.getUserInformation(user.Id, profileid);
                    oAuthTwitter oAuth = new oAuthTwitter();
                    TwitterHelper twthelper = new TwitterHelper();
                    oAuth.AccessToken = twtAccount.OAuthToken;
                    oAuth.AccessTokenSecret = twtAccount.OAuthSecret;
                    twthelper.SetCofigDetailsForTwitter(oAuth);
                    oAuth.TwitterScreenName = twtAccount.TwitterScreenName;
                    oAuth.TwitterUserId = twtAccount.TwitterUserId;
                    twthelper.getUserTweets(oAuth, twtAccount, user.Id);
                    twthelper.getUserFeed(oAuth, twtAccount, user.Id);
                    twthelper.getSentDirectMessages(oAuth, twtAccount, user.Id);
                    twthelper.getReTweetsOfUser(oAuth, twtAccount, user.Id);

                }
                else if (Request.QueryString["op"] == "instagramlike")
                {
                    string mediaid = Request.QueryString["mediaid"];
                    bool b = this.likefunction(mediaid, Request.QueryString["userid"], Request.QueryString["access"]);
                }
                else if (Request.QueryString["op"] == "instagramunlike")
                {
                    string mediaid = Request.QueryString["mediaid"];
                    bool b = this.unlikefunction(mediaid, Request.QueryString["userid"], Request.QueryString["access"]);

                }
                else if (Request.QueryString["op"] == "instagramimages")
                {
                    if (Request.QueryString["loadtime"] != "first")
                    {
                        instagramcount = instagramcount + 10;
                    }
                    else
                    {
                        instagramcount = 0;
                    }

                    InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository();
                    InstagramFeedRepository objInsFeedRepo = new InstagramFeedRepository();
                    InstagramFeed objInsFeed = new InstagramFeed();
                    InstagramCommentRepository objInsCmtRepo = new InstagramCommentRepository();
                    List<SocioBoard.Domain.InstagramComment> lstInsCmt = new List<SocioBoard.Domain.InstagramComment>();

                    string strInsImage = string.Empty;

                    try
                    {
                        string profileid = Request.QueryString["profileid"];
                        InstagramAccount insaccount = objInsAccRepo.getInstagramAccountDetailsById(profileid, user.Id);
                        List<InstagramFeed> lstInsFeed = objInsFeedRepo.getAllInstagramFeedsOfUser(user.Id, profileid, instagramcount);
                        if (lstInsFeed.Count != 0)
                        {
                            strInsImage += "<div class=\"feedcontainer\">";
                            foreach (InstagramFeed feed in lstInsFeed)
                            {

                                try
                                {
                                    lstInsCmt = objInsCmtRepo.getAllInstagramCommentsOfUser(user.Id, profileid, feed.FeedId);
                                }
                                catch (Exception ex)
                                {
                                    logger.Error(ex.Message);
                                    Console.WriteLine(ex.Message);
                                }
                                try
                                {
                                    strInsImage += "<div class=\"span3\" class=\"row-fluid\"><div class=\"span12 box whitebg feedwrap\"><div class=\"topicon\"><div class=\"pull-left\">" +

                                                                    "</div><div class=\"pull-right\" id=\"like\"><a title=\"\" href=\"#\" onClick=\"insUser('" + feed.FeedId + "','" + insaccount.AccessToken + "')\" ><img id=\"heartEmpty_" + feed.FeedId + "\" width=\"14\" alt=\"\" src=\"../Contents/img/admin/heart-empty.png\"  style=\"margin-top: 9px;\"></a><a title=\"\" href=\"#\"><img width=\"14\" alt=\"\" src=\"../Contents/img/admin/speech-bubble-left.png\"  style=\"margin-top: 9px;\"></a>" +
                                                                    "</div></div><div class=\"pic\"><img alt=\"\" src=\"" + feed.FeedImageUrl + "\"></div><div class=\"desc\"><p></p><span class=\"pull-left span3\">" +
                                                                    "<img width=\"12\" alt=\"\" src=\"../Contents/img/admin/heart-empty.png\"> " + feed.LikeCount + "</span><span class=\"pull-left span3\"><img width=\"12\" alt=\"\" src=\"../Contents/img/admin/speech-bubble-left.png\"> " + lstInsCmt.Count + "</span><div class=\"clearfix\"></div>";

                                    foreach (InstagramComment insCmt in lstInsCmt)
                                    {
                                        try
                                        {
                                            strInsImage += "<div class=\"userprof\"><div class=\"pull-left\"><a href=\"#\">" +
                                              "<img width=\"36\" alt=\"\" src=\"" + insCmt.FromProfilePic + "\"></a></div><div class=\"pull-left descr\"><p>" + insCmt.Comment + "</p>" +
                                               "<span class=\"usert\">" + DateExtension.ToDateTime(DateTime.Now, (long)Convert.ToDouble(insCmt.CommentDate)) + "</span></div></div>";

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

                                    }

                                    strInsImage += "</div></div></div>";
                                }
                                catch (Exception ex)
                                {
                                    logger.Error(ex.Message);
                                    Console.WriteLine(ex.Message);
                                }
                            }
                            strInsImage += "</div>";
                        }
                        else
                        {
                            if (instagramcount == 0)
                            {
                                strInsImage = "<div class=\"grid\"><div class=\"box whitebg feedwrap\">" +
                                             "<div class=\"topicon\"><div class=\"pull-left\"></div><div class=\"pull-right\">" +
                                 "<a href=\"#\" title=\"\"></a><a href=\"#\" title=\"\"></a></div></div><div class=\"pic\">" +
                                 "<img src=\"../Contents/img/no_image_found.png\" alt=\"\"></div><div class=\"desc\"><p></p></div></div></div>";
                            }
                        }


                        Response.Write(strInsImage);


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

                }
                else if (Request.QueryString["op"] == "instagramApi")
                {
                    try
                    {
                        InstagramManager insManager = new InstagramManager();
                        string profileid = Request.QueryString["profileid"];
                        InstagramAccountRepository insAccRepo = new InstagramAccountRepository();
                        InstagramAccount instagramAccount = insAccRepo.getInstagramAccountDetailsById(profileid, user.Id);
                        insManager.getIntagramImages(instagramAccount);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        Console.WriteLine(ex.Message);
                    }
                }



                else if (Request.QueryString["op"] == "UnfollowTumblrBlog")
                {
                    try
                    {
                        string blogname = Request.QueryString["blogname"].ToString();
                        string profileid = Request.QueryString["profileid"];
                        string accesstoken = Request.QueryString["accesstoken"];
                        string accesstokensecret = Request.QueryString["accesstokensecret"];
                        Guid id = Guid.Parse(Request.QueryString["id"]);
                        try
                        {
                            string msg = "success";
                            BlogsFollowers objunfollowblog = new BlogsFollowers();
                            objunfollowblog.Unfollowblog(accesstoken, accesstokensecret, blogname);
                            int result = objTumblrFeedRepository.DeleteTumblrDataByProfileid(profileid, blogname);
                            Response.Write(msg);

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

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

                }


                else if (Request.QueryString["op"] == "tumblrTextPost")
                {

                    try
                    {
                        string ProfileId = Request.QueryString["profileid"].ToString();
                        string body = Request.QueryString["msg"].ToString();
                        string title = Request.QueryString["title"].ToString();
                        TumblrAccount objTumblrAccount = tumblraccrepo.getTumblrAccountDetailsById(ProfileId);
                        PublishedPosts objPublishedPosts = new PublishedPosts();
                        objPublishedPosts.PostData(objTumblrAccount.tblrAccessToken, objTumblrAccount.tblrAccessTokenSecret, ProfileId, body, title, "text");

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

                }


                else if (Request.QueryString["op"] == "tumblrQuotePost")
                {

                    try
                    {
                        string ProfileId = Request.QueryString["profileid"].ToString();
                        string source = Request.QueryString["source"].ToString();
                        string quote = Request.QueryString["quote"].ToString();
                        TumblrAccount objTumblrAccount = tumblraccrepo.getTumblrAccountDetailsById(ProfileId);
                        PublishedPosts objPublishedPosts = new PublishedPosts();
                        objPublishedPosts.PostData(objTumblrAccount.tblrAccessToken, objTumblrAccount.tblrAccessTokenSecret, ProfileId, source, quote, "quote");


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

                }

                else if (Request.QueryString["op"] == "tumblrLinkPost")
                {

                    try
                    {
                        string ProfileId = Request.QueryString["profileid"].ToString();
                        string linkurl = Request.QueryString["linkurl"].ToString();
                        string title = Request.QueryString["title"].ToString();
                        string description = Request.QueryString["description"].ToString();
                        TumblrAccount objTumblrAccount = tumblraccrepo.getTumblrAccountDetailsById(ProfileId);
                        PublishedPosts objPublishedPosts = new PublishedPosts();
                        objPublishedPosts.PostdescriptionData(objTumblrAccount.tblrAccessToken, objTumblrAccount.tblrAccessTokenSecret, ProfileId, linkurl, title, description, "link");


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

                }





                else if (Request.QueryString["op"] == "tumblrImagePost")
                {
                    string caption = string.Empty;

                    try
                    {
                        string ProfileId = Request.QueryString["profileid"].ToString();
                        try
                        {
                            caption = Request.QueryString["caption"].ToString();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        var fi = Request.Files["file"];

                        string file = string.Empty;
                        if (fi != null)
                        {
                            var path = Server.MapPath("~/Contents/img/upload");
                            file = path + "/" + fi.FileName;
                            if (!Directory.Exists(path))
                            {
                                Directory.CreateDirectory(path);
                            }
                            fi.SaveAs(file);
                        }

                        string filepath = file;

                        TumblrAccount objTumblrAccount = tumblraccrepo.getTumblrAccountDetailsById(ProfileId);
                        PublishedPosts objPublishedPosts = new PublishedPosts();
                        objPublishedPosts.PostData(objTumblrAccount.tblrAccessToken, objTumblrAccount.tblrAccessTokenSecret, ProfileId, caption, filepath, "photo");

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

                }



                else if (Request.QueryString["op"] == "tumblrAudioPost")
                {
                    string caption = string.Empty;

                    try
                    {
                        string ProfileId = Request.QueryString["profileid"].ToString();

                        var fi = Request.Files["file"];

                        string file = string.Empty;
                        if (fi != null)
                        {
                            var path = Server.MapPath("~/Contents/img/upload");
                            file = path + "/" + fi.FileName;
                            //if (!Directory.Exists(path))
                            //{
                            //    Directory.CreateDirectory(path);
                            //}
                            //fi.SaveAs(file);
                        }

                        string filepath = file;

                        TumblrAccount objTumblrAccount = tumblraccrepo.getTumblrAccountDetailsById(ProfileId);
                        PublishedPosts objPublishedPosts = new PublishedPosts();
                        objPublishedPosts.PostAudioData(objTumblrAccount.tblrAccessToken, objTumblrAccount.tblrAccessTokenSecret, ProfileId, filepath, "audio");

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


                }



                else if (Request.QueryString["op"] == "tumblrVideoPost")
                {
                    string caption = string.Empty;

                    try
                    {
                        string ProfileId = Request.QueryString["profileid"].ToString();
                        string VideoUrl = Request.QueryString["VideoUrl"].ToString();
                        string VideoContent = Request.QueryString["VideoContent"].ToString();

                        var fi = Request.Files["file"];

                        string file = string.Empty;
                        if (fi != null)
                        {
                            var path = Server.MapPath("~/Contents/img/upload");
                            file = path + "/" + fi.FileName;
                            if (!Directory.Exists(path))
                            {
                                Directory.CreateDirectory(path);
                            }
                            fi.SaveAs(file);
                        }

                        string filepath = file;

                        TumblrAccount objTumblrAccount = tumblraccrepo.getTumblrAccountDetailsById(ProfileId);
                        PublishedPosts objPublishedPosts = new PublishedPosts();
                        objPublishedPosts.PostdescriptionData(objTumblrAccount.tblrAccessToken, objTumblrAccount.tblrAccessTokenSecret, ProfileId, filepath, VideoUrl, VideoContent, "video");

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


                }

                else if (Request.QueryString["op"] == "tumblrChatPost")
                {

                    try
                    {
                        string ProfileId = Request.QueryString["profileid"].ToString();
                        string body = Request.QueryString["body"].ToString();
                        string title = Request.QueryString["title"].ToString();
                        string tag = Request.QueryString["tag"].ToString();
                        TumblrAccount objTumblrAccount = tumblraccrepo.getTumblrAccountDetailsById(ProfileId);
                        PublishedPosts objPublishedPosts = new PublishedPosts();
                        objPublishedPosts.PostdescriptionData(objTumblrAccount.tblrAccessToken, objTumblrAccount.tblrAccessTokenSecret, ProfileId, body, title, tag, "chat");


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

                }













                else if (Request.QueryString["op"] == "LikeUnlikeTumblrImage")
                {

                    int likestatus = Convert.ToInt16(Request.QueryString["likes"]);
                    string profileid = Request.QueryString["profileid"];
                    string accesstoken = Request.QueryString["accesstoken"];
                    string accesstokensecret = Request.QueryString["accesstokensecret"];
                    Guid id = Guid.Parse(Request.QueryString["id"]);
                    int notes = Convert.ToInt16(Request.QueryString["notes"]);


                    try
                    {
                        int like = 0;
                        if (likestatus == 0)
                        {
                            like = 1;
                        }
                        int i = objTumblrFeedRepository.UpdateDashboardOfProfileLikes(profileid, id, like);

                        int s = objTumblrFeedRepository.UpdateDashboardOfProfileNotes(profileid, id, like, notes);

                        TumblrFeed obj = objTumblrFeedRepository.getFeedOfProfilebyIdProfileId(profileid, id);
                        BlogsLikes objBlogsLikes = new BlogsLikes();

                        objBlogsLikes.likeBlog(accesstoken, accesstokensecret, obj.blogId, obj.reblogkey, like);


                        //KeyValuePair<string, string> LoginDetails = new KeyValuePair<string, string>(accesstoken, accesstokensecret);
                        //var prms = new Dictionary<string, object>();
                        //prms.Add("id", obj.blogId);
                        //prms.Add("reblog_key", obj.reblogkey);
                        //var postUrl = "";

                        //if (like == 1)
                        //{
                        //    postUrl = "https://api.tumblr.com/v2/user/like/";
                        //}
                        //else
                        //{
                        //    postUrl = "https://api.tumblr.com/v2/user/unlike/";
                        //}
                        //string result = oAuthTumbler.OAuthData(postUrl, "POST", LoginDetails.Key, LoginDetails.Value, prms);

                        //string result1 = string.Empty;
                        //result1 = result;
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        Console.WriteLine(ex.Message);
                    }
                }
            }
        }
コード例 #6
0
 public async Task <IDataResult <InstaUserShortList> > Get(string username)
 {
     return(await InstagramManager.GetUnfollowers(username, _config));
 }
コード例 #7
0
ファイル: frm_stagram.cs プロジェクト: workad009/gramboard
        private void unfollowAccount(ref InstagramManager.Classes.InstagramAccountManager accountManager, string account)
        {
            string pageSource = string.Empty;
            string response = string.Empty;
            string profileId = string.Empty;
            const string websta = "http://websta.me/api/relationships/";
            const string accountUrl = "http://websta.me/n/";
            try
            {
                try
                {
                    UnfollowListListThread.Add(Thread.CurrentThread);
                    UnfollowListListThread.Distinct();
                    Thread.CurrentThread.IsBackground = true;
                }
                catch
                {
                }
                try
                {

                    pageSource = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(accountUrl + account), "", 80, "", "");
                }
                catch { };
                if (!string.IsNullOrEmpty(pageSource))
                {
                    if (pageSource.Contains("<ul class=\"list-inline user-"))
                    {
                        try
                        {
                            profileId = ScrapUserName.getBetween(pageSource, "<ul class=\"list-inline user-", "\">");
                        }
                        catch { }
                        if (!string.IsNullOrEmpty(profileId) && NumberHelper.ValidateNumber(profileId))
                        {
                            try
                            {
                                response = accountManager.httpHelper.postFormData(new Uri(websta + profileId), "action=unfollow", accountUrl + account, "");
                            }
                            catch { }
                            if (!string.IsNullOrEmpty(response) && response.Contains("OK"))
                            {
                                if (_boolStopUnfollow) return;
                                string status = string.Empty;
                                try
                                {
                                    status = QueryExecuter.getFollowStatus(accountManager.Username, account);

                                    switch (status)
                                    {
                                        //case "Followed": QueryExecuter.updateFollowStatus(accountManager.Username, account, "Unfollowed");
                                        case "Followed": QueryExecuter.updateFollowStatus(accountManager.Username, account, "Unfollowed");
                                            AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ Unfollowed " + account + " from " + accountManager.Username + " ]");
                                            break;
                                        case "Unfollowed":
                                            AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ Not Followed " + account + " from " + accountManager.Username + " ]");
                                            break;
                                        default:
                                            AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ " + account + " = Unfollowed " + accountManager.Username + " ]");
                                            QueryExecuter.updateFollowStatus(accountManager.Username, account, "Unfollowed");
                                            break;
                                    }

                                }
                                catch { }

                                //AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ Unfollowed " + account + " from " + accountManager.Username + " ]");
                            }
                            else
                            {
                                if (_boolStopUnfollow) return;
                                AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ Could not Unfollow " + account + " from " + accountManager.Username + " ]");
                            }
                        }
                    }
                }
                else
                {
                    AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ The remote server returned an error: (404) Not Found. " + account + " from " + accountManager.Username + " ]");
                }
            }
            catch (Exception ex)
            {
                GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment);
                GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => unfollowAccount :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForComment);
                GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment);
            }
        }
コード例 #8
0
ファイル: frm_stagram.cs プロジェクト: workad009/gramboard
        private void unFollow(ref InstagramManager.Classes.InstagramAccountManager accountManager, string userId, string proxyAddress, string proxyPort)
        {
            List<string> lstToUnfollow = new List<string>();
            List<string> lstGetFollowing = new List<string>();
            List<string> lstGetFollower = new List<string>();
            List<string> lstFollowFromDatabase = new List<string>();

            //Get List From Database
            if (_boolStopUnfollow) return;
            lstFollowFromDatabase = getDataList(accountManager.Username);
            lstFollowFromDatabase = lstFollowFromDatabase.Distinct().ToList();

            //Getting all the following List
            if (_boolStopUnfollow) return;
            AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ Getting all following List for " + accountManager.Username + " ]");
            lstGetFollowing = getFollowing(ref accountManager, "follows", userId, proxyAddress, proxyPort);
            lstGetFollowing = lstGetFollowing.Distinct().ToList();

            //Get all the follower List
            if (_boolStopUnfollow) return;
            AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ Getting all follower List for " + accountManager.Username + " ]");
            lstGetFollower = getFollower(ref accountManager, "followed-by", userId);
            lstGetFollower = lstGetFollower.Distinct().ToList();

            //Getting list that have not followed back
            try
            {
                if (_boolStopUnfollow) return;
                lstToUnfollow = (lstGetFollowing.Except(lstGetFollower)).ToList();
            }
            catch (Exception ex)
            {
                GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment);
                GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => unFollow :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForComment);
                GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment);
            }

            if (lstFollowFromDatabase.Count >= 0)
            {
                if (lstToUnfollow.Count >= 0)
                {
                    int count = 0;
                    foreach (string item in lstFollowFromDatabase)
                    {
                        string itemCopy = "";
                        try
                        {
                            if (item.Contains("http://websta.me/n/"))
                            {
                                itemCopy = getBetween(item, "http://websta.me/n/", "/");

                            }

                            if (lstToUnfollow.Contains(itemCopy))//lstToUnfollow
                            {
                                try
                                {
                                    unfollowAccount(ref accountManager, item);
                                }
                                catch { };
                                lock (_lockObject)
                                {
                                    if (_boolStopUnfollow) return;
                                    AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ Delaying for " + delayUnfollow + " seconds ]");
                                    Thread.Sleep(delayUnfollow * 1000);
                                }
                                count++;
                                if (count == noOfAccountUnfollow)
                                    break;
                            }
                        }
                        catch (Exception ex)
                        {
                            //GlobusFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GlobusFileHelper.ErrorLogFilePathForComment);
                            //GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => unFollow :=> " + ex.Message, GlobusFileHelper.ErrorLogFilePathForComment);
                            //GlobusFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GlobusFileHelper.ErrorLogFilePathForComment);
                        }
                    }
                }

                else
                {
                    AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ No Accounts to Unfollow for " + accountManager.Username + " ]");
                }
            }

            else
            {
                AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ None followed for " + accountManager.Username + " during specified time ]");
            }

            AddToUnfollowLogger("[ " + DateTime.Now + " ] => [ Unfollow completed with " + accountManager.Username + " ]");
        }
コード例 #9
0
ファイル: frm_stagram.cs プロジェクト: workad009/gramboard
        public void getComment(ref InstagramManager.Classes.InstagramAccountManager accountManager, string CommentIdsForMSG_item)
        {
            Queue<string> CommentIdQueue = new Queue<string>();
            Queue<string> MsgQueue = new Queue<string>();

            InstagramManager.Classes.Comments ObjComments = new Comments();
            InstagramManager.Classes.InstagramPhotoLike ObjPotoLike = new InstagramPhotoLike();
            try
            {
                //Fill MSg's In Queue List ...
                //foreach (string commentMsgList_item in ClGlobul.commentMsgList)
                //{
                //    MsgQueue.Enqueue(commentMsgList_item);
                //}

                string photoLikeresult = string.Empty;

                //If the user Choose somment all given Id from every login Accounts ...
                //Then will be choose check bOx ...
                //if (chk_MsgAllCommentId.Checked == true)
                //{
                //foreach (string CommentIdsForMSG_item in ClGlobul.CommentIdsForMSG)
                //{
                photoLikeresult = string.Empty;
                //string message = MsgQueue.Dequeue();
                string message = ClGlobul.commentMsgList[RandomNumberGenerator.GenerateRandom(0, ClGlobul.commentMsgList.Count)];
                try
                {
                    string status = ObjComments.Comment(CommentIdsForMSG_item, message, ref accountManager);
                    if (status == "success")
                    {
                        //AddToCommentLogger("[ " + DateTime.Now + " ] => [ comment is successfully posted from " + accountManager.Username + " ]");
                        AddToCommentLogger("[ " + DateTime.Now + " ] => [ " + accountManager.Username + "  comment is successfully posted from " + CommentIdsForMSG_item + " ]");
                    }
                    else
                    {
                        //AddToCommentLogger("[ " + DateTime.Now + " ] => [ comment is successfully posted from " + accountManager.Username + " ]");
                        //AddToCommentLogger("[ " + DateTime.Now + " ] => [ Failed for  posted from " + accountManager.Username + " ]");
                        AddToCommentLogger("[ " + DateTime.Now + " ] => [ " + accountManager.Username + "  comment is successfully posted from This Id " + CommentIdsForMSG_item + " ]");
                    }

                    if (chk_CommentWithLike.Checked == true)
                    {
                        try
                        {
                            //Get Photo like if user is required ....
                            photoLikeresult = ObjPotoLike.photolike(CommentIdsForMSG_item, ref accountManager);
                        }
                        catch (Exception ex)
                        {
                            //AddToCommentLogger(DateTime.Now + ":=> Methode Name :- GetComment ()- Photo like :-  " + ex.Message);
                            GramBoardProFileHelper.AppendStringToTextfileNewLine((DateTime.Now + ":=> Methode Name :- GetComment ()- Photo like :- " + ex.Message), GramBoardProFileHelper.ErrorLogFilePathForComment);
                        }

                        //Print statuse in logger
                        printStatus(accountManager.Username, status, CommentIdsForMSG_item, photoLikeresult);
                    }
                    else
                    {
                        //Print statuse in logger
                        printStatus(accountManager.Username, status, CommentIdsForMSG_item);
                    }

                    if (!string.IsNullOrEmpty(txtmindelayComment.Text) && NumberHelper.ValidateNumber(txtmindelayComment.Text))
                    {
                        mindelay = Convert.ToInt32(txtmindelayComment.Text);
                    }
                    if (!string.IsNullOrEmpty(txtmaxdelayComments.Text) && NumberHelper.ValidateNumber(txtmaxdelayComments.Text))
                    {
                        maxdelay = Convert.ToInt32(txtmaxdelayComments.Text);
                    }

                    int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                    AddToCommentLogger("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds For " + accountManager.Username + " ]");
                    Thread.Sleep(delay * 1000);
                }
                catch (Exception ex)
                {
                    //AddToCommentLogger(DateTime.Now + ":=> Methode Name => GetComment () :=> " + ex.Message);
                    GramBoardProFileHelper.AppendStringToTextfileNewLine("---------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment);
                    GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetPhotolike ()  :=> comment Error :-  " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForComment);
                    GramBoardProFileHelper.AppendStringToTextfileNewLine("---------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment);
                }

                //if (MsgQueue.Count == 0)
                //{
                //    break;
                //}
                //}

                //}

                #region From Queue
                //else
                //{
                //    /// When user is choosend single comment in single Photo Id's
                //    /// then program is Full fill this condion
                //    /// and which is Commented in one Id and one MSg
                //    /// also try to avoid duplicacy for it.
                //    if (CommentIdQueue.Count==0)
                //    {
                //        foreach (string CommentIdsForMSG_item in ClGlobul.CommentIdsForMSG)
                //        {
                //            CommentIdQueue.Enqueue(CommentIdsForMSG_item);
                //        }
                //    }

                //    while (true)
                //    {
                //        Thread.Sleep(1000);
                //        photoLikeresult = string.Empty;
                //        string CommentIdForMSG = CommentIdQueue.Dequeue();
                //        string message = "";
                //        message = MsgQueue.Dequeue();
                //        try
                //        {
                //            string status = ObjComments.Comment(CommentIdForMSG, message, ref accountManager);

                //            if (chk_CommentWithLike.Checked == true)
                //            {
                //                try
                //                {
                //                    ///..get photo like from given Id
                //                    photoLikeresult = ObjPotoLike.photolike(CommentIdForMSG, ref accountManager);
                //                }
                //                catch (Exception)
                //                {
                //                    photoLikeresult = "All ready Like";
                //                }
                //                //Print statuse in logger
                //                printStatus(accountManager.Username, status, CommentIdForMSG, photoLikeresult);
                //            }
                //            else
                //            {
                //                //Print statuse in logger
                //                printStatus(accountManager.Username, status, CommentIdForMSG);
                //            }
                //        }
                //        catch (Exception ex)
                //        {
                //            AddTophotoLogger(" Methode Name => GetLoginForComment (2) :=> " + ex.Message);
                //            AddTophotoLogger(accountManager.Username+"is not Comment to "+CommentIdForMSG);
                //            GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetLoginForComment (2) :=> " + ex.Message, GlobusFileHelper.ErrorLogFilePathForComment);
                //            GlobusFileHelper.AppendStringToTextfileNewLine(accountManager.ClientId + ":" + accountManager.Password + ":" + CommentIdForMSG, GlobusFileHelper.NotCommentedFilePath);
                //        }

                //        //if MESSAGE and Photo ID's are finished
                //        // Then break the while loop ...
                //        if (CommentIdQueue.Count == 0 || MsgQueue.Count==0)
                //        {
                //            if (CommentIdQueue.Count == 0 && MsgQueue.Count == 0)
                //            {
                //            }
                //            else if (CommentIdQueue.Count == 0)
                //                AddToCommentLogger("Photo id's are Finished ");
                //            else if (MsgQueue.Count == 0)
                //                AddToCommentLogger("Messages are Finished ");

                //            break;
                //        }

                //    }
                //}
                #endregion
            }
            catch (Exception ex)
            {
                //AddToCommentLogger(DateTime.Now + ":=> Methode Name => GetComment () :=> " + ex.Message);
                GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment);
                GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetPhotolike (2)  :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForComment);
                GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment);
            }
            finally
            {
                AddToCommentLogger("[ " + DateTime.Now + " ] => [ Comment is Finished From Account : " + accountManager.Username + " ]");
            }
        }
コード例 #10
0
ファイル: frm_stagram.cs プロジェクト: workad009/gramboard
        private void getPhotoUnlike(ref InstagramManager.Classes.InstagramAccountManager accountManager)
        {
            foreach (string itemPhotos in ClGlobul.PhotoList)
            {
                if (_boolUnlike) return;

                try
                {
                    GloBoardPro.lstThread.Add(Thread.CurrentThread);
                    Thread.CurrentThread.IsBackground = true;
                    GloBoardPro.lstThread = GloBoardPro.lstThread.Distinct().ToList();
                }
                catch { };
                try
                {
                    string pageSource = string.Empty;
                    pageSource = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri("http://websta.me/p/" + itemPhotos), "", 80, "", "");
                    if (!string.IsNullOrEmpty(pageSource))
                    {
                        string like = string.Empty;
                        if (pageSource.Contains("likeButton") & pageSource.Contains("</button>"))
                        {
                            try
                            {
                                like = ScrapUserName.getBetween(pageSource, "likeButton", "</button>");
                            }
                            catch (Exception ex)
                            {
                                GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => getPhotoUnlike :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                            }
                        }

                        if (like.Contains("Liked"))
                        {
                            string url_Unlike = "http://websta.me/api/remove_like/";
                            url_Unlike += itemPhotos;
                            string response = string.Empty;
                            response = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(url_Unlike), "", 80, "", "");

                            if (!string.IsNullOrEmpty(response))
                            {
                                if (response.Contains("OK"))
                                {
                                    if (_boolUnlike) return;
                                    AddTophotoLogger("[ " + DateTime.Now + " ] => [ Unliked " + itemPhotos + " From : " + accountManager.Username + " ]");
                                }
                                else
                                {
                                    if (_boolUnlike) return;
                                    AddTophotoLogger("[ " + DateTime.Now + " ] => [ Failed To Unlike From : " + accountManager.Username + " ]");
                                }
                            }
                            else
                            {
                                if (_boolUnlike) return;
                                AddTophotoLogger("[ " + DateTime.Now + " ] => [ Failed To Unlike From : " + accountManager.Username + " ]");
                            }

                        }//End of if (like.Contains("Liked"))

                        else
                        {
                            if (_boolUnlike) return;
                            AddTophotoLogger("[ " + DateTime.Now + " ] => [ " + itemPhotos + " is not liked previously From : " + accountManager.Username + " ]");
                        }

                        if (!string.IsNullOrEmpty(txtdelaymin.Text) && NumberHelper.ValidateNumber(txtdelaymin.Text))
                        {
                            mindelay = Convert.ToInt32(txtdelaymin.Text);
                        }
                        if (!string.IsNullOrEmpty(txtdelaymax.Text) && NumberHelper.ValidateNumber(txtdelaymax.Text))
                        {
                            maxdelay = Convert.ToInt32(txtdelaymax.Text);
                        }

                        lock (_lockObject)
                        {
                            Random rn = new Random();
                            int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                            delay = rn.Next(mindelay,maxdelay);
                            AddTophotoLogger("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds For " + accountManager.Username + " ]");
                            Thread.Sleep(delay * 1000);
                        }

                    }//End of if (!string.IsNullOrEmpty(pageSource))
                }
                catch (Exception ex)
                {
                    GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                    GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => getPhotoUnlike :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                    GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                }
            }
        }
コード例 #11
0
ファイル: frm_stagram.cs プロジェクト: workad009/gramboard
        private List<string> getFollowing(ref InstagramManager.Classes.InstagramAccountManager accountManager, string type, string userId, string ProxyAddress, string proxyPort)
        {
            const string websta = "http://websta.me/";
            List<string> lst = new List<string>();
            string pageSource = string.Empty;
            try
            {
                try
                {
                    pageSource = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(websta + type + "/" + userId), ProxyAddress, int.Parse(proxyPort), "", "");
                }
                catch
                {
                    pageSource = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(websta + type + "/" + userId), "", 80, "", "");
                }
                if (string.IsNullOrEmpty(pageSource))
                {
                    pageSource = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(websta + type + "/" + userId), ProxyAddress, int.Parse(proxyPort), "", "");
                }
                else
                {
                    pageSource = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(websta + type + "/" + userId), "", 80, "", "");
                }

                if (!string.IsNullOrEmpty(pageSource) && pageSource.Contains("<div class=\"pull-left\""))
                {
                    string[] arr = Regex.Split(pageSource, "<div class=\"pull-left\"");
                    arr = Enumerable.Skip(arr, 1).ToArray();

                    foreach (string arrItems in arr)
                    {
                        try
                        {
                            if (arrItems.Contains("<a href=\"/n/"))
                            {
                                string user = string.Empty;
                                try
                                {
                                    user = ScrapUserName.getBetween(arrItems, "<a href=\"/n/", "\"");
                                }
                                catch (Exception ex)
                                {
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => getFollowing :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForComment);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment);
                                }
                                if (!string.IsNullOrEmpty(user))
                                {
                                    lst.Add(user);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment);
                            GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => getFollowing :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForComment);
                            GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment);
                        }
                    }
                }

                #region pagination
                while (pageSource.Contains("<ul class=\"pager\">"))
                {
                    string zone = string.Empty;
                    string link = string.Empty;
                    try
                    {
                        try
                        {
                            zone = ScrapUserName.getBetween(pageSource, "<ul class=\"pager\">", "</ul>");
                        }
                        catch { }

                        #region Get Pagination Link in Variable link
                        if (!string.IsNullOrEmpty(zone) && zone.Contains("Next Page") && zone.Contains("<a href=\"/"))
                        {
                            try
                            {
                                try
                                {
                                    zone = zone.Substring(zone.LastIndexOf("<a href=\"/"));
                                }
                                catch { }
                                if (!string.IsNullOrEmpty(zone))
                                {
                                    int indexStart = zone.LastIndexOf("?");
                                    int indexEnd = zone.LastIndexOf("\"");
                                    try
                                    {
                                        link = zone.Substring(indexStart, indexEnd - indexStart);
                                    }
                                    catch { }
                                }
                            }
                            catch { }

                        }//end of if (!string.IsNullOrEmpty(zone))
                        else
                        {
                            break;
                        }
                        #endregion

                        if (!string.IsNullOrEmpty(link))
                        {
                            try
                            {
                                pageSource = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(websta + type + "/" + userId + link), "", 80, "", "");
                            }
                            catch { }
                            if (string.IsNullOrEmpty(pageSource))
                            {
                                pageSource = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(websta + type + "/" + userId + link), "", 80, "", "");
                            }

                            if (!string.IsNullOrEmpty(pageSource) && pageSource.Contains("<div class=\"pull-left\""))
                            {
                                string[] arr = Regex.Split(pageSource, "<div class=\"pull-left\"");
                                arr = Enumerable.Skip(arr, 1).ToArray();

                                foreach (string arrItems in arr)
                                {
                                    try
                                    {
                                        if (arrItems.Contains("<a href=\"/n/"))
                                        {
                                            string user = string.Empty;
                                            try
                                            {
                                                user = ScrapUserName.getBetween(arrItems, "<a href=\"/n/", "\"");
                                            }
                                            catch { }
                                            if (!string.IsNullOrEmpty(user))
                                            {
                                                lst.Add(user);
                                            }
                                        }
                                    }
                                    catch { }
                                }
                            }
                            else
                            {
                                //Exit from the while loop
                                break;
                            }

                        }//End of if (!string.IsNullOrEmpty(link))
                        else
                        {
                            //Exit from the while loop
                            break;
                        }
                    }
                    catch { }
                }//End of while
                #endregion

            }
            catch (Exception ex)
            {
                GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment);
                GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => getFollowing :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForComment);
                GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForComment);
            }
            return lst;
        }
コード例 #12
0
ファイル: frm_stagram.cs プロジェクト: workad009/gramboard
        public void getPhotoLike(ref InstagramManager.Classes.InstagramAccountManager accountManager)
        {
            InstagramManager.Classes.InstagramPhotoLike InstagramPhotoLike = new InstagramManager.Classes.InstagramPhotoLike();
            try
            {
                foreach (string PhotoList_item in ClGlobul.PhotoList)
                {

                    string query = "select * from LikeInfo where UseName='" + accountManager.Username + "' and LikePhotoId='" + PhotoList_item + "'";
                    DataSet ds = DataBaseHandler.SelectQuery(query, "LikeInfo");
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        try
                        {
                            string LikeName = PhotoList_item;
                            // string Result = InstagramPhotoLike.photolike(LikeName, ref accountManager);
                            string photoId = string.Empty;

                            if (PhotoList_item.Contains("\0"))
                            {
                                photoId = PhotoList_item.Replace("\0", string.Empty).Trim();
                            }
                            else
                            {
                                photoId = PhotoList_item;
                            }
                            string Result = string.Empty;
                            try
                            {
                                Result = InstagramPhotoLike.photolike(photoId, ref accountManager);
                            }
                            catch { }

                            if (Result.Contains("LIKED") && !Result.Contains("All ready LIKED"))
                            {
                                try
                                {
                                    //QueryExecuter.insertPhotoId(accountManager.Username, photoId);
                                    QueryExecuter.insertLikeStatus(photoId, accountManager.Username, 1);

                                }
                                catch (Exception ex)
                                {
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => getPhotoLike :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                }

                                try
                                {
                                    if (!ClGlobul.photoLikesCompletedList.Contains(accountManager.Username))// + ":" + accountManager.Password + ":" + accountManager.proxyAddress + ":" + accountManager.proxyPort + ":" + accountManager.proxyUsername + ":" + accountManager.proxyPassword))
                                    {
                                        ClGlobul.photoLikesCompletedList.Add(accountManager.Username);// + ":" + accountManager.Password + ":" + accountManager.proxyAddress + ":" + accountManager.proxyPort + ":" + accountManager.proxyUsername + ":" + accountManager.proxyPassword);
                                    }
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine(accountManager.Username + ":" + photoId, GramBoardProFileHelper.LikePhotoAccountIdFilePath);
                                    // QueryExecuter.UpdateStatusPhotoId(accountManager.Username, photoId);

                                }
                                catch (Exception ex)
                                {
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => getPhotoLike :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);

                                }
                                try
                                {
                                    AddTophotoLogger("[ " + DateTime.Now + " ] => [ " + accountManager.Username + "   LIKED : " + PhotoList_item + " ]");
                                }
                                catch
                                {
                                    AddTophotoLogger("[ " + DateTime.Now + " ] => [ " + accountManager.Username + "   All ready LIKED : " + PhotoList_item + " ]");

                                }
                            }
                            else if (Result.Contains("All ready LIKED"))
                            {
                                try
                                {
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine(accountManager.Username + ":" + photoId, GramBoardProFileHelper.AllReadylikePhotoAccountIdFilePath);
                                }
                                catch (Exception ex)
                                {
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => getPhotoLike :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                }

                                AddTophotoLogger("[ " + DateTime.Now + " ] => [ " + accountManager.Username + " All ready LIKED :  " + PhotoList_item + " ]");
                            }
                            else
                            {
                                try
                                {
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine(accountManager.Username + ":" + photoId, GramBoardProFileHelper.NotlikePhotoAccountIdFilePath);
                                }
                                catch (Exception ex)
                                {
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => getPhotoLike :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("------------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePathForPhotolike);
                                }

                                AddTophotoLogger("[ " + DateTime.Now + " ] => [ " + accountManager.Username + " is Not LIKED : " + PhotoList_item + " ]");
                            }

                            if (!string.IsNullOrEmpty(txtdelaymin.Text) && NumberHelper.ValidateNumber(txtdelaymin.Text))
                            {
                                mindelay = Convert.ToInt32(txtdelaymin.Text);
                            }
                            if (!string.IsNullOrEmpty(txtdelaymax.Text) && NumberHelper.ValidateNumber(txtdelaymax.Text))
                            {
                                maxdelay = Convert.ToInt32(txtdelaymax.Text);
                            }

                            lock (_lockObject)
                            {
                                Random rn = new Random();
                                int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                                delay = rn.Next(mindelay,maxdelay);
                                AddTophotoLogger("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds For " + accountManager.Username + " ]");
                                Thread.Sleep(delay * 1000);
                            }
                        }
                        catch (Exception ex)
                        {

                            GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetPhotolike (1) :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForPhotolike);

                        }
                    }
                    else
                    {
                        AddTophotoLogger("[ " + DateTime.Now + " ] => [ " + accountManager.Username + " All ready LIKED :  " + PhotoList_item + " ]");
                    }
                }
            }
            catch (Exception ex)
            {

                GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetPhotolike (2)  :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePathForPhotolike);

            }
            finally
            {
                AddTophotoLogger("--------------------------------------------------------------------------------------------");
                AddTophotoLogger("[ " + DateTime.Now + " ] => [ Photo Like is Finished From =>" + accountManager.Username + " ]");
                AddTophotoLogger("--------------------------------------------------------------------------------------------");
            }
        }
コード例 #13
0
ファイル: frm_stagram.cs プロジェクト: workad009/gramboard
        public void getFollow(ref InstagramManager.Classes.InstagramAccountManager accountManager, List<string> followingList)
        {
            InstagramManager.Classes.InstagramFollow Instagramfollow = new InstagramManager.Classes.InstagramFollow();

            try
            {
                if (ClGlobul.followingList.Count != 0)
                {
                    //foreach (string followingList_item in ClGlobul.followingList) //commented when divide data implemented.
                    foreach (string followingList_item in followingList)
                    {
                        try
                        {
                            string FollowerName = followingList_item;
                            string Result = Instagramfollow.Follow(FollowerName, ref accountManager);

                            if (Result == "Followed")
                            {
                                ClGlobul.TotalNoOfFollow++;

                                AddToLogger("[ " + DateTime.Now + " ] => [" + accountManager.Username + " Followed " + FollowerName + " ]");

                                if (!string.IsNullOrEmpty(txtmindelay.Text) && NumberHelper.ValidateNumber(txtmindelay.Text))
                                {
                                    mindelay = Convert.ToInt32(txtmindelay.Text);
                                }
                                if (!string.IsNullOrEmpty(txtmaxdelay.Text) && NumberHelper.ValidateNumber(txtmaxdelay.Text))
                                {
                                    maxdelay = Convert.ToInt32(txtmaxdelay.Text);
                                }
                                lock (_lockObject)
                                {
                                    Random rn = new Random();
                                    int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                                    delay = rn.Next(mindelay, maxdelay);
                                    AddToLogger("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]");
                                    Thread.Sleep(delay * 1000);
                                }

                                if (!Followedlist.Contains(accountManager.Username))
                                {
                                    Followedlist.Add(accountManager.Username);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("Followed: " + FollowerName + " By: " + accountManager.Username + ":" + accountManager.Password, GramBoardProFileHelper.FollowIDFilePath);
                                }
                            }
                            else if (Result == "private")
                            {
                                AddToLogger("[ " + DateTime.Now + " ] => [ Followed: " + FollowerName + " is a private user and can not be followed. ]");
                                GramBoardProFileHelper.AppendStringToTextfileNewLine(accountManager.Username + ":" + accountManager.Password, GramBoardProFileHelper.FollowedOptionNotAvailableFilePath);
                            }
                            else if (Result == "Already Followed")
                            {

                                ClGlobul.TotalNoOfFollow++;
                                AddToLogger("[ " + DateTime.Now + " ] => [ Account:" + accountManager.Username + ClGlobul.TotalNoOfFollow + " Followed " + FollowerName + " ]");
                                if (!string.IsNullOrEmpty(txtmindelay.Text) && NumberHelper.ValidateNumber(txtmindelay.Text))
                                {
                                    mindelay = Convert.ToInt32(txtmindelay.Text);
                                }
                                if (!string.IsNullOrEmpty(txtmaxdelay.Text) && NumberHelper.ValidateNumber(txtmaxdelay.Text))
                                {
                                    maxdelay = Convert.ToInt32(txtmaxdelay.Text);
                                }
                                lock (_lockObject)
                                {
                                    Random rn = new Random();
                                    int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                                    delay = rn.Next(mindelay, maxdelay);
                                    AddToLogger("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]");
                                    Thread.Sleep(delay * 1000);
                                }

                                if (!Followedlist.Contains(accountManager.Username))
                                {
                                    Followedlist.Add(accountManager.Username);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("Followed: " + FollowerName + " By: " + accountManager.Username + ":" + accountManager.Password, GramBoardProFileHelper.FollowIDFilePath);
                                }

                                if (!AlreadyFollowedlist.Contains(accountManager.Username))
                                {
                                    AlreadyFollowedlist.Add(accountManager.Username);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine("Already Followed: " + FollowerName + " By: " + accountManager.Username + ":" + accountManager.Password, GramBoardProFileHelper.AllReadyFollowedIdFilePath);
                                }
                            }
                            else if (Result == "Follow option is not available In page...!!")
                            {

                                AddToLogger("[ " + DateTime.Now + " ] => [ Follow option is not available In page...!!" + accountManager.Username + " ]");
                                GramBoardProFileHelper.AppendStringToTextfileNewLine(accountManager.Username + ":" + accountManager.Password, GramBoardProFileHelper.FollowedOptionNotAvailableFilePath);
                            }
                            else
                            {

                                AddToLogger("[ " + DateTime.Now + " ] => [ " + accountManager.Username + " Not Followed " + FollowerName + " ]");

                                if (!NotFollowedlist.Contains(accountManager.Username))
                                {
                                    NotFollowedlist.Add(accountManager.Username);
                                    GramBoardProFileHelper.AppendStringToTextfileNewLine(accountManager.Username + ":" + accountManager.Password, GramBoardProFileHelper.UnFollowIdFilePath);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePath);
                            GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => getFollow1 :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePath);
                            GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePath);
                        }
                    }
                }

                else
                {
                    GramBoardProFileHelper.AppendStringToTextfileNewLine("Methode Name => GetFollow2 :=> ", GramBoardProFileHelper.ErrorLogFilePath);
                    AddToLogger("[ " + DateTime.Now + " ] => [ Please upload Following ID's ]");
                }
            }
            catch (Exception ex)
            {
                GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePath);
                GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => GetFollow3 :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePath);
                GramBoardProFileHelper.AppendStringToTextfileNewLine("-----------------------------------------------------------------------------------------------", GramBoardProFileHelper.ErrorLogFilePath);
            }

            finally
            {
                ClGlobul.FolloConpletedList.Add(accountManager.Username + ":" + accountManager.Password);
                ClGlobul.TotalNoOfIdsForFollow--;

                counter_follow--;
                if (counter_follow == 0)
                {
                    AddToLogger("-----------------------------------------------------------------------------------------------");
                    AddToLogger("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                    AddToLogger("-----------------------------------------------------------------------------------------------");
                }

                try
                {
                    string UserName = accountManager.Username.ToString();
                    var DicValue = ClGlobul.ThreadList.Single(s => s.Key.Contains(UserName));
                    Thread value = DicValue.Value;
                    if (value.IsAlive || value.IsBackground)
                    {
                        value = null;
                    }
                }
                catch (Exception ex)
                {

                    GramBoardProFileHelper.AppendStringToTextfileNewLine(DateTime.Now + ":=> Methode Name => Finally (Thread Spoile) :=> " + ex.Message, GramBoardProFileHelper.ErrorLogFilePath);
                }
            }
        }