Пример #1
0
        /// <summary>
        /// FollowersStatusOfUser
        /// </summary>
        /// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
        /// <param name="ScreenName">User Screen Name</param>
        /// <returns></returns>
        public List<userstatus> GetFollowersStatusOfUser(oAuthTwitter OAuth, string ScreenName, string cursor)
        {
            userstatus objUserStatus = new userstatus();

            Twitter.Core.UserMethods.Users Users = new Twitter.Core.UserMethods.Users();
            xmlResult = Users.FollowersStatus(OAuth, ScreenName, cursor);
            XmlNodeList xmlNodeList = xmlResult.GetElementsByTagName("user");

            foreach (XmlNode xn in xmlNodeList)
            {
                XmlElement imageUrlElement = (XmlElement)xn;
                objUserStatus.Id = imageUrlElement.GetElementsByTagName("id")[0].InnerText;

                XmlElement followersCountElement = (XmlElement)xn;
                objUserStatus.ScreenName = followersCountElement.GetElementsByTagName("screen_name")[0].InnerText;

                XmlElement friendCountElement = (XmlElement)xn;
                objUserStatus.ProfileImageUrl = new Uri(friendCountElement.GetElementsByTagName("profile_image_url")[0].InnerText);



                UserMethod.Add(objUserStatus);
            }



            return UserMethod;

        }
Пример #2
0
 public string TwitterRecentFollower(string userid)
 {
     List<Domain.Socioboard.Helper.TwitterRecentFollower> lstTwitterRecentFollower = new List<Domain.Socioboard.Helper.TwitterRecentFollower>();
     List<Domain.Socioboard.Domain.TwitterAccount> lstAccRepo = objTwitterAccountRepository.getAllTwitterAccountsOfUser(Guid.Parse(userid));
     oAuthTwitter oauth = null;
     Users twtUsers = new Users();
     foreach (Domain.Socioboard.Domain.TwitterAccount itemTwt in lstAccRepo)
     {
         oauth = new oAuthTwitter();
         oauth.AccessToken = itemTwt.OAuthToken;
         oauth.AccessTokenSecret = itemTwt.OAuthSecret;
         oauth.TwitterScreenName = itemTwt.TwitterScreenName;
         oauth.TwitterUserId = itemTwt.TwitterUserId;
         SetCofigDetailsForTwitter(oauth);
         JArray jarresponse = twtUsers.Get_Followers_ById(oauth, itemTwt.TwitterUserId);
         foreach (var item in jarresponse)
         {
             int resposecount = 0;
             if (item["ids"] != null)
             {
                 foreach (var child in item["ids"])
                 {
                     if (resposecount < 2)
                     {
                         JArray userprofile = twtUsers.Get_Users_LookUp(oauth, child.ToString());
                         foreach (var items in userprofile)
                         {
                             Domain.Socioboard.Helper.TwitterRecentFollower objTwitterRecentFollower = new Domain.Socioboard.Helper.TwitterRecentFollower();
                             resposecount++;
                             objTwitterRecentFollower.screen_name = items["screen_name"].ToString();
                             objTwitterRecentFollower.name = items["name"].ToString();
                             objTwitterRecentFollower.profile_image_url = items["profile_image_url"].ToString();
                             lstTwitterRecentFollower.Add(objTwitterRecentFollower);
                         }
                     }
                 }
             }
         }
     }
     return new JavaScriptSerializer().Serialize(lstTwitterRecentFollower);
 }
Пример #3
0
        public string TwitterLogIn(string client_id, string client_secret, string redirect_uri, string requestToken, string requestSecret, string requestVerifier)
        {
            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;
            string ret = string.Empty;
            Users userinfo = new Users();
            oAuthTwitter OAuth = new oAuthTwitter(client_id, client_secret, redirect_uri);
            OAuth.AccessToken = requestToken;
            OAuth.AccessTokenSecret = requestVerifier;
            OAuth.AccessTokenGet(requestToken, requestVerifier);
            JArray profile = userinfo.Get_Users_LookUp_ByScreenName(OAuth, OAuth.TwitterScreenName);

            if (profile != null)
            {
                logger.Error("Twitter.asmx >> TwitterLogIn >> Twitter profile : " + profile);
            }
            else
            {
                logger.Error("Twitter.asmx >> TwitterLogIn >> NULL Twitter profile : " + profile);
            }
            string TwitterUserId = string.Empty;
            objTwitterAccount = new Domain.Socioboard.Domain.TwitterAccount();
            Domain.Socioboard.Domain.User objUser = new Domain.Socioboard.Domain.User();
            foreach (var item in profile)
            {
                #region Login Twitter Account
                try
                {
                    objUser.ProfileUrl = item["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    TwitterUserId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception er)
                {
                    try
                    {
                        TwitterUserId = item["id"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    Console.WriteLine(er.StackTrace);
                }
                objUser.SocialLogin = "******" + TwitterUserId;
                try
                {
                    objUser.UserName = item["name"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                }

                #endregion
            }
            return new JavaScriptSerializer().Serialize(objUser);
        }
Пример #4
0
   /// <summary>
 ///Returns a map of the available size variations of the specified user's profile banner.
 /// </summary>
 /// <param name="oAuth"></param>
 /// <returns></returns>
 public JArray GetUsers_Profile_Banner(oAuthTwitter oAuth, string user_id)
 {
     Users objUser = new Users();
     JArray jarrUser = new JArray();
     jarrUser = objUser.Get_Users_Profile_Banner(oAuth, user_id);
     return jarrUser;
 }
Пример #5
0
        public void getUserProile(oAuthTwitter OAuth, string TwitterScreenName, Guid userId)
        {
            try
            {
                Users userinfo = new Users();
                //TwitterAccount twitterAccount = new TwitterAccount();
                Domain.Socioboard.Domain.TwitterAccount twitterAccount = new Domain.Socioboard.Domain.TwitterAccount();
                TwitterAccountRepository twtrepo = new TwitterAccountRepository();
                JArray profile = userinfo.Get_Users_LookUp(OAuth, TwitterScreenName);
                foreach (var item in profile)
                {
                    try
                    {
                        twitterAccount.FollowingCount = Convert.ToInt32(item["friends_count"].ToString());
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        twitterAccount.FollowersCount = Convert.ToInt32(item["followers_count"].ToString());
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);

                    }
                    twitterAccount.IsActive = true;
                    twitterAccount.OAuthSecret = OAuth.AccessTokenSecret;
                    twitterAccount.OAuthToken = OAuth.AccessToken;
                    try
                    {
                        twitterAccount.ProfileImageUrl = item["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);

                    }
                    try
                    {
                        twitterAccount.ProfileUrl = string.Empty;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        twitterAccount.TwitterUserId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception er)
                    {
                        try
                        {
                            twitterAccount.TwitterUserId = item["id"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception err)
                        {
                            Console.WriteLine(err.StackTrace);

                        }
                        Console.WriteLine(er.StackTrace);

                    }
                    try
                    {
                        twitterAccount.TwitterScreenName = item["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    twitterAccount.UserId = userId;

                    if (twtrepo.checkTwitterUserExists(twitterAccount.TwitterUserId, userId))
                    {
                        twtrepo.updateTwitterUser(twitterAccount);
                    }
                    getTwitterStats(twitterAccount);
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
Пример #6
0
     /// <summary>
 ///Provides a simple, relevance-based search interface to public user accounts on Twitter. 
 /// </summary>
 /// <param name="oAuth"></param>
 /// <returns></returns>
 public JArray GetUsers_Search(oAuthTwitter oAuth, string keyword,string count)
 {
     Users objUser = new Users();
     JArray jarrUser = new JArray();
     jarrUser = objUser.Get_Users_Search(oAuth, keyword,count);
     return jarrUser;
 }
Пример #7
0
    /// <summary>
 /// Removes the uploaded profile banner for the authenticating user. Returns HTTP 200 upon success
 /// </summary>
 /// <param name="oAuth"></param>
 /// <param name="image"></param>
 /// <param name="include_entities"></param>
 /// <param name="skip_status"></param>
 /// <returns></returns>
 public string PostAccount_Remove_Profile_Banner(oAuthTwitter oAuth)
 {
     Users objUser = new Users();
     string jarrUser = objUser.Post_Account_Remove_Profile_Banner(oAuth);
     return jarrUser;
 }
Пример #8
0
        public void ProcessRequest()
        {
            SocialProfilesRepository socio = new SocialProfilesRepository();
            List<SocialProfile> alstsocioprofiles = new List<SocialProfile>();
            if (!string.IsNullOrEmpty(Request.QueryString["op"]))
            {
                SocioBoard.Domain.User user = (SocioBoard.Domain.User)Session["LoggedUser"];

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

                    alstsocioprofiles = socio.getAllSocialProfilesOfUser(user.Id);

                    string profiles = string.Empty;
                    profiles += "<ul class=\"rsidebar-profile\">";
                    foreach (SocialProfile item in alstsocioprofiles)
                    {
                        try
                        {
                            if (item.ProfileType == "facebook")
                            {
                                try
                                {
                                    FacebookAccountRepository facerepo = new FacebookAccountRepository();
                                    FacebookAccount faceaccount = facerepo.getFacebookAccountDetailsById(item.ProfileId, user.Id);

                                    if (faceaccount != null)
                                    {
                                        profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onclick=\"confirmDel('" + item.ProfileId + "','fb');\"></div><a href=\"http://www.facebook.com/" + faceaccount.FbUserId + "\" target=\"_blank\"><img src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\" height=\"48\" width=\"48\" alt=\"\" title=\"" + faceaccount.FbUserName + "\" /></a>" +
                                                    "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/fb_icon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error(ex.Message);
                                }

                            }
                            else if (item.ProfileType == "twitter")
                            {
                                try
                                {
                                    TwitterAccountRepository twtrepo = new TwitterAccountRepository();
                                    SocioBoard.Domain.TwitterAccount twtaccount = twtrepo.getUserInformation(user.Id, item.ProfileId);
                                    if (twtaccount != null)
                                    {
                                        profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','twt')\"></div><a href=\"http://twitter.com/" + twtaccount.TwitterScreenName + "\" target=\"_blank\"><img src=\"" + twtaccount.ProfileImageUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + twtaccount.TwitterScreenName + "\" /></a>" +
                                                    "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/twticon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";
                                    }

                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error(ex.Message);
                                }
                            }
                            else if (item.ProfileType == "linkedin")
                            {
                                try
                                {

                                    LinkedInAccountRepository liRepo = new LinkedInAccountRepository();
                                    string access = string.Empty, tokenSecrate = string.Empty, LdprofileName = string.Empty, LdPreofilePic = string.Empty;
                                    LinkedInAccount liaccount = liRepo.getUserInformation(user.Id, item.ProfileId);

                                    if (liaccount != null)
                                    {
                                        if (!string.IsNullOrEmpty(liaccount.ProfileImageUrl))
                                        {
                                            LdPreofilePic = liaccount.ProfileImageUrl;
                                        }
                                        else
                                        {
                                            LdPreofilePic = "../../Contents/img/blank_img.png";
                                        }

                                        profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','linkedin')\"></div><a href=\"" + liaccount.ProfileUrl + "\" target=\"_blank\"><img src=\"" + LdPreofilePic + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + liaccount.LinkedinUserName + "\" /></a>" +
                                                   "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/link_icon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error(ex.Message);
                                }

                            }

                            else if (item.ProfileType == "instagram")
                            {
                                try
                                {
                                    InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository();
                                    InstagramAccount objInsAcc = objInsAccRepo.getInstagramAccountDetailsById(item.ProfileId, user.Id);
                                    string accessToken = string.Empty;
                                    if (objInsAcc != null)
                                    {
                                        profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','instagram')\"></div><a href=\"http://instagram.com/" + objInsAcc.InsUserName + "\" target=\"_blank\"><img src=\"" + objInsAcc.ProfileUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + objInsAcc.InsUserName + "\" /></a>" +
                                                    "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/instagram_24X24.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error(ex.Message);
                                }
                            }
                            else if (item.ProfileType == "googleplus")
                            {
                                try
                                {

                                    //GooglePlusAccountRepository objgpAccRepo = new GooglePlusAccountRepository();
                                    //GooglePlusAccount objgpAcc = objgpAccRepo.getGooglePlusAccountDetailsById(item.ProfileId, user.Id);
                                    //string accessToken = string.Empty;

                                    //profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','googleplus')\"></div><a href=\"http://plus.google.com/" + item.ProfileId + "\" target=\"_blank\"><img src=\"" + objgpAcc.GpProfileImage + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + objgpAcc.GpUserName + "\" /></a>" +
                                    //            "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/google_plus.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";

                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error(ex.Message);
                                }
                            }
                            else if (item.ProfileType == "googleanalytics")
                            {
                                try
                                {

                                    //GoogleAnalyticsAccountRepository objgaAccRepo = new GoogleAnalyticsAccountRepository();
                                    //GoogleAnalyticsAccount objgaAcc = objgaAccRepo.getGoogelAnalyticsAccountHomeDetailsById(user.Id,item.ProfileId);
                                    //string accessToken = string.Empty;

                                    //profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','googleanalytics')\"></div><a href=\"http://plus.google.com/" + item.ProfileId + "\" target=\"_blank\"><img src=\"../Contents/img/google_analytics.png\" height=\"48\" width=\"48\" alt=\"\" title=\"" + objgaAcc.GaAccountName + "\" /></a>" +
                                    //            "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";

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

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

                        }
                    } profiles += "</ul>";
                    Response.Write(profiles);
                }
                else if (Request.QueryString["op"] == "woodrafts")
                {
                    string message = string.Empty;
                    try
                    {
                        DraftsRepository draftsRepository = new DraftsRepository();
                        List<Drafts> lstDrafts = draftsRepository.getAllDrafts(user.Id);
                        string profurl = string.Empty;
                        if (string.IsNullOrEmpty(user.ProfileUrl))
                        {
                            profurl = "../Contents/img/blank_img.png";
                        }
                        else
                        {
                            profurl = user.ProfileUrl;
                        }
                        if (lstDrafts.Count != 0)
                        {
                            foreach (Drafts item in lstDrafts)
                            {
                                message += "<section class=\"section\" style=\"width:648px;\">" +
                                           "<div class=\"js-task-cont read\"><section class=\"task-owner\">" +
                                "<img width=\"32\" height=\"32\" border=\"0\" class=\"avatar\" src=\"../Contents/img/task_pin.png\">" +
                                "</section><section class=\"task-activity third\" style=\"width: 19.6%;\"><p>" + user.UserName + "</p><div>" + item.CreatedDate + " </div><p>" +
                                    //"</p></section><section style=\"margin-right: 6px; height: auto; width: 35%;\" class=\"task-message font-13 third\"><a onclick=\"writemessage(this.innerHTML);\" class=\"tip_left\">" + item.Message + "</a></section>" +
                                 "</p></section><section style=\"margin-right: 6px; height: auto; width: 31%;\" class=\"task-message font-13 third\"><span class=\"tip_left\">" + item.Message + "</span></section>" +
                                    "<div class=\"userpictiny\" style=\"height:70px; margin-top: 0;\"><img alt=\"\" src=\"" + profurl + "\" />" +
                                 "</div>" +
                                 "<a class=\"small_remove icon publish_delete\" href=\"#\" style=\"top: 7px; float: right; margin-top: 13px; margin-right: 10px;\" title=\"Delete\" onclick=\"deleteDraftMessage('" + item.Id + "')\"></a>" +
                                "<section style=\"margin-top: 18px; width: 45px; margin-right: 17px;\" class=\"task-status\"><div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\" href=\"#nogo\">" +
                                    "<span onclick=\"editDraftsMessage('" + item.Id + "');\" class=\"ui-sproutmenu-status\">" +
                                "<img class=\"edit_button\" src=\"../Contents/img/icon_edit.png\" alt=\"\" />" +
                                "</span>" +
                                "</a></div></section></div></section>";

                            }
                        }
                        else
                        {
                            //message += "<section class=\"section\"><div class=\"js-task-cont read\"><section class=\"task-owner\">" +
                            //      "<img width=\"32\" height=\"32\" border=\"0\" class=\"avatar\" src=\"" + profurl + "\">" +
                            //      "</section><section class=\"task-activity third\"><p>" + user.UserName + "</p><div></div><p></p></section><section style=\"margin-right: 6px; width: 31%; height: auto;\" class=\"task-message font-13 third\">" +
                            //      "<a class=\"tip_left\">No Messages in Drafts</a></section><section style=\"width:113px;\" class=\"task-status\"><span class=\"ficon task_active\"></span>" +
                            //      "<div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\" href=\"#nogo\">" +
                            //      "<span class=\"ui-sproutmenu-status\"></span></a></div></section></div></section>";

                            message += "<section class=\"section\"><div class=\"js-task-cont read\"><section style=\"margin-right: 6px; width: 31%; height: auto;\" class=\"task-message font-13 third\">" +
                                "<a class=\"tip_left\">No Messages in Drafts</a></section><section style=\"width:113px;\" class=\"task-status\"><span class=\"ficon task_active\"></span>" +
                                "<div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\" href=\"#nogo\">" +
                                "<span class=\"ui-sproutmenu-status\"></span></a></div></section></div></section>";
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }
                    Response.Write(message);
                }
                else if (Request.QueryString["op"] == "savedrafts")
                {
                    try
                    {
                        string message = Request.QueryString["message"];
                        Drafts d = new Drafts();
                        d.CreatedDate = DateTime.Now;
                        d.Message = message;
                        d.ModifiedDate = DateTime.Now;
                        d.UserId = user.Id;
                        d.Id = Guid.NewGuid();
                        DraftsRepository dRepo = new DraftsRepository();
                        if (!dRepo.IsDraftsMessageExist(user.Id, message))
                        {
                            dRepo.AddDrafts(d);
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }
                }
                else if (Request.QueryString["op"] == "midsnaps")
                {
                    try
                    {
                        Random rNum = new Random();
                        string loadtype = Request.QueryString["loadtype"];
                        string midsnaps = string.Empty;
                        if (loadtype == "load")
                            profilelimit = 0;

                        if (profilelimit != -1)
                        {
                            ArrayList alst = socio.getLimitProfilesOfUser(user.Id, profilelimit);

                            if (alst.Count == 0)
                                profilelimit = -1;
                            else if (profilelimit == 0)
                                profilelimit += 2;
                            else
                                profilelimit += 3;

                            midsnaps += "<div class=\"row-fluid\" >";
                            if (loadtype == "load")
                            {
                                AdsRepository objAdsRepo = new AdsRepository();
                                ArrayList lstads = objAdsRepo.getAdsForHome();

                                int i = 0;
                                if (lstads.Count <= 1)
                                {
                                    midsnaps += "<div class=\"span4 rounder recpro\"><button data-dismiss=\"alert\" class=\"close pull-right\" type=\"button\">×</button>" +
                                         "<a href=\"#\"><img src=\"../Contents/img/admin/ads.png\"  alt=\"\" style=\"width:246px;height:331px\"></a></div>";
                                }
                                else
                                {
                                    foreach (var item in lstads)
                                    {
                                        Array temp = (Array)item;
                                        i++;
                                        if (temp != null)
                                        {
                                            if (i == 2)
                                            {
                                                midsnaps += "<div class=\"span4 rounder recpro\"><button data-dismiss=\"alert\" class=\"close pull-right\" type=\"button\">×</button>" +
                                               "<a href=\"#\"><img src=\"" + temp.GetValue(2).ToString() + "\"  alt=\"\" style=\"width:246px;height:331px\"></a></div>";
                                            }
                                        }
                                    }
                                }

                            }
                            foreach (SocialProfile item in alst)
                            {
                                if (item.ProfileType == "facebook")
                                {
                                    try
                                    {
                                        FacebookAccountRepository fbrepo = new FacebookAccountRepository();
                                        FacebookFeedRepository facefeedrepo = new FacebookFeedRepository();
                                        List<FacebookFeed> fbmsgs = facefeedrepo.getAllFacebookUserFeeds(item.ProfileId);
                                        FacebookAccount fbaccount = fbrepo.getFacebookAccountDetailsById(item.ProfileId, user.Id);

                                        midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:333px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" +
                                                   "<div onclick=\"detailsdiscoveryfacebook('" + fbaccount.FbUserId + "');\"  class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + fbaccount.FbUserName + "\" alt=\"\" src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\"\">" +
                                                   "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/fb_icon.png\" width=\"16\" height=\"16\"></a></div>" +
                                                   "<div onclick=\"detailsdiscoveryfacebook('" + fbaccount.FbUserId + "');\" class=\"useraccname\">" + fbaccount.FbUserName + "</div><div class=\"usercounter\">" +
                                                   "<div class=\"userfoll\">" + fbaccount.Friends;

                                        if (fbaccount.Type == "page")
                                        {
                                            midsnaps += "<a>Fans</a>";
                                        }
                                        else
                                        {
                                            midsnaps += "<a>Friends</a>";

                                        }
                                        midsnaps += "</div>" +
                                                   "<div class=\"userppd\">" + Math.Round(rNum.NextDouble(), 2) + "<span>Avg. Post <br> Per Day</span></div></div></div>" +
                                                   "<div class=\"concoteng\"><h5>recent message</h5> <ul class=\"mess\">";

                                        if (fbmsgs.Count != 0)
                                        {
                                            int msgcount = 0;
                                            foreach (FacebookFeed child in fbmsgs)
                                            {
                                                string mess = string.Empty;
                                                if (msgcount < 2)
                                                {
                                                    if (child.FeedDescription.Length > 40)
                                                    {
                                                        mess = child.FeedDescription.Substring(0, 39);
                                                        mess = mess + "...........";
                                                    }
                                                    else
                                                    {
                                                        mess = child.FeedDescription;
                                                    }

                                                    midsnaps += "<li><div class=\"messpic\"><img title=\"\" alt=\"\" src=\"http://graph.facebook.com/" + child.FromId + "/picture?type=small\"></div>" +
                                                              "<div class=\"messtext\">" + mess + "</div></li>";
                                                    //  midsnaps += "<strong><img src=\"http://graph.facebook.com/" + child.FromId + "/picture?type=small\" />" + mess + "</strong><br/>";
                                                }
                                                else
                                                {
                                                    break;
                                                }
                                                msgcount++;
                                            }
                                        }
                                        else
                                        {
                                            midsnaps += "<strong>No messages were found within the past few days.</strong> \"Messages will be displayed once there is activity in this date range.\"";
                                        }

                                        midsnaps += "</ul></div></div>";
                                    }
                                    catch (Exception ex)
                                    {
                                        logger.Error(ex.Message);
                                    }
                                }
                                if (item.ProfileType == "googleplus")
                                {
                                    // try
                                    //{
                                    //    GooglePlusAccountRepository objgpAccRepo = new GooglePlusAccountRepository();
                                    //    GooglePlusActivitiesRepository objgpActRepo = new GooglePlusActivitiesRepository();

                                    //    GooglePlusAccount gaaccount = objgpAccRepo.getGooglePlusAccountDetailsById(item.ProfileId, user.Id);
                                    //    List<GooglePlusActivities> gpmsgs = objgpActRepo.getAllgoogleplusActivityOfUser(user.Id, item.ProfileId);

                                    //    midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:333px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" +
                                    //               "<div class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + gaaccount.GpUserName + "\" alt=\"\" src='" + gaaccount.GpProfileImage + "'>" +
                                    //               "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/google_plus.png\" width=\"16\" height=\"16\"></a></div>" +
                                    //               "<div class=\"useraccname\">" + gaaccount.GpUserName + "</div><div class=\"usercounter\">" +
                                    //               "<div class=\"userfoll\">" + gaaccount.PeopleCount + "<span>Friends</span></div>" +
                                    //               "<div class=\"userppd\">" + Math.Round(rNum.NextDouble(), 2) + "<span>Avg. Post Per Day</span></div></div></div>" +
                                    //               "<div class=\"concoteng\"><h5>recent message</h5> <ul class=\"mess\">";
                                    //    if (gpmsgs.Count() != 0)
                                    //    {
                                    //        try
                                    //        {
                                    //            int msgcount = 0;
                                    //            foreach (GooglePlusActivities child in gpmsgs)
                                    //            {
                                    //                string mess = string.Empty;
                                    //                if (msgcount < 2)
                                    //                {
                                    //                    if (child.Content.Length > 40)
                                    //                    {
                                    //                        mess = child.Content.Substring(0, 39);
                                    //                        mess = mess + "...........";
                                    //                    }
                                    //                    else
                                    //                    {
                                    //                        mess = child.Content;
                                    //                    }

                                    //                    midsnaps += "<li><div class=\"messpic\"><img title=\"\" width=\"24px\" height=\"24px\" alt=\"\" src=\"" + child.FromProfileImage + "\"></div>" +
                                    //                              "<div class=\"messtext\">" + mess + "</div></li>";
                                    //                    //  midsnaps += "<strong><img src=\"http://graph.facebook.com/" + child.FromId + "/picture?type=small\" />" + mess + "</strong><br/>";
                                    //                }
                                    //                else
                                    //                {
                                    //                    break;
                                    //                }
                                    //                msgcount++;
                                    //            }
                                    //        }
                                    //        catch (Exception exx)
                                    //        {
                                    //            Console.WriteLine(exx.Message);
                                    //            logger.Error(exx.Message);
                                    //        }
                                    //    }
                                    //    else
                                    //    {
                                    //        midsnaps += "<strong>No messages were found within the past few days.</strong> \"Messages will be displayed once there is activity in this date range.\"";
                                    //    }

                                    //    midsnaps += "</ul></div></div>";

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

                                }
                                else if (item.ProfileType == "twitter")
                                {
                                    TwitterAccountRepository twtrepo = new TwitterAccountRepository();
                                    SocioBoard.Domain.TwitterAccount twtaccount = twtrepo.getUserInformation(user.Id, item.ProfileId);
                                    TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository();
                                    List<TwitterMessage> lsttwtmsgs = twtmsgrepo.getAllTwitterMessagesOfProfile(item.ProfileId);
                                    int tweetcount = 0;

                                    midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:333px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" +
                                     "<div onclick=\"detailsdiscoverytwitter('" + twtaccount.TwitterUserId + "');\" class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + twtaccount.TwitterName + "\" alt=\"\" src=\"" + twtaccount.ProfileImageUrl + "\">" +
                                     "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/twticon.png\" width=\"16\" height=\"16\"></a></div>" +
                                     "<div onclick=\"detailsdiscoverytwitter('" + twtaccount.TwitterUserId + "');\" class=\"useraccname\">" + twtaccount.TwitterScreenName + "</div><div class=\"usercounter\">" +
                                     "<div class=\"userfoll\">" + twtaccount.FollowersCount + "<a>Followers</a></div>" +
                                     "<div class=\"userppd\">" + Math.Round(rNum.NextDouble(), 2) + "<span>Avg. Post <br> Per Day</span></div></div></div>" +
                                     "<div class=\"concoteng\"><h5>recent message</h5> <ul class=\"mess\">";
                                    try
                                    {
                                        if (lsttwtmsgs.Count == 0)
                                        {
                                            midsnaps += "<strong>No messages were found within the past few days.</strong> \"Messages will be displayed once there is activity in this date range.\"";
                                        }
                                        else
                                        {
                                            foreach (TwitterMessage msg in lsttwtmsgs)
                                            {
                                                if (tweetcount < 2)
                                                {
                                                    try
                                                    {
                                                        string ms = string.Empty;
                                                        if (msg.TwitterMsg.Length > 20)
                                                        {
                                                            ms = msg.TwitterMsg.Substring(0, 20) + "...";

                                                        }
                                                        else
                                                        {
                                                            ms = msg.TwitterMsg;
                                                        }
                                                        midsnaps += "<li><div class=\"messpic\"><img title=\"\" alt=\"\" src=\"" + msg.FromProfileUrl + "\"></div>" +
                                                        "<div class=\"messtext\">" + ms + "</div></li>";
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Console.WriteLine(ex.Message);

                                                    }
                                                }
                                                else
                                                {
                                                    break;
                                                }
                                                tweetcount++;
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {

                                        Console.WriteLine(ex.Message);
                                        logger.Error(ex.Message);
                                    }
                                    midsnaps += "</ul></div></div>";
                                }
                                else if (item.ProfileType == "linkedin")
                                {
                                    try
                                    {
                                        string access = string.Empty, tokenSecrate = string.Empty, LdprofileName = string.Empty, LdPreofilePic = string.Empty;
                                        LinkedInAccountRepository objLiRepo = new LinkedInAccountRepository();
                                        LinkedInFeedRepository objliFeedRepo = new LinkedInFeedRepository();
                                        LinkedInAccount liAccount = objLiRepo.getUserInformation(user.Id, item.ProfileId);
                                        LinkedInFeedRepository lifeedrepo = new LinkedInFeedRepository();
                                        List<LinkedInFeed> alstliaccount = lifeedrepo.getAllLinkedInFeedsOfProfile(item.ProfileId);
                                        if (liAccount != null)
                                        {
                                            LdprofileName = liAccount.LinkedinUserName;
                                            LdPreofilePic = liAccount.ProfileImageUrl;
                                        }

                                        if (string.IsNullOrEmpty(LdPreofilePic))
                                        {
                                            LdPreofilePic = "../../Contents/img/blank_img.png";
                                        }
                                        int linkedinConcount = 0;
                                        try
                                        {
                                            linkedinConcount = liAccount.Connections;
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.Message);
                                        }

                                        midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:333px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" +
                                           "<div class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + LdprofileName + "\" alt=\"\" src=\"" + LdPreofilePic + "\">" +
                                           "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/link_icon.png\" width=\"16\" height=\"16\"></a></div>" +
                                           "<div class=\"useraccname\">" + LdprofileName + "</div><div class=\"usercounter\">" +
                                           "<div class=\"userfoll\">" + linkedinConcount + "<span>Connections</span></div>" +
                                           "<div class=\"userppd\">" + Math.Round(rNum.NextDouble(), 2) + "<span>Avg. Post <br> Per Day</span></div></div></div>" +
                                           "<div class=\"concoteng\"><h5>recent message</h5> <ul class=\"mess\">";
                                        int link = 0;
                                        if (alstliaccount.Count == 0)
                                        {
                                            midsnaps += "<strong>No messages were found within the past 14 days.</strong> \"Messages will be displayed once there is activity in this date range.\"";
                                        }
                                        else
                                        {

                                            try
                                            {

                                                foreach (LinkedInFeed liFeed in alstliaccount)
                                                {
                                                    try
                                                    {
                                                        if (link < 2)
                                                        {
                                                            string ms = string.Empty;
                                                            if (liFeed.Feeds.Length > 20)
                                                            {
                                                                ms = liFeed.Feeds.Substring(0, 20) + "...";

                                                            }
                                                            else
                                                            {
                                                                ms = liFeed.Feeds;
                                                            }
                                                            midsnaps += "<li><div class=\"messpic\"><img title=\"\" alt=\"\" src=\"" + liFeed.FromPicUrl + "\"></div>" +
                                                           "<div class=\"messtext\">" + ms + "</div></li>";
                                                            link++;
                                                        }
                                                        else
                                                        {
                                                            break;
                                                        }
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        logger.Error(ex.Message);
                                                    }
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                logger.Error(ex.Message);
                                            }

                                        }
                                        midsnaps += "</ul></div></div>";
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex.Message);
                                        logger.Error(ex.Message);
                                    }
                                }
                                else if (item.ProfileType == "instagram")
                                {
                                    try
                                    {
                                        InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository();
                                        InstagramAccount objInsAcc = objInsAccRepo.getInstagramAccountDetailsById(item.ProfileId, user.Id);

                                        midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:333px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" +
                                               "<div class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + objInsAcc.InsUserName + "\" alt=\"\" src=\"" + objInsAcc.ProfileUrl + "\">" +
                                               "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/instagram_24X24.png\" width=\"16\" height=\"16\"></a></div>" +
                                               "<div class=\"useraccname\">" + objInsAcc.InsUserName + "</div></div>" +
                                               "<div class=\"concoteng\"><div class=\"pillow_fade\">" +
                                               " <div class=\"fb_notifications\">" +
                                               "<ul class=\"user-stats\"> " +
                                                    "<li><div class=\"photo_stat\">  photos</div>  <div class=\"number-stat\">" + objInsAcc.TotalImages + "</div></li>" +
                                                    "<li><div class=\"photo_stat\">following</div><div class=\"number-stat\">" + objInsAcc.Followers + "</div></li>" +
                                                    "<li><div class=\"photo_stat\">followers</div><div class=\"number-stat\">" + objInsAcc.FollowedBy + "</div></li>" +
                                                "</ul></div></div></div></div>";
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex.Message);
                                        logger.Error(ex.Message);
                                    }
                                    //       midsnaps += " <div class=\"col_seven_instagram\">" +
                                    //                "<div class=\"col_seven_instagram_link_my_accounts\">" +
                                    //                  "<div class=\"dt\"><a class=\"img\">" +
                                    //                    "<img src=\"" + objInsAcc.ProfileUrl + "\" width=\"48\" height=\"48\" alt=\"\" /></a>" +
                                    //                  "<span class=\"icon\"></span></div><div class=\"dd\">" +
                                    //                "<h5>" + objInsAcc.InsUserName + "</h5><div class=\"friends_avg\">" +

                                    //        "</div>" +
                                    //    "</div>" +
                                    //"</div>" +
                                    //    "<div class=\"pillow_fade\">" +
                                    //        "<div class=\"fb_notifications\">" +
                                    //            "<ul class=\"user-stats\">" +
                                    //                       "<li>" +
                                    //                          "<div class=\"photo_stat\">  photos" +
                                    //                          "</div>" +
                                    //                          "<div class=\"number-stat\">" + objInsAcc.TotalImages +
                                    //                          "</div>" +
                                    //                       "</li>" +
                                    //                       "<li>" +
                                    //                           "<div class=\"photo_stat\"> followers" +
                                    //                          "</div>" +
                                    //                          "<div class=\"number-stat\">" + objInsAcc.FollowedBy +
                                    //                          "</div>" +
                                    //                       "</li>" +
                                    //                       "<li>" +
                                    //                           "<div class=\"photo_stat\"> following" +
                                    //                          "</div>" +
                                    //                          "<div class=\"number-stat\">" + objInsAcc.Followers +
                                    //                          "</div>" +
                                    //                       "</li>" +
                                    //                    "</ul>" +
                                    //            "</div>" +
                                    //    "</div>" +
                                    //"</div>";
                                }
                                else if (item.ProfileType == "googleanalytics")
                                {
                                    //try
                                    //{
                                    //    GoogleAnalyticsAccountRepository objGaAccRepo = new GoogleAnalyticsAccountRepository();
                                    //    GoogleAnalyticsAccount objGaAcc = objGaAccRepo.getGoogelAnalyticsAccountHomeDetailsById(user.Id, item.ProfileId);
                                    //    ArrayList arrlist = objGaAccRepo.getMaxGAStats(item.ProfileId);
                                    //    int dayvisit = 0, monthvisit = 0, yearvisit = 0;
                                    //    foreach (var itemData in arrlist)
                                    //    {
                                    //        Array temp = (Array)itemData;
                                    //        if (temp.GetValue(0).ToString() == "year")
                                    //            yearvisit = int.Parse(temp.GetValue(2).ToString());
                                    //        else if (temp.GetValue(0).ToString() == "month")
                                    //            monthvisit = int.Parse(temp.GetValue(2).ToString());
                                    //        else if (temp.GetValue(0).ToString() == "day")
                                    //            dayvisit = int.Parse(temp.GetValue(2).ToString());
                                    //    }
                                    //    midsnaps += "<div class=\"span4 rounder recpro\" style=\"height:333px;\"><div class=\"col_five_ga_my_accounts\"><div class=\"dt\">" +
                                    //        "<a class=\"img\"><img src=\"../Contents/img/google_analytics.png\" width=\"48\" height=\"48\" alt=\"\" /></a></div>" +
                                    //    "<div class=\"dd\"><div class=\"useraccname\" style=\"margin-left:0px;\">" + objGaAcc.GaAccountName + "</div><div class=\"friends_avg\"><div class=\"ga_content\">Google Analytics</div></div></div></div>" +
                                    //"<div class=\"pillow_fade\">" +
                                    //  "<div class=\"ga_trafic_number_graph\"><div class=\"ga_trafic\">Year</div><div class=\"ga_number\">" + yearvisit + "</div><div class=\"ga_graph\"></div></div>" +
                                    //  "<div class=\"ga_trafic_number_graph\"><div class=\"ga_trafic\">Month</div><div class=\"ga_number\">" + monthvisit + "</div><div class=\"ga_graph\"></div></div>" +
                                    //  "<div class=\"ga_trafic_number_graph\"><div class=\"ga_trafic\">Day</div><div class=\"ga_number\">" + dayvisit + "</div><div class=\"ga_graph\"></div></div></div></div>";
                                    //}
                                    //catch (Exception ex)
                                    //{
                                    //    Console.WriteLine(ex.Message);
                                    //    logger.Error(ex.Message);
                                    //}
                                }
                            }
                            midsnaps += "</div>";
                            Response.Write(midsnaps);
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }

                }
                else if (Request.QueryString["op"] == "accountdelete")
                {
                    Session["facebooktotalprofiles"] = null;
                    SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository();
                    string Profiletype = Request.QueryString["profile"];
                    string profileid = Request.QueryString["profileid"];

                    if (Profiletype == "fb")
                    {
                        try
                        {
                            FacebookAccountRepository fbrepo = new FacebookAccountRepository();
                            int delacc = fbrepo.deleteFacebookUser(profileid, user.Id);
                            if (delacc != 0)
                            {

                                socioprofilerepo.deleteProfile(user.Id, profileid);
                                List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid);
                                if (lstsocioprofile.Count == 0)
                                {
                                    FacebookMessageRepository fbmsgrepo = new FacebookMessageRepository();
                                    fbmsgrepo.deleteAllMessagesOfUser(profileid, user.Id);
                                    FacebookFeedRepository fbfeedrepo = new FacebookFeedRepository();
                                    fbfeedrepo.deleteAllFeedsOfUser(profileid, user.Id);
                                    FacebookStatsRepository fbstatsrepo = new FacebookStatsRepository();
                                    fbstatsrepo.deleteFacebookStats(profileid, user.Id);
                                }
                            }

                        }
                        catch (Exception exx)
                        {
                            Console.WriteLine(exx.Message);
                            logger.Error(exx.Message);
                        }
                    }
                    else if (Profiletype == "twt")
                    {
                        try
                        {
                            TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository();
                            int deltwtacc = twtaccountrepo.deleteTwitterUser(user.Id, profileid);
                            if (deltwtacc != 0)
                            {
                                socioprofilerepo.deleteProfile(user.Id, profileid);
                                List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid);
                                if (lstsocioprofile.Count == 0)
                                {
                                    TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository();
                                    int d = twtmsgrepo.deleteTwitterMessage(profileid, user.Id);
                                    TwitterFeedRepository twtfeedrepo = new TwitterFeedRepository();
                                    int s = twtfeedrepo.deleteTwitterFeed(profileid, user.Id);
                                    TwitterStatsRepository twtstatsrepo = new TwitterStatsRepository();
                                    int a = twtstatsrepo.deleteTwitterStats(user.Id, profileid);
                                    TwitterDirectMessageRepository twtdirectmsgrepo = new TwitterDirectMessageRepository();
                                    int f = twtdirectmsgrepo.deleteDirectMessage(user.Id, profileid);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }
                    }
                    else if (Profiletype == "linkedin")
                    {
                        try
                        {
                            LinkedInAccountRepository linkedaccrepo = new LinkedInAccountRepository();
                            int dellinacc = linkedaccrepo.deleteLinkedinUser(profileid, user.Id);
                            if (dellinacc != 0)
                            {

                                socioprofilerepo.deleteProfile(user.Id, profileid);

                                List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid);

                                if (lstsocioprofile.Count == 0)
                                {
                                    LinkedInFeedRepository linkedfeedrepo = new LinkedInFeedRepository();
                                    int s = linkedfeedrepo.deleteAllFeedsOfUser(profileid, user.Id);

                                }

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

                    }
                    else if (Profiletype == "instagram")
                    {
                        try
                        {
                            InstagramAccountRepository insaccrepo = new InstagramAccountRepository();
                            int insacc = insaccrepo.deleteInstagramUser(profileid, user.Id);
                            if (insacc != 0)
                            {

                                socioprofilerepo.deleteProfile(user.Id, profileid);

                                List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid);

                                if (lstsocioprofile.Count == 0)
                                { }

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

                        }
                    }
                    else if (Profiletype == "googleplus")
                    {
                        try
                        {
                            GooglePlusAccountRepository googleplusaccrepo = new GooglePlusAccountRepository();
                            int gplusacc = googleplusaccrepo.deleteGooglePlusUser(profileid, user.Id);
                            if (gplusacc != 0)
                            {

                                socioprofilerepo.deleteProfile(user.Id, profileid);

                                List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid);

                                if (lstsocioprofile.Count == 0)
                                {
                                }

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

                        }
                    }

                    string profiles = string.Empty;
                    profiles += "<div class=\"drop_top\"></div><div class=\"drop_mid\">";

                    /*facebook users binding*/
                    FacebookAccountRepository fbprepo = new FacebookAccountRepository();
                    ArrayList lstfbaccounts = fbprepo.getFacebookAccountsOfUser(user.Id);

                    profiles += "<div class=\"twitte_text\">FACEBOOK</div><div class=\"teitter\"><ul>";

                    if (lstfbaccounts.Count == 0)
                    {
                        profiles += "<li>No Records Found</li>";
                    }
                    else
                    {
                        foreach (FacebookAccount fbacc in lstfbaccounts)
                        {
                            profiles += "<li id=\"liid_" + fbacc.FbUserId + "\"   onclick=\"composemessage(this.id,'fb')\"><a><img id=\"img_" + fbacc.FbUserId + "\" src=\"../Contents/img/facebook.png\" alt=\"" + fbacc.AccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"composename_" + fbacc.FbUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + fbacc.FbUserName + "</span><span id=\"imgurl_" + fbacc.FbUserId + "\" style=\"display:none;\">http://graph.facebook.com/" + fbacc.FbUserId + "/picture?type=small</span></a></li>";
                        }
                    }
                    profiles += "</ul> </div>";

                    /*twitter users binding*/
                    TwitterAccountRepository twtpaccountrepo = new TwitterAccountRepository();
                    ArrayList alsttwtaccounts = twtpaccountrepo.getAllTwitterAccountsOfUser(user.Id);
                    profiles += "<div class=\"twitte_text\">TWITTER</div><div class=\"teitter\"><ul>";

                    if (alsttwtaccounts.Count == 0)
                    {
                        profiles += "<li>No Records Found</li>";
                    }
                    else
                    {
                        foreach (SocioBoard.Domain.TwitterAccount item in alsttwtaccounts)
                        {
                            profiles += "<li id=\"liid_" + item.TwitterUserId + "\"   onclick=\"composemessage(this.id,'twt')\"><a><img id=\"img_" + item.TwitterUserId + "\" src=\"../Contents/img/twitter.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.TwitterUserId + "\" style=\"display:none;\">" + item.ProfileImageUrl + "</span><span id=\"composename_" + item.TwitterUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.TwitterScreenName + "</span></a></li>";
                        }
                    }
                    profiles += "</ul> </div>";

                    /*linkedinuserbinding*/
                    LinkedInAccountRepository linkaccountrepo = new LinkedInAccountRepository();
                    ArrayList alstlinkacc = linkaccountrepo.getAllLinkedinAccountsOfUser(user.Id);
                    profiles += "<div class=\"twitte_text\">LINKEDIN</div><div class=\"teitter\"><ul>";

                    if (alstlinkacc.Count == 0)
                    {
                        profiles += "<li>No Records Found</li>";
                    }
                    else
                    {

                        foreach (LinkedInAccount item in alstlinkacc)
                        {
                            string profileurl = string.Empty;

                            if (!string.IsNullOrEmpty(item.ProfileImageUrl))
                            {
                                profileurl = item.ProfileImageUrl;
                            }
                            else
                            {
                                profileurl = "../../Contents/img/blank_img.png";
                            }
                            profiles += "<li id=\"liid_" + item.LinkedinUserId + "\"   onclick=\"composemessage(this.id,'lin')\"><a><img id=\"img_" + item.LinkedinUserId + "\" src=\"../Contents/img/link.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.LinkedinUserId + "\" style=\"display:none;\">" + profileurl + "</span><span id=\"composename_" + item.LinkedinUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.LinkedinUserName + "</span></a></li>";
                        }
                    }
                    profiles += "</ul> </div>";
                    Session["profilesforcomposemessage"] = profiles;

                }
                else if (Request.QueryString["op"] == "MasterCompose")
                {
                    string profiles = string.Empty;

                    if (Session["profilesforcomposemessage"] == null)
                    {
                        profiles += "<div class=\"drop_top\"></div><div class=\"drop_mid\">";

                        /*facebook users binding*/
                        FacebookAccountRepository fbrepo = new FacebookAccountRepository();
                        ArrayList lstfbaccounts = fbrepo.getFacebookAccountsOfUser(user.Id);

                        profiles += "<div class=\"twitte_text\">FACEBOOK</div><div class=\"teitter\"><ul>";

                        if (lstfbaccounts.Count == 0)
                        {
                            profiles += "<li>No Records Found</li>";
                        }
                        else
                        {
                            foreach (FacebookAccount fbacc in lstfbaccounts)
                            {
                                profiles += "<li nwtk='fb' class=\"getAllNetworkProfile\" id=\"liid_" + fbacc.FbUserId + "\"   onclick=\"composemessage(this.id,'fb')\"><a><img id=\"img_" + fbacc.FbUserId + "\" src=\"../Contents/img/facebook.png\" alt=\"" + fbacc.AccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"composename_" + fbacc.FbUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + fbacc.FbUserName + "</span><span id=\"imgurl_" + fbacc.FbUserId + "\" style=\"display:none;\">http://graph.facebook.com/" + fbacc.FbUserId + "/picture?type=small</span></a></li>";
                            }
                        }
                        profiles += "</ul> </div>";

                        /*twitter users binding*/
                        TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository();
                        ArrayList alsttwtaccounts = twtaccountrepo.getAllTwitterAccountsOfUser(user.Id);
                        profiles += "<div class=\"twitte_text\">TWITTER</div><div class=\"teitter\"><ul>";

                        if (alsttwtaccounts.Count == 0)
                        {
                            profiles += "<li>No Records Found</li>";
                        }
                        else
                        {
                            foreach (SocioBoard.Domain.TwitterAccount item in alsttwtaccounts)
                            {
                                profiles += "<li nwtk='twt' class=\"getAllNetworkProfile\" id=\"liid_" + item.TwitterUserId + "\"   onclick=\"composemessage(this.id,'twt')\"><a><img id=\"img_" + item.TwitterUserId + "\" src=\"../Contents/img/twitter.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.TwitterUserId + "\" style=\"display:none;\">" + item.ProfileImageUrl + "</span><span id=\"composename_" + item.TwitterUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.TwitterScreenName + "</span></a></li>";
                            }
                        }
                        profiles += "</ul> </div>";

                        /*linkedinuserbinding*/
                        LinkedInAccountRepository linkaccountrepo = new LinkedInAccountRepository();
                        ArrayList alstlinkacc = linkaccountrepo.getAllLinkedinAccountsOfUser(user.Id);
                        profiles += "<div class=\"twitte_text\">LINKEDIN</div><div class=\"teitter\"><ul>";

                        if (alstlinkacc.Count == 0)
                        {
                            profiles += "<li>No Records Found</li>";
                        }
                        else
                        {

                            foreach (LinkedInAccount item in alstlinkacc)
                            {
                                string profileurl = string.Empty;

                                if (!string.IsNullOrEmpty(item.ProfileImageUrl))
                                {
                                    profileurl = item.ProfileImageUrl;
                                }
                                else
                                {
                                    profileurl = "../../Contents/img/blank_img.png";
                                }
                                profiles += "<li nwtk='lin' class=\"getAllNetworkProfile\" id=\"liid_" + item.LinkedinUserId + "\"   onclick=\"composemessage(this.id,'lin')\"><a><img id=\"img_" + item.LinkedinUserId + "\" src=\"../Contents/img/link.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.LinkedinUserId + "\" style=\"display:none;\">" + profileurl + "</span><span id=\"composename_" + item.LinkedinUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.LinkedinUserName + "</span></a></li>";
                            }
                        }
                        profiles += "</ul> </div>";
                        Session["profilesforcomposemessage"] = profiles;
                    }
                    else
                    {
                        profiles = (string)Session["profilesforcomposemessage"];
                    }
                    Response.Write(profiles);
                }
                else if (Request.QueryString["op"] == "sendmessage")
                {

                    string message = Request.QueryString["message"];
                    var userid = Request.QueryString["userid[]"].Split(',');
                    var files = Request.Files.Count;
                    var fi = Request.Files["file"];
                    string file = string.Empty;
                    try
                    {

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

                    }
                    catch (Exception ex)
                    {

                        logger.Error(ex.Message);

                    }

                    foreach (var item in userid)
                    {
                        string[] networkingwithid = item.Split('_');
                        if (networkingwithid[0] == "fb")
                        {
                            try
                            {
                                FacebookAccountRepository fbaccountrepo = new FacebookAccountRepository();
                                FacebookAccount fbaccount = fbaccountrepo.getFacebookAccountDetailsById(networkingwithid[1], user.Id);
                                var args = new Dictionary<string, object>();

                                args["message"] = message;

                                if (Request.Files.Count > 0)
                                {
                                    string strPathAndQuery = HttpContext.Current.Request.Url.PathAndQuery;
                                    string strUrl = HttpContext.Current.Request.Url.AbsoluteUri.Replace(strPathAndQuery, "/");
                                    string filepath = strUrl + "/Contents/img/upload/" + fi.FileName;
                                    args["picture"] = filepath;
                                }
                                FacebookClient fc = new FacebookClient(fbaccount.AccessToken);

                                string facebookpost = string.Empty;
                                if (fbaccount.Type == "page")
                                {
                                    facebookpost=fc.Post("/" + fbaccount.FbUserId + "/feed", args).ToString();
                                }
                                else
                                {
                                    facebookpost = fc.Post("/me/feed", args).ToString();
                                }

                                if (facebookpost.ToString() != string.Empty)
                                {
                                    Response.Write("Succesfully posted");
                                }
                                else
                                {
                                    Response.Write("Not posted");
                                }

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

                                Console.WriteLine(ex.Message);
                            }

                        }
                        else if (networkingwithid[0] == "twt")
                        {
                            try
                            {
                                TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository();
                                SocioBoard.Domain.TwitterAccount twtaccount = twtaccountrepo.getUserInformation(user.Id, networkingwithid[1]);

                                TwitterHelper twthelper = new TwitterHelper();

                                oAuthTwitter OAuthTwt = new oAuthTwitter();
                                OAuthTwt.AccessToken = twtaccount.OAuthToken;
                                OAuthTwt.AccessTokenSecret = twtaccount.OAuthSecret;
                                OAuthTwt.TwitterScreenName = twtaccount.TwitterScreenName;
                                OAuthTwt.TwitterUserId = twtaccount.TwitterUserId;

                                twthelper.SetCofigDetailsForTwitter(OAuthTwt);

                                #region For Testing
                                // For Testing

                                //OAuthTwt.ConsumerKey = "udiFfPxtCcwXWl05wTgx6w";
                                //OAuthTwt.ConsumerKeySecret = "jutnq6N32Rb7cgbDSgfsrUVgRQKMbUB34yuvAfCqTI";
                                //OAuthTwt.AccessToken = "1453351098-Lz4H7cHKp26pXarF6l9zEwdiHDnwH7D0H4zteH3";
                                //OAuthTwt.AccessTokenSecret = "dGBPxR9wxhQMioIcj5P4Wemxo5EZIZ8wlvDz7i39lSNFg";
                                //OAuthTwt.TwitterScreenName = "";
                                //OAuthTwt.TwitterUserId = "";
                                #endregion

                                Tweet twt = new Tweet();
                                if (Request.Files.Count > 0)
                                {

                                    PhotoUpload ph = new PhotoUpload();
                                    //ph.Tweet(file, message, OAuthTwt);
                                    string res = string.Empty;
                                    ph.NewTweet(file, message, OAuthTwt, ref res);

                                    // for testing

                                    Response.Write(res);
                                    Console.WriteLine(res);
                                }
                                else
                                {
                                    JArray post = twt.Post_Statuses_Update(OAuthTwt, message);
                                }
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.Message);
                                logger.Error(ex.Message);

                            }
                        }
                        else if (networkingwithid[0] == "lin")
                        {
                            try
                            {
                                LinkedInAccountRepository linkedinaccrepo = new LinkedInAccountRepository();
                                LinkedInAccount linkedaccount = linkedinaccrepo.getUserInformation(user.Id, networkingwithid[1]);
                                oAuthLinkedIn Linkedin_oauth = new oAuthLinkedIn();

                                Linkedin_oauth.Verifier = linkedaccount.OAuthVerifier;
                                Linkedin_oauth.TokenSecret = linkedaccount.OAuthSecret;
                                Linkedin_oauth.Token = linkedaccount.OAuthToken;
                                Linkedin_oauth.Id = linkedaccount.LinkedinUserId;
                                Linkedin_oauth.FirstName = linkedaccount.LinkedinUserName;
                                SocialStream sociostream = new SocialStream();
                                string res = sociostream.SetStatusUpdate(Linkedin_oauth, message);
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.Message);
                                logger.Error(ex.Message);

                            }
                        }
                    }
                }
                else if (Request.QueryString["op"] == "wooqueue_messages")
                {
                    ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository();
                }
                else if (Request.QueryString["op"] == "schedulemessage")
                {

                    var userid = Request.QueryString["users[]"].Split(',');
                    var datearr = Request.QueryString["datearr[]"].Split(',');
                    string message = Request.QueryString["message"];
                    ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository();
                    string time = Request.QueryString["time"];
                    string clienttime = Request.QueryString["clittime"];

                    foreach (var item in userid)
                    {
                        if (!string.IsNullOrEmpty(item.ToString()))
                        {
                            foreach (var child in datearr)
                            {

                                ScheduledMessage schmessage = new ScheduledMessage();
                                string[] networkingwithid = item.Split('_');

                                if (networkingwithid[0] == "fbscheduler")
                                {
                                    schmessage.CreateTime = DateTime.Now;
                                    schmessage.ProfileType = "facebook";
                                    schmessage.ProfileId = networkingwithid[1];
                                    schmessage.Id = Guid.NewGuid();
                                    schmessage.PicUrl = string.Empty;
                                    schmessage.ClientTime = Convert.ToDateTime(clienttime);
                                    string servertime = this.CompareDateWithServer(clienttime, child + " " + time);
                                    schmessage.ScheduleTime = Convert.ToDateTime(servertime);
                                    schmessage.ShareMessage = message;
                                    schmessage.UserId = user.Id;
                                    schmessage.Status = false;

                                }
                                else if (networkingwithid[0] == "twtscheduler")
                                {

                                    schmessage.CreateTime = DateTime.Now;
                                    schmessage.ProfileType = "twitter";
                                    schmessage.ProfileId = networkingwithid[1];
                                    schmessage.Id = Guid.NewGuid();
                                    schmessage.PicUrl = string.Empty;
                                    schmessage.ClientTime = Convert.ToDateTime(clienttime);
                                    string servertime = this.CompareDateWithServer(clienttime, child + " " + time);
                                    schmessage.ScheduleTime = Convert.ToDateTime(servertime);
                                    schmessage.ShareMessage = message;
                                    schmessage.UserId = user.Id;
                                    schmessage.Status = false;

                                }
                                else if (networkingwithid[0] == "linscheduler")
                                {
                                    schmessage.ClientTime = Convert.ToDateTime(clienttime);
                                    schmessage.CreateTime = DateTime.Now;
                                    schmessage.ProfileType = "linkedin";
                                    schmessage.ProfileId = networkingwithid[1];
                                    schmessage.Id = Guid.NewGuid();
                                    schmessage.PicUrl = string.Empty;
                                    string servertime = this.CompareDateWithServer(clienttime, child + " " + time);
                                    schmessage.ScheduleTime = Convert.ToDateTime(servertime);
                                    schmessage.ShareMessage = message;
                                    schmessage.UserId = user.Id;
                                    schmessage.Status = false;

                                }
                                if (!string.IsNullOrEmpty(message))
                                {
                                    if (!schmsgrepo.checkMessageExistsAtTime(user.Id, schmessage.ShareMessage, schmessage.ScheduleTime, schmessage.ProfileId))
                                    {
                                        schmsgrepo.addNewMessage(schmessage);
                                    }
                                }
                            }
                        }
                    }
                }
                else if (Request.QueryString["op"] == "insight")
                {
                    FacebookAccount objFacebookAccount = (FacebookAccount)Session["fbpagedetail"];
                    FacebookHelper objFbHelper = new FacebookHelper();
                    SocialProfile socioprofile = new SocialProfile();
                    SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository();
                    FacebookAccountRepository fbrepo = new FacebookAccountRepository();
                    FacebookClient fbClient = new FacebookClient(objFacebookAccount.AccessToken);
                    int fancountPage = 0;
                    dynamic fancount = fbClient.Get("fql", new { q = " SELECT fan_count FROM page WHERE page_id =" + Request["id"].ToString() });
                    foreach (var friend in fancount.data)
                    {
                        fancountPage = Convert.ToInt32(friend.fan_count);
                    }
                    objFacebookAccount.Friends = Convert.ToInt32(fancountPage);
                    objFacebookAccount.FbUserId = Request["id"].ToString();
                    objFacebookAccount.FbUserName = Request["name"].ToString();
                    objFacebookAccount.Type = "page";
                    objFacebookAccount.UserId = user.Id;
                    socioprofile.Id = Guid.NewGuid();
                    socioprofile.ProfileDate = DateTime.Now;
                    socioprofile.ProfileId = Request["id"].ToString();
                    socioprofile.ProfileStatus = 1;
                    socioprofile.ProfileType = "facebook";
                    socioprofile.UserId = user.Id;
                    if (!fbrepo.checkFacebookUserExists(objFacebookAccount.FbUserId, user.Id))
                    {
                        fbrepo.addFacebookUser(objFacebookAccount);
                        if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                        {
                            socioprofilerepo.addNewProfileForUser(socioprofile);
                        }
                        else
                        {
                            socioprofilerepo.updateSocialProfile(socioprofile);
                        }
                    }
                    else
                    {
                        fbrepo.updateFacebookUser(objFacebookAccount);
                        if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                        {
                            socioprofilerepo.addNewProfileForUser(socioprofile);
                        }
                        else
                        {
                            socioprofilerepo.updateSocialProfile(socioprofile);
                        }
                    }
                    Session["fbSocial"] = null;
                }
                else if (Request.QueryString["op"] == "countmessages")
                {
                    try
                    {
                        int val = 0;
                        /*facebook*/
                        FacebookAccountRepository fbAccoutsRepo = new FacebookAccountRepository();
                        ArrayList lstfacebookAccounts = fbAccoutsRepo.getAllFacebookAccountsOfUser(user.Id);
                        foreach (FacebookAccount item in lstfacebookAccounts)
                        {
                            try
                            {
                                FacebookClient fb = new FacebookClient(item.AccessToken);
                                dynamic unreadcount = fb.Get("fql", new { q = "SELECT unread_count FROM mailbox_folder WHERE folder_id = 0 AND viewer_id = " + item.FbUserId + "" });
                                foreach (var chile in unreadcount.data)
                                {
                                    var count = chile.unread_count;
                                    int countable = Convert.ToInt32(count.ToString());
                                    val = val + countable;

                                }
                            }
                            catch (Exception ex)
                            {
                                logger.Error(ex.Message);
                                Console.WriteLine(ex.Message);
                            }
                        }
                        /*Twitter*/
                        Session["CountMessages"] = val;
                        Response.Write(val);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }

                }

                else if (Request.QueryString["op"] == "recentfollowers")
                {
                    string recentfollowers = string.Empty;
                    #region RecentFollowers
                    Users twtUsers = new Users();
                    TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                    ArrayList lstAccRepo = twtAccRepo.getAllTwitterAccountsOfUser(user.Id);
                    oAuthTwitter oauth = null;
                    foreach (TwitterAccount itemTwt in lstAccRepo)
                    {
                        oauth = new oAuthTwitter();
                        oauth.AccessToken = itemTwt.OAuthToken;
                        oauth.AccessTokenSecret = itemTwt.OAuthSecret;
                        oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
                        oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
                        oauth.TwitterScreenName = itemTwt.TwitterScreenName;
                        oauth.TwitterUserId = itemTwt.TwitterUserId;
                        JArray jarresponse = twtUsers.Get_Followers_ById(oauth, itemTwt.TwitterUserId);
                        foreach (var item in jarresponse)
                        {
                            int resposecount = 0;
                            if (item["ids"] != null)
                            {
                                foreach (var child in item["ids"])
                                {
                                    if (resposecount < 2)
                                    {
                                        JArray userprofile = twtUsers.Get_Users_LookUp(oauth, child.ToString());

                                        foreach (var items in userprofile)
                                        {
                                            resposecount++;
                                            try
                                            {
                                                recentfollowers += "<li><a href=\"https://twitter.com/" + items["screen_name"] + "\" target=\"_blank\"><img style=\"border:3px solid #FCFCFC;\" title=\"" + items["name"] + "\" width=\"48\" height=\"48\" alt=\"\" src=\"" + items["profile_image_url"] + "\"></a></li>";
                                            }
                                            catch (Exception ex)
                                            {
                                                Console.WriteLine(ex.Message);
                                            }

                                        }
                                    }
                                }
                            }
                        }
                    }

                    Response.Write(recentfollowers);

                    #endregion

                }
                else if (Request.QueryString["op"] == "removefollowers")
                {
                    string removeid = Request.QueryString["removeid"];
                    string userid = Request.QueryString["userid"];
                    Friendship friendship = new Friendship();
                    oAuthTwitter oauth = new oAuthTwitter();
                    TwitterAccountRepository twtaccrepo = new TwitterAccountRepository();
                    TwitterAccount twtAccount = twtaccrepo.getUserInformation(user.Id, userid);
                    oauth.TwitterUserId = twtAccount.TwitterUserId;
                    oauth.TwitterScreenName = twtAccount.TwitterScreenName;
                    oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
                    oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
                    oauth.AccessToken = twtAccount.OAuthToken;
                    oauth.AccessTokenSecret = twtAccount.OAuthSecret;
                    JArray responseremove = friendship.Post_Friendship_Destroy(oauth, removeid);

                }
                else if (Request.QueryString["op"] == "wooqueuemessages")
                {
                    ScheduledMessageRepository schmsgRepo = new ScheduledMessageRepository();
                    List<ScheduledMessage> lstschMsg = schmsgRepo.getAllMessagesOfUser(user.Id);
                    string schmessages = string.Empty;
                    string profurl = string.Empty;
                    if (string.IsNullOrEmpty(user.ProfileUrl))
                    {
                        profurl = "../Contents/img/blank_img.png";
                    }
                    else
                    {
                        // profurl = "../Contents/img/blank_img.png";
                        profurl = user.ProfileUrl;
                    }
                    if (lstschMsg.Count != 0)
                    {
                        foreach (ScheduledMessage item in lstschMsg)
                        {

                            schmessages += "<section class=\"section\"><div  class=\"js-task-cont read\">" +
                                                     "<section class=\"task-owner\">" +
                                                         "<img width=\"32\" height=\"32\" border=\"0\" src=\"" + profurl + "\" class=\"avatar\">" +
                                                     "</section>" +
                                                     "<section class=\"task-activity third\">" +
                                                         "<p>" + user.UserName + "</p>" +
                                                         "<div>" + item.CreateTime + "</div>" +
                                                         "<input type=\"hidden\" value=\"#\" id=\"hdntaskid_1\">" +
                                                         "<p></p>" +
                                                   "</section>" +
                                                   "<section class=\"task-message font-13 third\" style=\"height: auto; width: 31%; margin-right: 9px;\"><a class=\"tip_left\">" + item.ShareMessage + "</a></section>";

                            if (item.ProfileType == "facebook")
                            {
                                schmessages += "<div style=\"height:70px; margin-top: 0;\" class=\"userpictiny\">" +
                                                    "<img width=\"48\" height=\"48\" src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\" alt=\"\">" +
                                                    "<a style=\"right: 2px; top: 40px;\" title=\"\" class=\"userurlpic\" href=\"#\">" +
                                                        "<img  alt=\"\" src=\"../Contents/img/facebook.png\" style=\"height: 16px;width: 16x;\"></a></div>";
                            }
                            else if (item.ProfileType == "twitter")
                            {
                                TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                                TwitterAccount twtAccount = twtAccRepo.getUserInformation(user.Id, item.ProfileId);
                                if (twtAccount != null)
                                {
                                    schmessages += "<div style=\"height:70px; margin-top: 0;\" class=\"userpictiny\">" +
                                                    "<img width=\"48\" height=\"48\" src=\"" + twtAccount.ProfileImageUrl + "\" alt=\"\">" +
                                                    "<a style=\"right: 2px; top: 40px;\" title=\"\" class=\"userurlpic\" href=\"#\">" +
                                                        "<img  alt=\"\" src=\"../Contents/img/twitter.png\" style=\"height: 16px;width: 16x;\"></a></div>";
                                }
                            }
                            else if (item.ProfileType == "linkedin")
                            {
                                LinkedInAccountRepository linkAccRepo = new LinkedInAccountRepository();
                                LinkedInAccount linkedAccount = linkAccRepo.getUserInformation(user.Id, item.ProfileId);
                                if (linkedAccount != null)
                                {
                                    schmessages += "<div style=\"height:70px; margin-top: 0;\" class=\"userpictiny\">" +
                                                        "<img width=\"48\" height=\"48\" src=\"" + linkedAccount.ProfileImageUrl + "\" alt=\"\">" +
                                                        "<a style=\"right: 2px; top: 40px;\" title=\"\" class=\"userurlpic\" href=\"#\">" +
                                                            "<img  alt=\"\" src=\"../Contents/img/link.png\" style=\"height: 16px;width: 16x;\"></a></div>";
                                }

                            }
                            schmessages += "<section class=\"task-status\" style=\"width:34px;\"><div class=\"ui_light floating task_status_change\">" +
                                           "<a href=\"#nogo\" class=\"ui-sproutmenu\"><span class=\"ui-sproutmenu-status\"><img title=\"Edit Status\" onclick=\"PerformClick(this.id)\" src=\"../Contents/img/icon_edit.png\" class=\"edit_button\" id=\"img_" + item.Id + "_" + item.Status + "\"></span></a></div></section>" +
                                           "<section class=\"task-status\" style=\"width: 65px; margin-right: 39px;\">" +
                                //"<span class=\"ficon task_active\" id=\"taskcomment\">" +
                                // "<img width=\"14\" height=\"17\" alt=\"\" src=\"../Contents/img/task/task_pin.png\" onclick=\"getmemberdata('7fd5773f-c5b0-4624-bba1-b8a6c0fbd56d');\">" +
                                //"</span>" +
                                          "<div class=\"ui_light floating task_status_change\">" +
                                               "<a href=\"#nogo\" class=\"ui-sproutmenu\">" +
                                                   "<span class=\"ui-sproutmenu-status\">" + item.Status + "</span>" +
                                              "</a>" +
                                          "</div>" +
                                      "</section>" +
                                   "</div></section>";
                        }
                    }
                    else
                    {
                        schmessages = "<section class=\"section\"><div class=\"js-task-cont read\"><section class=\"task-owner\">" +
                          "<img width=\"32\" height=\"32\" border=\"0\" class=\"avatar\" src=\"" + profurl + "\">" +
                          "</section><section class=\"task-activity third\"><p>" + user.UserName + "</p><div></div><p></p></section><section style=\"margin-right: 6px; width: 31%; height: auto;\" class=\"task-message font-13 third\">" +
                          "<a class=\"tip_left\">No Schduled Messages</a></section><section style=\"width:113px;\" class=\"task-status\"><span class=\"ficon task_active\"></span>" +
                          "<div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\" href=\"#nogo\">" +
                          "<span class=\"ui-sproutmenu-status\"></span></a></div></section></div></section>";
                    }
                    Response.Write(schmessages);

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

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

                    updatequeue(Request.QueryString["id"], Request.QueryString["status"]);

                }

                else if (Request.QueryString["op"] == "messagechk")
                {
                    SocioBoard.Domain.Messages mstable = new SocioBoard.Domain.Messages();
                    string[] types = Request.QueryString["type[]"].Split(',');
                    DataSet ds = (DataSet)Session["MessageDataTable"];
                    DataSet dss = DataTableGenerator.CreateDataSetForTable(mstable);
                    DataTable dtt = dss.Tables[0];
                    DataView dv = new DataView(dtt);
                    AjaxMessage ajxfed = new AjaxMessage();
                    string message = string.Empty;
                    foreach (var item in types)
                    {
                        try
                        {
                            DataRow[] foundRows = ds.Tables[0].Select("Type = '" + item + "'");
                            foreach (var child in foundRows)
                            {
                                dtt.ImportRow(child);
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }
                    }
                    message = ajxfed.BindData(dtt);
                    Response.Write(message);
                }
            }
        }
Пример #9
0
 /// <summary>
 /// Returns settings (including current trend, geo and sleep time information) for the authenticating user. 
 /// </summary>
 /// <param name="oAuth"></param>
 /// <returns></returns>
 public JArray GetAccount_Settings(oAuthTwitter oAuth)
 {
     Users objUser = new Users();
     JArray jarrUser = new JArray();
     jarrUser = objUser.Get_Account_Settings(oAuth);
     return jarrUser;
 }
        public string DiscoverySearchTwitter(string UserId, string keyword)
        {
            List<Domain.Myfashion.Domain.DiscoverySearch> lstDiscoverySearch = new List<Domain.Myfashion.Domain.DiscoverySearch>();
            string profileid = string.Empty;
            try
            {
                oAuthTwitter oauth = new oAuthTwitter();
                Twitter obj = new Twitter();

                TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                List<Domain.Myfashion.Domain.TwitterAccount> alst = twtAccRepo.getTwtAccount();
                foreach (Domain.Myfashion.Domain.TwitterAccount item in alst)
                {
                    oauth.AccessToken = item.OAuthToken;
                    oauth.AccessTokenSecret = item.OAuthSecret;
                    oauth.TwitterUserId = item.TwitterUserId;
                    oauth.TwitterScreenName = item.TwitterScreenName;
                    obj.SetCofigDetailsForTwitter(oauth);
                    try
                    {
                        Users _Users = new Users();
                        JArray _AccountVerify = _Users.Get_Account_Verify_Credentials(oauth);
                        string id = _AccountVerify["id_str"].ToString();
                        break;
                    }
                    catch (Exception ex)
                    {

                    }
                    //if (this.CheckTwitterToken(oauth, keyword))
                    //{
                    //    break;
                    //}
                }

                Search search = new Search();
                JArray twitterSearchResult = search.Get_Search_Tweets(oauth, keyword);
                foreach (var item in twitterSearchResult)
                {
                    var results = item["statuses"];
                    foreach (var chile in results)
                    {
                        try
                        {
                            objDiscoverySearch = new Domain.Myfashion.Domain.DiscoverySearch();
                            objDiscoverySearch.SearchKeyword = keyword;
                            objDiscoverySearch.Network = "twitter";
                            objDiscoverySearch.Id = Guid.NewGuid();
                            objDiscoverySearch.UserId = Guid.Parse(UserId);

                            if (!dissearchrepo.isKeywordPresentforNetwork(objDiscoverySearch.SearchKeyword, objDiscoverySearch.Network))
                            {
                                dissearchrepo.addNewSearchResult(objDiscoverySearch);
                            }

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

                        try
                        {
                            objDiscoverySearch = new Domain.Myfashion.Domain.DiscoverySearch();
                            objDiscoverySearch.CreatedTime = Utility.ParseTwitterTime(chile["created_at"].ToString().TrimStart('"').TrimEnd('"')); ;
                            objDiscoverySearch.EntryDate = DateTime.Now;
                            objDiscoverySearch.FromId = chile["user"]["id_str"].ToString().TrimStart('"').TrimEnd('"');
                            objDiscoverySearch.FromName = chile["user"]["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                            objDiscoverySearch.ProfileImageUrl = chile["user"]["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                            objDiscoverySearch.SearchKeyword = keyword;
                            objDiscoverySearch.Network = "twitter";
                            objDiscoverySearch.Message = chile["text"].ToString().TrimStart('"').TrimEnd('"');
                            objDiscoverySearch.MessageId = chile["id_str"].ToString().TrimStart('"').TrimEnd('"');
                            objDiscoverySearch.Id = Guid.NewGuid();
                            objDiscoverySearch.UserId = Guid.Parse(UserId);

                            lstDiscoverySearch.Add(objDiscoverySearch);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                }
                return new JavaScriptSerializer().Serialize(lstDiscoverySearch);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return new JavaScriptSerializer().Serialize("Please try Again");
            }
        }
Пример #11
0
        public string contactSearchTwitter(string keyword)
        {
            List<Domain.Socioboard.Domain.DiscoverySearch> lstDiscoverySearch = new List<Domain.Socioboard.Domain.DiscoverySearch>();
            string profileid = string.Empty;
            try
            {

                oAuthTwitter oauth = new oAuthTwitter();
                Twitter obj = new Twitter();

                TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                ArrayList alst = twtAccRepo.getAllTwitterAccounts();
                foreach (Domain.Socioboard.Domain.TwitterAccount item in alst)
                {
                    oauth.AccessToken = item.OAuthToken;
                    oauth.AccessTokenSecret = item.OAuthSecret;
                    oauth.TwitterUserId = item.TwitterUserId;
                    oauth.TwitterScreenName = item.TwitterScreenName;
                    obj.SetCofigDetailsForTwitter(oauth);
                    if (this.CheckTwitterToken(oauth, keyword))
                    {
                        break;
                    }
                }

                Users twtUser = new Users();
                JArray twitterSearchResult = twtUser.Get_Users_Search(oauth, keyword, "20");
                foreach (var item in twitterSearchResult)
                {
                    try
                    {
                        objDiscoverySearch = new Domain.Socioboard.Domain.DiscoverySearch();
                        objDiscoverySearch.FromId = item["screen_name"].ToString();
                        objDiscoverySearch.FromName = item["screen_name"].ToString();
                        objDiscoverySearch.SearchKeyword = keyword;
                        lstDiscoverySearch.Add(objDiscoverySearch);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }

                }


                return new JavaScriptSerializer().Serialize(lstDiscoverySearch);

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return new JavaScriptSerializer().Serialize("Please try Again");
            }
        }
Пример #12
0
        public void ProcessRequest()
        {
            //experimental code selected index changed of dropdown
            if (!string.IsNullOrEmpty(Request.QueryString["groupsselection"]))
            {
                SocioBoard.Domain.User user = (SocioBoard.Domain.User)Session["LoggedUser"];

                string selectedValue = Request.QueryString["groupsselection"];

                TeamRepository objTeamRepository = new TeamRepository();
                Team lstDetails = objTeamRepository.getAllGroupsDetails(user.EmailId.ToString(), Guid.Parse(selectedValue),user.Id);

                Session["GroupName"] = lstDetails;
                Session["groupcheck"] = selectedValue;

                SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)Session["GroupName"];

                Response.Write(selectedValue);

                return;
            }

            SocialProfilesRepository socio = new SocialProfilesRepository();
            List<SocialProfile> alstsocioprofiles = new List<SocialProfile>();
            TeamRepository objTeamRepo = new TeamRepository();

            if (!string.IsNullOrEmpty(Request.QueryString["op"]))
            {

                SocioBoard.Domain.User user = (SocioBoard.Domain.User)Session["LoggedUser"];
                Team team = (SocioBoard.Domain.Team)Session["GroupName"];

                TeamRepository objTeamRepository = new TeamRepository();
                TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository();
                GroupRepository objGroupRepository = new GroupRepository();

                if (Request.QueryString["op"] == "social_connectivity")
                {
                    List<TeamMemberProfile> allprofiles = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(team.Id);

                    string profiles = string.Empty;
                    profiles += "<ul class=\"rsidebar-profile\">";
                    foreach (TeamMemberProfile item in allprofiles)
                    {
                        try
                        {
                            if (item.ProfileType == "facebook")
                            {
                                try
                                {
                                    FacebookAccountRepository facerepo = new FacebookAccountRepository();
                                    FacebookAccount faceaccount = facerepo.getFacebookAccountDetailsById(item.ProfileId);

                                    if (faceaccount != null)
                                    {
                                        profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onclick=\"confirmDel('" + item.ProfileId + "','" + faceaccount.Type + "','fb');\"></div><a href=\"http://www.facebook.com/" + faceaccount.FbUserId + "\" target=\"_blank\"><img src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\" height=\"48\" width=\"48\" alt=\"\" title=\""+ faceaccount.FbUserName + "\" /></a>" +
                                                    "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/fb_icon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error(ex.Message);
                                }

                            }
                            else if (item.ProfileType == "youtube")
                            {
                                try
                                {
                                    YoutubeAccountRepository facerepo = new YoutubeAccountRepository();
                                    YoutubeAccount youtube = facerepo.getYoutubeAccountDetailsById(item.ProfileId);

                                    if (youtube != null)
                                    {
                                        profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onclick=\"confirmDel('" + item.ProfileId + "','youtube','youtube');\"></div><a href=\"https://plus.google.com/" + youtube.Ytuserid + "\" target=\"_blank\"><img src=\"" + youtube.Ytprofileimage + " height=\"48\" width=\"48\" alt=\"\" title=\"" + youtube.Ytusername + "\" /></a>" +
                                                    "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/youtube.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error(ex.Message);
                                }

                            }
                            else if (item.ProfileType == "tumblr")
                            {
                                try
                                {

                                    TumblrAccountRepository tumbrepo = new TumblrAccountRepository();
                                    TumblrAccount tumblraccount = tumbrepo.getTumblrAccountDetailsById(item.ProfileId);

                                    if (tumblraccount != null)
                                    {
                                        //if (tumblraccount!=null)
                                        //{
                                        //    profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','tumblr','tumblr')\"></div><a href=\"http://twitter.com/" + tumblraccount.tblrUserName + "\" target=\"_blank\"><img src=\"http://api.tumblr.com/v2/blog/" + tumblraccount.tblrUserName + ".tumblr.com/avatar\" height=\"48\" width=\"48\" alt=\"\" title=\"" + tumblraccount.tblrUserName + "\" /></a>" +
                                        //                "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/tumblr.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";
                                        //}
                                        //else
                                        //{
                                        profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','tumblr','tumblr')\"></div><a href=\"http://" + tumblraccount.tblrUserName + ".tumblr.com\"  target=\"_blank\"><img src=\"http://api.tumblr.com/v2/blog/" + tumblraccount.tblrUserName + ".tumblr.com/avatar\" height=\"48\" width=\"48\" alt=\"\" title=\"" + tumblraccount.tblrUserName + "\" /></a>" +
                                                        "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/tumblr.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";
                                       // }

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

                            }

                            else if (item.ProfileType == "twitter")
                            {
                                try
                                {
                                    TwitterAccountRepository twtrepo = new TwitterAccountRepository();
                                    SocioBoard.Domain.TwitterAccount twtaccount = twtrepo.getUserInformation(item.ProfileId);
                                    if (twtaccount != null)
                                    {
                                        profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','twt','twt')\"></div><a href=\"http://twitter.com/" + twtaccount.TwitterScreenName + "\" target=\"_blank\"><img src=\"" + twtaccount.ProfileImageUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + twtaccount.TwitterScreenName + "\" /></a>" +
                                                    "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/twticon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";
                                    }

                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error(ex.Message);
                                }
                            }
                            else if (item.ProfileType == "linkedin")
                            {
                                try
                                {

                                    LinkedInAccountRepository liRepo = new LinkedInAccountRepository();
                                    string access = string.Empty, tokenSecrate = string.Empty, LdprofileName = string.Empty, LdPreofilePic = string.Empty;
                                    LinkedInAccount liaccount = liRepo.getUserInformation(item.ProfileId);

                                    if (liaccount != null)
                                    {
                                        if (!string.IsNullOrEmpty(liaccount.ProfileImageUrl))
                                        {
                                            LdPreofilePic = liaccount.ProfileImageUrl;
                                        }
                                        else
                                        {
                                            LdPreofilePic = "../../Contents/img/blank_img.png";
                                        }

                                        profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','linkedin')\"></div><a href=\"" + liaccount.ProfileUrl + "\" target=\"_blank\"><img src=\"" + LdPreofilePic + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + liaccount.LinkedinUserName + "\" /></a>" +
                                                   "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/link_icon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error(ex.Message);
                                }

                            }

                            else if (item.ProfileType == "instagram")
                            {
                                try
                                {
                                    InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository();
                                    InstagramAccount objInsAcc = objInsAccRepo.getInstagramAccountDetailsById(item.ProfileId);
                                    string accessToken = string.Empty;
                                    if (objInsAcc != null)
                                    {
                                        profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','instagram')\"></div><a href=\"http://instagram.com/" + objInsAcc.InsUserName + "\" target=\"_blank\"><img src=\"" + objInsAcc.ProfileUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + objInsAcc.InsUserName + "\" /></a>" +
                                                    "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/instagram_24X24.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error(ex.Message);
                                }
                            }
                            else if (item.ProfileType == "googleplus")
                            {
                                try
                                {

                                    //GooglePlusAccountRepository objgpAccRepo = new GooglePlusAccountRepository();
                                    //GooglePlusAccount objgpAcc = objgpAccRepo.getGooglePlusAccountDetailsById(item.ProfileId, user.Id);
                                    //string accessToken = string.Empty;

                                    //profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','googleplus')\"></div><a href=\"http://plus.google.com/" + item.ProfileId + "\" target=\"_blank\"><img src=\"" + objgpAcc.GpProfileImage + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + objgpAcc.GpUserName + "\" /></a>" +
                                    //            "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/google_plus.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";

                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error(ex.Message);
                                }
                            }
                            else if (item.ProfileType == "googleanalytics")
                            {
                                try
                                {

                                    //GoogleAnalyticsAccountRepository objgaAccRepo = new GoogleAnalyticsAccountRepository();
                                    //GoogleAnalyticsAccount objgaAcc = objgaAccRepo.getGoogelAnalyticsAccountHomeDetailsById(user.Id,item.ProfileId);
                                    //string accessToken = string.Empty;

                                    //profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','googleanalytics')\"></div><a href=\"http://plus.google.com/" + item.ProfileId + "\" target=\"_blank\"><img src=\"../Contents/img/google_analytics.png\" height=\"48\" width=\"48\" alt=\"\" title=\"" + objgaAcc.GaAccountName + "\" /></a>" +
                                    //            "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";

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

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

                        }
                    } profiles += "</ul>";
                    Response.Write(profiles);
                }
                else if (Request.QueryString["op"] == "woodrafts")
                {
                    string message = string.Empty;
                    try
                    {
                        DraftsRepository draftsRepository = new DraftsRepository();
                        List<Drafts> lstDrafts = draftsRepository.getAllDrafts(team.GroupId);
                        string profurl = string.Empty;
                        if (string.IsNullOrEmpty(user.ProfileUrl))
                        {
                            profurl = "../Contents/img/blank_img.png";
                        }
                        else
                        {
                            profurl = user.ProfileUrl;
                        }
                        if (lstDrafts.Count != 0)
                        {
                            foreach (Drafts item in lstDrafts)
                            {
                                try
                                {
                                    message += "<section class=\"section\" style=\"width:648px;\">" +
                                                                       "<div class=\"js-task-cont read\"><section class=\"task-owner\">" +
                                                            "<img width=\"32\" height=\"32\" border=\"0\" class=\"avatar\" src=\"../Contents/img/task_pin.png\">" +
                                                        //  "<img width=\"32\" height=\"32\" border=\"0\" class=\"avatar\" src=\"" + profurl + "\" />" +
                                                            "</section><section class=\"task-activity third\" style=\"width: 19.6%;\"><p>" + user.UserName + "</p><div>" + item.CreatedDate + " </div><p>" +
                                        //"</p></section><section style=\"margin-right: 6px; height: auto; width: 35%;\" class=\"task-message font-13 third\"><a onclick=\"writemessage(this.innerHTML);\" class=\"tip_left\">" + item.Message + "</a></section>" +
                                                             "</p></section><section style=\"margin-right: 6px; height: auto; width: 31%;\" class=\"task-message font-13 third\"><span class=\"tip_left\">" + gethtmlfromstring(item.Message) + "</span></section>" +
                                                                "<div class=\"userpictiny\" style=\"height:70px; margin-top: 0;\"><img alt=\"\" src=\"" + profurl + "\" />" +
                                                             "</div>" +
                                                             "<a class=\"small_remove icon publish_delete\" href=\"#\" style=\"top: 7px; float: right; margin-top: 13px; margin-right: 10px;\" title=\"Delete\" onclick=\"deleteDraftMessage('" + item.Id + "')\"></a>" +
                                                            "<section style=\"margin-top: 18px; width: 45px; margin-right: 17px;\" class=\"task-status\"><div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\" href=\"#nogo\">" +
                                                                "<span onclick=\"editDraftsMessage('" + item.Id + "','" + item.Message + "');\" class=\"ui-sproutmenu-status\">" +
                                                            "<img class=\"edit_button\" src=\"../Contents/img/icon_edit.png\" alt=\"\" />" +
                                                            "</span>" +
                                                            "</a></div></section></div></section>";
                                }
                                catch (Exception ex)
                                {

                                    logger.Error(ex.Message);
                                }
                            }
                        }
                        else
                        {
                            message += "<div style=\"margin-left: 2%; margin-top: 3%;\">No Messages in Drafts</div>";
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }
                    Response.Write(message);
                }
                else if (Request.QueryString["op"] == "savedrafts")
                {
                    try
                    {
                        string message = Request.QueryString["message"];
                        message = Request.Form["messagee"];
                        Drafts d = new Drafts();
                        d.CreatedDate = DateTime.Now;
                        d.Message = message;
                        d.ModifiedDate = DateTime.Now;
                        d.UserId = user.Id;
                        d.GroupId = team.GroupId;
                        d.Id = Guid.NewGuid();
                        DraftsRepository dRepo = new DraftsRepository();
                        if (!dRepo.IsDraftsMessageExist(user.Id, message))
                        {
                            dRepo.AddDrafts(d);
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }
                    Response.Write("added successfully");
                }

                else if (Request.QueryString["op"] == "midsnaps")
                {
                    try
                    {
                        Random rNum = new Random();
                        string loadtype = Request.QueryString["loadtype"];
                        string midsnaps = string.Empty;
                        if (loadtype == "load")
                            profilelimit = 0;

                        if (profilelimit != -1)
                        {
                           // Team lstDetails = objTeamRepository.getAllDetails(team.GroupId, team.EmailId);

                            List<TeamMemberProfile> alst = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(team.Id);

                          //  ArrayList alst = socio.getLimitProfilesOfUser(user.Id, profilelimit);
                            if (alst.Count == 0)
                                profilelimit = -1;
                            else if (profilelimit == 0)
                                //profilelimit += 2;
                                profilelimit += 6;
                            else
                                profilelimit += 6;
                            midsnaps += "<div class=\"row-fluid\" >";
                            if (loadtype == "load")
                            {
                                AdsRepository objAdsRepo = new AdsRepository();
                                ArrayList lstads = objAdsRepo.getAdsForHome();
                                int i = 0;
                                if (lstads.Count <= 1)
                                {
                                    if (user.PaymentStatus.ToUpper() == "PAID")
                                    {
                                        midsnaps += "";
                                    }
                                }
                                else
                                {
                                    foreach (var item in lstads)
                                    {
                                        Array temp = (Array)item;
                                        i++;
                                        if (temp != null)
                                        {
                                            if (i == 2)
                                            {
                                                if (user.AccountType == "Paid")
                                                {
                                                    midsnaps += "<div class=\"span4 rounder recpro\"><button data-dismiss=\"alert\" class=\"close pull-right\" type=\"button\">×</button>" +
                                              "<a href=\"#\"><img src=\"" + temp.GetValue(2).ToString() + "\"  alt=\"\" style=\"width:246px;height:331px\"></a></div>";
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            foreach (TeamMemberProfile item in alst)
                            {
                                if (item.ProfileType == "facebook")
                                {
                                    try
                                    {
                                        FacebookAccountRepository fbrepo = new FacebookAccountRepository();
                                        FacebookFeedRepository facefeedrepo = new FacebookFeedRepository();
                                        List<FacebookFeed> fbmsgs = facefeedrepo.getAllFacebookUserFeeds(item.ProfileId);
                                        FacebookAccount fbaccount = fbrepo.getFacebookAccountDetailsById(item.ProfileId);
                                        midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:213px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" +
                                                   "<div onclick=\"detailsdiscoveryfacebook('" + fbaccount.FbUserId + "');\"  class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + fbaccount.FbUserName + "\" alt=\"\" src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\"\">" +
                                                   "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/fb_icon.png\" width=\"16\" height=\"16\"></a></div>" +
                                                   "<div onclick=\"detailsdiscoveryfacebook('" + fbaccount.FbUserId + "');\" class=\"useraccname\">" + getsortpofilename(fbaccount.FbUserName) + "</div><div class=\"usercounter\">" +
                                                   "<div class=\"userfoll\">" + fbaccount.Friends;
                                        if (fbaccount.Type == "page")
                                        {
                                            midsnaps += "<span><b style=\"font-size: 13px;\">Fans</b></span>";
                                        }
                                        else
                                        {
                                            midsnaps += "<span><b style=\"font-size: 13px;\">Friends</b></span>";
                                        }
                                        midsnaps += "</div>" +
                                                   "<div class=\"userppd\">" + Math.Round(rNum.NextDouble(), 2) + "<span>Avg. Post <br> Per Day</span></div></div><h5>Recent message</h5></div>" +
                                                   "<div class=\"concoteng\"> <ul class=\"mess\">";
                                        if (fbmsgs.Count != 0)
                                        {
                                            int msgcount = 0;
                                            foreach (FacebookFeed child in fbmsgs)
                                            {
                                                string mess = string.Empty;
                                                if (msgcount < 2)
                                                {
                                                    if (child.FeedDescription.Length > 40)
                                                    {
                                                        mess = child.FeedDescription.Substring(0, 39);
                                                        mess = mess + "...........";
                                                    }
                                                    else
                                                    {
                                                        mess = child.FeedDescription;
                                                    }
                                                    midsnaps += "<li><div class=\"messpic\"><img title=\"\" alt=\"\" src=\"http://graph.facebook.com/" + child.FromId + "/picture?type=small\"></div>" +
                                                              "<div class=\"messtext\">" + mess + "</div></li>";
                                                }
                                                else
                                                {
                                                    break;
                                                }
                                                msgcount++;
                                            }
                                        }
                                        else
                                        {
                                            midsnaps += "<strong>No messages were found within the past few days.</strong> \"Messages will be displayed once there is activity in this date range.\"";
                                        }

                                        midsnaps += "</ul></div></div>";
                                    }
                                    catch (Exception ex)
                                    {
                                        logger.Error(ex.Message);
                                    }
                                }

                                else if (item.ProfileType == "googleplus")
                                {

                                }
                                else if (item.ProfileType == "twitter")
                                {
                                    TwitterAccountRepository twtrepo = new TwitterAccountRepository();
                                    SocioBoard.Domain.TwitterAccount twtaccount = twtrepo.getUserInformation(item.ProfileId);
                                    TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository();
                                    List<TwitterMessage> lsttwtmsgs = twtmsgrepo.getAllTwitterMessagesOfProfile(item.ProfileId);
                                    int tweetcount = 0;

                                    midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:213px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" +
                                     "<div onclick=\"detailsdiscoverytwitter('" + item.ProfileId + "');\" class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + twtaccount.TwitterScreenName + "\" alt=\"\" src=\"" + twtaccount.ProfileImageUrl + "\">" +
                                     "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/twticon.png\" width=\"16\" height=\"16\"></a></div>" +
                                     "<div onclick=\"detailsdiscoverytwitter('" + twtaccount.TwitterUserId + "');\" class=\"useraccname\">" + getsortpofilename(twtaccount.TwitterScreenName) + "</div><div class=\"usercounter\">" +
                                     "<div class=\"userfoll\">" + twtaccount.FollowersCount + "<span><b style=\"font-size: 13px;\">Followers</b></span></div>" +
                                     "<div class=\"userppd\">" + Math.Round(rNum.NextDouble(), 2) + "<span>Avg. tweet <br> Per Day</span></div></div><h5>Recent message</h5></div>" +
                                     "<div class=\"concoteng\"> <ul class=\"mess\">";
                                    try
                                    {
                                        if (lsttwtmsgs.Count == 0)
                                        {
                                            midsnaps += "<strong>No messages were found within the past few days.</strong> \"Messages will be displayed once there is activity in this date range.\"";
                                        }
                                        else
                                        {
                                            foreach (TwitterMessage msg in lsttwtmsgs)
                                            {
                                                if (tweetcount < 2)
                                                {
                                                    try
                                                    {
                                                        string ms = string.Empty;
                                                        if (msg.TwitterMsg.Length > 20)
                                                        {
                                                            ms = msg.TwitterMsg.Substring(0, 20) + "...";

                                                        }
                                                        else
                                                        {
                                                            ms = msg.TwitterMsg;
                                                        }
                                                        midsnaps += "<li><div class=\"messpic\"><img title=\"\" alt=\"\" src=\"" + msg.FromProfileUrl + "\"></div>" +
                                                        "<div class=\"messtext\">" + ms + "</div></li>";
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Console.WriteLine(ex.Message);

                                                    }
                                                }
                                                else
                                                {
                                                    break;
                                                }
                                                tweetcount++;
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {

                                        Console.WriteLine(ex.Message);
                                        logger.Error(ex.Message);
                                    }
                                    midsnaps += "</ul></div></div>";
                                }

                                else if (item.ProfileType == "tumblr")
                                {
                                    try
                                    {
                                        string PostCount = string.Empty;
                                        string LikesCount = string.Empty;

                                        TumblrAccountRepository tumblrrepo = new TumblrAccountRepository();
                                        SocioBoard.Domain.TumblrAccount tumblrccount = tumblrrepo.getTumblrAccountDetailsById(item.ProfileId);
                                        TumblrFeedRepository tumblrfeedrepo = new TumblrFeedRepository();
                                        List<TumblrFeed> lsttumblrmsgs = tumblrfeedrepo.getFeedOfProfile(item.ProfileId);
                                        BlogInfo objBlogInfo = new BlogInfo();
                                        string objData = objBlogInfo.getTumblrUserInfo(tumblrccount.tblrUserName);
                                        //string objFollower = objBlogInfo.getTumblrUserfollower(tumblrccount.tblrUserName);
                                        string[] words = objData.Split('&');

                                        PostCount = words[1].ToString();
                                        LikesCount = words[0].ToString();

                                        midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:213px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" +
                                                    "<a href=\"http://"+ item.ProfileId + ".tumblr.com\" target=\"_blank\"><div class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + tumblrccount.tblrUserName + "\" alt=\"\" src=\"http://api.tumblr.com/v2/blog/" + tumblrccount.tblrUserName + ".tumblr.com/avatar\"></a>" +
                                                    "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/tumblr.png\" width=\"16\" height=\"16\"></a></div>" +
                                                    "<a  href=\"http://" + item.ProfileId + ".tumblr.com\" target=\"_blank\"><div class=\"useraccname\">" + getsortpofilename(tumblrccount.tblrUserName) + "</div></a></div>" +
                                                    "<div class=\"concoteng\"><div class=\"pillow_fade\">" +
                                                    " <div class=\"fb_notifications\">" +
                                                    "<ul class=\"user-stats\"> " +
                                                         "<li><div class=\"photo_stat\">  post</div>  <div class=\"number-stat\">" + PostCount + "</div></li>" +
                                                         "<li><div class=\"photo_stat\">likes</div><div class=\"number-stat\">" + LikesCount + "</div></li>" +
                                                     "</ul></div></div></div></div>";

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

                                else if (item.ProfileType == "youtube")
                                {
                                    try
                                    {

                                        YoutubeAccountRepository ytrepo = new YoutubeAccountRepository();
                                        YoutubeChannelRepository objYoutubeChannelRepository=new YoutubeChannelRepository();
                                        SocioBoard.Domain.YoutubeAccount ytacount = ytrepo.getYoutubeAccountDetailsById(item.ProfileId);
                                        YoutubeChannel objYoutubeChannel = objYoutubeChannelRepository.getYoutubeChannelDetailsById(item.ProfileId);

                                        if (string.IsNullOrEmpty(ytacount.Ytprofileimage))
                                        {
                                            ytacount.Ytprofileimage = "../../Contents/img/blank_img.png";
                                        }

                                        midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:213px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" +
                                               "<a href=\"#\" target=\"_blank\"><div class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + ytacount.Ytuserid + "\" alt=\"\" src=\"" + ytacount.Ytprofileimage + "\"></a>" +
                                                  "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/youtube.png\" width=\"16\" height=\"16\"></a></div>" +
                                                  "<a href=\"#\" target=\"_blank\"><div class=\"useraccname\">" + getsortpofilename(ytacount.Ytusername) + "</div></a></div>" +
                                                  "<div class=\"concoteng\"><div class=\"pillow_fade\">" +
                                                  " <div class=\"fb_notifications\">" +
                                                  "<ul class=\"user-stats\"> " +
                                                       "<li><div class=\"photo_stat\">Total View</div>  <div class=\"number-stat\">" + objYoutubeChannel.ViewCount + "</div></li>" +
                                                       "<li><div class=\"photo_stat\">Total Subcriber</div><div class=\"number-stat\">" + objYoutubeChannel.SubscriberCount + "</div></li>" +
                                                       "<li><div class=\"photo_stat\">Total Video</div><div class=\"number-stat\">" + objYoutubeChannel.VideoCount + "</div></li>" +
                                                   "</ul></div></div></div></div>";

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

                                else if (item.ProfileType == "linkedin")
                                {
                                    try
                                    {
                                        string access = string.Empty, tokenSecrate = string.Empty, LdprofileName = string.Empty, LdPreofilePic = string.Empty;
                                        LinkedInAccountRepository objLiRepo = new LinkedInAccountRepository();
                                        LinkedInFeedRepository objliFeedRepo = new LinkedInFeedRepository();
                                        LinkedInAccount liAccount = objLiRepo.getUserInformation(item.ProfileId);
                                        LinkedInFeedRepository lifeedrepo = new LinkedInFeedRepository();
                                        List<LinkedInFeed> alstliaccount = lifeedrepo.getAllLinkedInFeedsOfProfile(item.ProfileId);
                                        if (liAccount != null)
                                        {
                                            LdprofileName = liAccount.LinkedinUserName;
                                            LdPreofilePic = liAccount.ProfileImageUrl;
                                        }

                                        if (string.IsNullOrEmpty(LdPreofilePic))
                                        {
                                            LdPreofilePic = "../../Contents/img/blank_img.png";
                                        }
                                        int linkedinConcount = 0;
                                        try
                                        {
                                            linkedinConcount = liAccount.Connections;
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.Message);
                                        }

                                        midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:213px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" +
                                           "<div class=\"userpictiny\"><a target=\"_blank\" href=\"" + liAccount.ProfileUrl + "\"><img width=\"56\" height=\"56\" title=\"" + LdprofileName + "\" alt=\"\" src=\"" + LdPreofilePic + "\"></a>" +
                                           "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/link_icon.png\" width=\"16\" height=\"16\"></a></div>" +
                                           "<div class=\"useraccname\">" + getsortpofilename(LdprofileName) + "</div><div class=\"usercounter\">" +
                                           "<div class=\"userfoll\">" + linkedinConcount + "<span>Connections</span></div>" +
                                           "<div class=\"userppd\">" + Math.Round(rNum.NextDouble(), 2) + "<span>Avg. Post <br> Per Day</span></div></div><h5>Recent message</h5></div>" +
                                           "<div class=\"concoteng\"> <ul class=\"mess\">";
                                        int link = 0;
                                        if (alstliaccount.Count == 0)
                                        {
                                            midsnaps += "<strong>No messages were found within the past 14 days.</strong> \"Messages will be displayed once there is activity in this date range.\"";
                                        }
                                        else
                                        {

                                            try
                                            {

                                                foreach (LinkedInFeed liFeed in alstliaccount)
                                                {
                                                    try
                                                    {
                                                        if (link < 2)
                                                        {
                                                            string ms = string.Empty;
                                                            if (liFeed.Feeds.Length > 20)
                                                            {
                                                                ms = liFeed.Feeds.Substring(0, 20) + "...";

                                                            }
                                                            else
                                                            {
                                                                ms = liFeed.Feeds;
                                                            }
                                                            midsnaps += "<li><div class=\"messpic\"><img title=\"\" alt=\"\" src=\"" + liFeed.FromPicUrl + "\"></div>" +
                                                           "<div class=\"messtext\">" + ms + "</div></li>";
                                                            link++;
                                                        }
                                                        else
                                                        {
                                                            break;
                                                        }
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        logger.Error(ex.Message);
                                                    }
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                logger.Error(ex.Message);
                                            }

                                        }
                                        midsnaps += "</ul></div></div>";
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex.Message);
                                        logger.Error(ex.Message);
                                    }
                                }
                                else if (item.ProfileType == "instagram")
                                {
                                    try
                                    {
                                        InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository();
                                        InstagramAccount objInsAcc = objInsAccRepo.getInstagramAccountDetailsById(item.ProfileId);

                                        midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:213px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" +
                                               "<a href=\"http://instagram.com/" + objInsAcc.InsUserName + "\" target=\"_blank\"><div class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + objInsAcc.InsUserName + "\" alt=\"\" src=\"" + objInsAcc.ProfileUrl + "\"></a>" +
                                               "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/instagram_24X24.png\" width=\"16\" height=\"16\"></a></div>" +
                                               "<a href=\"http://instagram.com/" + objInsAcc.InsUserName + "\" target=\"_blank\"><div class=\"useraccname\">" + getsortpofilename(objInsAcc.InsUserName) + "</div></a></div>" +
                                               "<div class=\"concoteng\"><div class=\"pillow_fade\">" +
                                               " <div class=\"fb_notifications\">" +
                                               "<ul class=\"user-stats\"> " +
                                                    "<li><div class=\"photo_stat\">  photos</div>  <div class=\"number-stat\">" + objInsAcc.TotalImages + "</div></li>" +
                                                    "<li><div class=\"photo_stat\">following</div><div class=\"number-stat\">" + objInsAcc.Followers + "</div></li>" +
                                                    "<li><div class=\"photo_stat\">followers</div><div class=\"number-stat\">" + objInsAcc.FollowedBy + "</div></li>" +
                                                "</ul></div></div></div></div>";
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex.Message);
                                        logger.Error(ex.Message);
                                    }
                                }
                                else if (item.ProfileType == "googleanalytics")
                                {
                                }
                            }
                            midsnaps += "</div>";
                            Response.Write(midsnaps);
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }
                }

                else if (Request.QueryString["op"] == "accountdelete")
                {
                    Groups lstDetails = objGroupRepository.getGroupName(team.GroupId);
                    if (lstDetails.GroupName == "Socioboard")
                    {

                        Session["facebooktotalprofiles"] = null;
                        SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository();
                        string Profiletype = Request.QueryString["profile"];
                        string profileid = Request.QueryString["profileid"];

                        if (Profiletype == "fb")
                        {
                            try
                            {
                                FacebookAccountRepository fbrepo = new FacebookAccountRepository();
                                int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid);

                                int delacc = fbrepo.deleteFacebookUser(profileid, user.Id);
                                if (delacc > 0)
                                {

                                    socioprofilerepo.deleteProfile(user.Id, profileid);
                                    List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid);
                                    if (lstsocioprofile.Count >= 0)
                                    {
                                        try
                                        {
                                            FacebookMessageRepository fbmsgrepo = new FacebookMessageRepository();
                                            fbmsgrepo.deleteAllMessagesOfUser(profileid, user.Id);
                                            FacebookFeedRepository fbfeedrepo = new FacebookFeedRepository();
                                            fbfeedrepo.deleteAllFeedsOfUser(profileid, user.Id);
                                            FacebookStatsRepository fbstatsrepo = new FacebookStatsRepository();
                                            fbstatsrepo.deleteFacebookStats(profileid, user.Id);

                                            ScheduledMessageRepository schedulemsgrepo = new ScheduledMessageRepository();
                                            schedulemsgrepo.deleteMessage(user.Id, profileid);
                                            ArchiveMessageRepository archmsgrepo = new ArchiveMessageRepository();
                                            int del = archmsgrepo.DeleteArchiveMessage(user.Id, profileid);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.StackTrace);
                                        }

                                    }
                                }

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

                        else if (Profiletype == "tumblr")
                        {
                            try
                            {
                                TumblrAccountRepository tumblraccountrepo = new TumblrAccountRepository();
                                TumblrFeedRepository objTumblrFeedRepository = new TumblrFeedRepository();
                                int deltwtacc = tumblraccountrepo.deleteTumblrUser(profileid, user.Id);
                                int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid);
                                if (deltwtacc > 0)
                                {
                                    try
                                    {
                                        socioprofilerepo.deleteProfile(user.Id, profileid);
                                        objTumblrFeedRepository.DeleteTumblrDataByUserid(user.Id, profileid);
                                        ScheduledMessageRepository schedulemsgrepo = new ScheduledMessageRepository();
                                        schedulemsgrepo.deleteMessage(user.Id, profileid);
                                        ArchiveMessageRepository archmsgrepo = new ArchiveMessageRepository();
                                        int del = archmsgrepo.DeleteArchiveMessage(user.Id, profileid);
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex.StackTrace);
                                    }

                                }
                            }
                            catch (Exception ex)
                            {
                                logger.Error(ex.Message);
                                Console.WriteLine(ex.Message);
                            }
                        }
                        else if (Profiletype == "youtube")
                        {
                            try
                            {
                                YoutubeAccountRepository youtubeaccountrepo = new YoutubeAccountRepository();
                                YoutubeChannelRepository objYoutubeChannelRepository = new YoutubeChannelRepository();
                                int deltwtacc = youtubeaccountrepo.deleteYoutubeUser(user.Id,profileid);
                                int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid);
                                if (deltwtacc > 0)
                                {
                                    socioprofilerepo.deleteProfile(user.Id, profileid);
                                    objYoutubeChannelRepository.DeleteProfileDataByUserid(profileid);

                                }
                            }
                            catch (Exception ex)
                            {
                                logger.Error(ex.Message);
                                Console.WriteLine(ex.Message);
                            }
                        }
                        else if (Profiletype == "twt")
                        {
                            try
                            {
                                TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository();
                                int deltwtacc = twtaccountrepo.deleteTwitterUser(user.Id, profileid);
                                int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid);
                                if (deltwtacc > 0)
                                {
                                    socioprofilerepo.deleteProfile(user.Id, profileid);
                                    List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid);
                                    if (lstsocioprofile.Count >= 0)
                                    {
                                        try
                                        {
                                            TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository();
                                            int d = twtmsgrepo.deleteTwitterMessage(profileid, user.Id);
                                            TwitterFeedRepository twtfeedrepo = new TwitterFeedRepository();
                                            int s = twtfeedrepo.deleteTwitterFeed(profileid, user.Id);
                                            TwitterStatsRepository twtstatsrepo = new TwitterStatsRepository();
                                            int a = twtstatsrepo.deleteTwitterStats(user.Id, profileid);
                                            TwitterDirectMessageRepository twtdirectmsgrepo = new TwitterDirectMessageRepository();
                                            int f = twtdirectmsgrepo.deleteDirectMessage(user.Id, profileid);

                                            ScheduledMessageRepository schedulemsgrepo = new ScheduledMessageRepository();
                                            schedulemsgrepo.deleteMessage(user.Id, profileid);
                                            ArchiveMessageRepository archmsgrepo = new ArchiveMessageRepository();
                                            int del = archmsgrepo.DeleteArchiveMessage(user.Id, profileid);

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

                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                logger.Error(ex.Message);
                                Console.WriteLine(ex.Message);
                            }
                        }
                        else if (Profiletype == "linkedin")
                        {
                            try
                            {
                                LinkedInAccountRepository linkedaccrepo = new LinkedInAccountRepository();
                                int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid);
                                int dellinacc = linkedaccrepo.deleteLinkedinUser(profileid, user.Id);
                                if (dellinacc > 0)
                                {

                                    socioprofilerepo.deleteProfile(user.Id, profileid);

                                    List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid);

                                    if (lstsocioprofile.Count >= 0)
                                    {
                                        try
                                        {
                                            LinkedInFeedRepository linkedfeedrepo = new LinkedInFeedRepository();
                                            int s = linkedfeedrepo.deleteAllFeedsOfUser(profileid, user.Id);
                                            ScheduledMessageRepository schedulemsgrepo = new ScheduledMessageRepository();
                                            schedulemsgrepo.deleteMessage(user.Id, profileid);
                                            ArchiveMessageRepository archmsgrepo = new ArchiveMessageRepository();
                                            int del = archmsgrepo.DeleteArchiveMessage(user.Id, profileid);

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

                                    }

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

                        }
                        else if (Profiletype == "instagram")
                        {
                            try
                            {
                                InstagramAccountRepository insaccrepo = new InstagramAccountRepository();
                                int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid);
                                int insacc = insaccrepo.deleteInstagramUser(profileid, user.Id);
                                if (insacc > 0)
                                {

                                    socioprofilerepo.deleteProfile(user.Id, profileid);

                                    List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid);

                                    if (lstsocioprofile.Count >= 0)
                                    {
                                        try
                                        {
                                            ScheduledMessageRepository schedulemsgrepo = new ScheduledMessageRepository();
                                            schedulemsgrepo.deleteMessage(user.Id, profileid);
                                            ArchiveMessageRepository archmsgrepo = new ArchiveMessageRepository();
                                            int del = archmsgrepo.DeleteArchiveMessage(user.Id, profileid);

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

                                    }

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

                            }
                        }
                        else if (Profiletype == "googleplus")
                        {
                            try
                            {
                                GooglePlusAccountRepository googleplusaccrepo = new GooglePlusAccountRepository();
                                int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid);
                                int gplusacc = googleplusaccrepo.deleteGooglePlusUser(profileid, user.Id);
                                if (gplusacc > 0)
                                {

                                    socioprofilerepo.deleteProfile(user.Id, profileid);

                                    List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid);

                                    if (lstsocioprofile.Count >= 0)
                                    {
                                    }

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

                            }
                        }

                        string profiles = string.Empty;
                        profiles += "<div class=\"drop_top\"></div><div class=\"drop_mid\">";

                        /*facebook users binding*/
                        FacebookAccountRepository fbprepo = new FacebookAccountRepository();
                        ArrayList lstfbaccounts = fbprepo.getFacebookAccountsOfUser(user.Id);

                        profiles += "<div class=\"twitte_text\">FACEBOOK</div><div class=\"teitter\"><ul>";

                        if (lstfbaccounts.Count == 0)
                        {
                            profiles += "<li>No Records Found</li>";
                        }
                        else
                        {
                            foreach (FacebookAccount fbacc in lstfbaccounts)
                            {
                                profiles += "<li id=\"liid_" + fbacc.FbUserId + "\"   onclick=\"composemessage(this.id,'fb')\"><a><img id=\"img_" + fbacc.FbUserId + "\" src=\"../Contents/img/facebook.png\" alt=\"" + fbacc.AccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"composename_" + fbacc.FbUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + fbacc.FbUserName + "</span><span id=\"imgurl_" + fbacc.FbUserId + "\" style=\"display:none;\">http://graph.facebook.com/" + fbacc.FbUserId + "/picture?type=small</span></a></li>";
                            }
                        }
                        profiles += "</ul> </div>";

                        /*twitter users binding*/
                        TwitterAccountRepository twtpaccountrepo = new TwitterAccountRepository();
                        ArrayList alsttwtaccounts = twtpaccountrepo.getAllTwitterAccountsOfUser(user.Id);
                        profiles += "<div class=\"twitte_text\">TWITTER</div><div class=\"teitter\"><ul>";

                        if (alsttwtaccounts.Count == 0)
                        {
                            profiles += "<li>No Records Found</li>";
                        }
                        else
                        {
                            foreach (SocioBoard.Domain.TwitterAccount item in alsttwtaccounts)
                            {
                                profiles += "<li id=\"liid_" + item.TwitterUserId + "\"   onclick=\"composemessage(this.id,'twt')\"><a><img id=\"img_" + item.TwitterUserId + "\" src=\"../Contents/img/twitter.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.TwitterUserId + "\" style=\"display:none;\">" + item.ProfileImageUrl + "</span><span id=\"composename_" + item.TwitterUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.TwitterScreenName + "</span></a></li>";
                            }
                        }
                        profiles += "</ul> </div>";

                        /*linkedinuserbinding*/
                        LinkedInAccountRepository linkaccountrepo = new LinkedInAccountRepository();
                        ArrayList alstlinkacc = linkaccountrepo.getAllLinkedinAccountsOfUser(user.Id);
                        profiles += "<div class=\"twitte_text\">LINKEDIN</div><div class=\"teitter\"><ul>";

                        if (alstlinkacc.Count == 0)
                        {
                            profiles += "<li>No Records Found</li>";
                        }
                        else
                        {

                            foreach (LinkedInAccount item in alstlinkacc)
                            {
                                string profileurl = string.Empty;

                                if (!string.IsNullOrEmpty(item.ProfileImageUrl))
                                {
                                    profileurl = item.ProfileImageUrl;
                                }
                                else
                                {
                                    profileurl = "../../Contents/img/blank_img.png";
                                }
                                profiles += "<li id=\"liid_" + item.LinkedinUserId + "\"   onclick=\"composemessage(this.id,'lin')\"><a><img id=\"img_" + item.LinkedinUserId + "\" src=\"../Contents/img/link.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.LinkedinUserId + "\" style=\"display:none;\">" + profileurl + "</span><span id=\"composename_" + item.LinkedinUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.LinkedinUserName + "</span></a></li>";
                            }
                        }
                        profiles += "</ul> </div>";
                        Response.Write(RemainingAccount(user));

                    }
                }

                else if (Request.QueryString["op"] == "MasterCompose")
                {
                    string profiles = string.Empty;
                    string FbprofileId = string.Empty;
                    string TwtprofileId = string.Empty;
                    string TumblrprofileId = string.Empty;
                    string LinkedInprofileId = string.Empty;

                        profiles += "<div class=\"drop_top\"></div><div class=\"drop_mid\">";
                        try
                        {
                            List<TeamMemberProfile> allprofiles = objTeamMemberProfileRepository.getTeamMemberProfileData(team.Id);
                            foreach (TeamMemberProfile item in allprofiles)
                            {
                                FbprofileId += item.ProfileId + ',';

                            }
                            FbprofileId = FbprofileId.Substring(0, FbprofileId.Length - 1);

                            /*facebook users binding*/
                            FacebookAccountRepository fbrepo = new FacebookAccountRepository();
                            List<FacebookAccount> lstfbaccounts = fbrepo.getAllAccountDetail(FbprofileId);

                            profiles += "<div class=\"twitte_text\">FACEBOOK</div><div class=\"teitter\"><ul>";

                            if (lstfbaccounts.Count == 0)
                            {
                                profiles += "<li>No Records Found</li>";
                            }
                            else
                            {
                                foreach (FacebookAccount fbacc in lstfbaccounts)
                                {
                                    profiles += "<li nwtk='fb' class=\"getAllNetworkProfile\" id=\"liid_" + fbacc.FbUserId + "\"   onclick=\"composemessage(this.id,'fb')\"><a><img id=\"img_" + fbacc.FbUserId + "\" src=\"../Contents/img/facebook.png\" alt=\"" + fbacc.AccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"composename_" + fbacc.FbUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + fbacc.FbUserName + "</span><span id=\"imgurl_" + fbacc.FbUserId + "\" style=\"display:none;\">http://graph.facebook.com/" + fbacc.FbUserId + "/picture?type=small</span></a></li>";
                                }
                            }
                            profiles += "</ul> </div>";

                        }
                        catch (Exception ex)
                        {

                            logger.Error(ex.Message);

                        }

                        /*tumbler users binding*/

                        try
                        {
                            List<TeamMemberProfile> allTumblrprofiles = objTeamMemberProfileRepository.getTumblrTeamMemberProfileData(team.Id);
                            foreach (TeamMemberProfile item in allTumblrprofiles)
                            {
                                TumblrprofileId += item.ProfileId + ',';

                            }
                            TumblrprofileId = TumblrprofileId.Substring(0, TumblrprofileId.Length - 1);

                            TumblrAccountRepository tumblrtaccountrepo = new TumblrAccountRepository();
                            List<TumblrAccount> alsttumblrtaccounts = tumblrtaccountrepo.getAllAccountDetail(TumblrprofileId);
                            profiles += "<div class=\"twitte_text\">TUMBLR</div><div class=\"teitter\"><ul>";

                            if (alsttumblrtaccounts.Count == 0)
                            {
                                profiles += "<li>No Records Found</li>";
                            }
                            else
                            {
                                foreach (TumblrAccount item in alsttumblrtaccounts)
                                {
                                    profiles += "<li nwtk='tumb' class=\"getAllNetworkProfile\" id=\"liid_" + item.tblrUserName + "\"   onclick=\"composemessage(this.id,'tumb')\"><a><img id=\"img_" + item.tblrUserName + "\" src=\"../Contents/img/tumblr.png\" alt=\"" + item.tblrAccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.tblrUserName + "\" style=\"display:none;\">http://api.tumblr.com/v2/blog/" + item.tblrProfilePicUrl + ".tumblr.com/avatar</span><span id=\"composename_" + item.tblrUserName + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.tblrUserName + "</span></a></li>";
                                }
                            }
                            profiles += "</ul> </div>";

                        }
                        catch (Exception ex)
                        {

                            logger.Error(ex.Message);

                        }

                        /*twitter users binding*/
                        try
                        {
                            List<TeamMemberProfile> allTwtprofiles = objTeamMemberProfileRepository.getTwtTeamMemberProfileData(team.Id);
                            foreach (TeamMemberProfile item in allTwtprofiles)
                            {
                                TwtprofileId += item.ProfileId + ',';

                            }
                            TwtprofileId = TwtprofileId.Substring(0, TwtprofileId.Length - 1);

                            TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository();
                            List<TwitterAccount> alsttwtaccounts = twtaccountrepo.getAllAccountDetail(TwtprofileId);
                            profiles += "<div class=\"twitte_text\">TWITTER</div><div class=\"teitter\"><ul>";

                            if (alsttwtaccounts.Count == 0)
                            {
                                profiles += "<li>No Records Found</li>";
                            }
                            else
                            {
                                foreach (TwitterAccount item in alsttwtaccounts)
                                {
                                    profiles += "<li nwtk='twt' class=\"getAllNetworkProfile\" id=\"liid_" + item.TwitterUserId + "\"   onclick=\"composemessage(this.id,'twt')\"><a><img id=\"img_" + item.TwitterUserId + "\" src=\"../Contents/img/twitter.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.TwitterUserId + "\" style=\"display:none;\">" + item.ProfileImageUrl + "</span><span id=\"composename_" + item.TwitterUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.TwitterScreenName + "</span></a></li>";
                                }
                            }
                            profiles += "</ul> </div>";

                        }
                        catch (Exception ex)
                        {

                            logger.Error(ex.Message);

                        }

                        /*linkedinuserbinding*/

                        try
                        {
                            List<TeamMemberProfile> allLinkedInprofiles = objTeamMemberProfileRepository.getLinkedInTeamMemberProfileData(team.Id);
                            foreach (TeamMemberProfile item in allLinkedInprofiles)
                            {
                                LinkedInprofileId += item.ProfileId + ',';

                            }
                            LinkedInprofileId = LinkedInprofileId.Substring(0, LinkedInprofileId.Length - 1);

                            LinkedInAccountRepository linkaccountrepo = new LinkedInAccountRepository();
                            List<LinkedInAccount> alstlinkacc = linkaccountrepo.getAllAccountDetail(LinkedInprofileId);
                            profiles += "<div class=\"twitte_text\">LINKEDIN</div><div class=\"teitter\"><ul>";

                            if (alstlinkacc.Count == 0)
                            {
                                profiles += "<li>No Records Found</li>";
                            }
                            else
                            {

                                foreach (LinkedInAccount item in alstlinkacc)
                                {
                                    string profileurl = string.Empty;

                                    if (!string.IsNullOrEmpty(item.ProfileImageUrl))
                                    {
                                        profileurl = item.ProfileImageUrl;
                                    }
                                    else
                                    {
                                        profileurl = "../../Contents/img/blank_img.png";
                                    }
                                    profiles += "<li nwtk='lin' class=\"getAllNetworkProfile\" id=\"liid_" + item.LinkedinUserId + "\"   onclick=\"composemessage(this.id,'lin')\"><a><img id=\"img_" + item.LinkedinUserId + "\" src=\"../Contents/img/link.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.LinkedinUserId + "\" style=\"display:none;\">" + profileurl + "</span><span id=\"composename_" + item.LinkedinUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.LinkedinUserName + "</span></a></li>";
                                }
                            }
                            profiles += "</ul> </div>";
                        }
                        catch (Exception ex)
                        {

                            logger.Error(ex.Message);

                        }

                    Response.Write(profiles);
                }

              //=============================================================

                else if (Request.QueryString["op"] == "MasterComposesc")
                {
                    string profiles = string.Empty;
                    string FbprofileId = string.Empty;
                    string TwtprofileId = string.Empty;
                    string LinkedInprofileId = string.Empty;
                    string TumblrprofileId = string.Empty;

                    //if (Session["profilesforcomposemessage"] == null)
                    //{
                    profiles += "<div class=\"drop_top\"></div><div class=\"drop_mid\">";
                    try
                    {
                        List<TeamMemberProfile> allprofiles = objTeamMemberProfileRepository.getTeamMemberProfileData(team.Id);
                        foreach (TeamMemberProfile item in allprofiles)
                        {
                            FbprofileId += item.ProfileId + ',';

                        }
                        FbprofileId = FbprofileId.Substring(0, FbprofileId.Length - 1);

                        /*facebook users binding*/
                        FacebookAccountRepository fbrepo = new FacebookAccountRepository();
                        List<FacebookAccount> lstfbaccounts = fbrepo.getAllAccountDetail(FbprofileId);

                        profiles += "<div class=\"twitte_text\">FACEBOOK</div><div class=\"teitter\"><ul>";

                        if (lstfbaccounts.Count == 0)
                        {
                            profiles += "<li>No Records Found</li>";
                        }
                        else
                        {
                            foreach (FacebookAccount fbacc in lstfbaccounts)
                            {
                                profiles += "<li nwtk='fb' class=\"getAllNetworkProfile\" id=\"liid_" + fbacc.FbUserId + "\"   onclick=\"composemessage(this.id,'fb')\"><a><img id=\"img_" + fbacc.FbUserId + "\" src=\"../Contents/img/facebook.png\" alt=\"" + fbacc.AccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"composename_" + fbacc.FbUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + fbacc.FbUserName + "</span><span id=\"imgurl_" + fbacc.FbUserId + "\" style=\"display:none;\">http://graph.facebook.com/" + fbacc.FbUserId + "/picture?type=small</span></a></li>";
                            }
                        }
                        profiles += "</ul> </div>";

                    }
                    catch (Exception ex)
                    {

                        logger.Error(ex.Message);

                    }

                    /*tumbler users binding*/

                    try
                    {
                        List<TeamMemberProfile> allTumblrprofiles = objTeamMemberProfileRepository.getTumblrTeamMemberProfileData(team.Id);
                        foreach (TeamMemberProfile item in allTumblrprofiles)
                        {
                            TumblrprofileId += item.ProfileId + ',';

                        }
                        TumblrprofileId = TumblrprofileId.Substring(0, TumblrprofileId.Length - 1);

                        TumblrAccountRepository tumblrtaccountrepo = new TumblrAccountRepository();
                        List<TumblrAccount> alsttumblrtaccounts = tumblrtaccountrepo.getAllAccountDetail(TumblrprofileId);
                        profiles += "<div class=\"twitte_text\">TUMBLR</div><div class=\"teitter\"><ul>";

                        if (alsttumblrtaccounts.Count == 0)
                        {
                            profiles += "<li>No Records Found</li>";
                        }
                        else
                        {
                            foreach (TumblrAccount item in alsttumblrtaccounts)
                            {
                                profiles += "<li nwtk='twt' class=\"getAllNetworkProfile\" id=\"liid_" + item.tblrUserName + "\"   onclick=\"composemessage(this.id,'twt')\"><a><img id=\"img_" + item.tblrUserName + "\" src=\"../Contents/img/twitter.png\" alt=\"" + item.tblrAccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.tblrUserName + "\" style=\"display:none;\">" + item.tblrProfilePicUrl + "</span><span id=\"composename_" + item.tblrUserName + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.tblrUserName + "</span></a></li>";
                            }
                        }
                        profiles += "</ul> </div>";

                    }
                    catch (Exception ex)
                    {

                        logger.Error(ex.Message);

                    }

                    /*twitter users binding*/
                    try
                    {
                        List<TeamMemberProfile> allTwtprofiles = objTeamMemberProfileRepository.getTwtTeamMemberProfileData(team.Id);
                        foreach (TeamMemberProfile item in allTwtprofiles)
                        {
                            TwtprofileId += item.ProfileId + ',';

                        }
                        TwtprofileId = TwtprofileId.Substring(0, TwtprofileId.Length - 1);

                        TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository();
                        List<TwitterAccount> alsttwtaccounts = twtaccountrepo.getAllAccountDetail(TwtprofileId);
                        profiles += "<div class=\"twitte_text\">TWITTER</div><div class=\"teitter\"><ul>";

                        if (alsttwtaccounts.Count == 0)
                        {
                            profiles += "<li>No Records Found</li>";
                        }
                        else
                        {
                            foreach (TwitterAccount item in alsttwtaccounts)
                            {
                                profiles += "<li nwtk='twt' class=\"getAllNetworkProfile\" id=\"liid_" + item.TwitterUserId + "\"   onclick=\"composemessage(this.id,'twt')\"><a><img id=\"img_" + item.TwitterUserId + "\" src=\"../Contents/img/twitter.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.TwitterUserId + "\" style=\"display:none;\">" + item.ProfileImageUrl + "</span><span id=\"composename_" + item.TwitterUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.TwitterScreenName + "</span></a></li>";
                            }
                        }
                        profiles += "</ul> </div>";

                    }
                    catch (Exception ex)
                    {

                        logger.Error(ex.Message);

                    }

                    /*linkedinuserbinding*/

                    try
                    {
                        List<TeamMemberProfile> allLinkedInprofiles = objTeamMemberProfileRepository.getLinkedInTeamMemberProfileData(team.Id);
                        foreach (TeamMemberProfile item in allLinkedInprofiles)
                        {
                            LinkedInprofileId += item.ProfileId + ',';

                        }
                        LinkedInprofileId = LinkedInprofileId.Substring(0, LinkedInprofileId.Length - 1);

                        LinkedInAccountRepository linkaccountrepo = new LinkedInAccountRepository();
                        List<LinkedInAccount> alstlinkacc = linkaccountrepo.getAllAccountDetail(LinkedInprofileId);
                        profiles += "<div class=\"twitte_text\">LINKEDIN</div><div class=\"teitter\"><ul>";

                        if (alstlinkacc.Count == 0)
                        {
                            profiles += "<li>No Records Found</li>";
                        }
                        else
                        {

                            foreach (LinkedInAccount item in alstlinkacc)
                            {
                                string profileurl = string.Empty;

                                if (!string.IsNullOrEmpty(item.ProfileImageUrl))
                                {
                                    profileurl = item.ProfileImageUrl;
                                }
                                else
                                {
                                    profileurl = "../../Contents/img/blank_img.png";
                                }
                                profiles += "<li nwtk='lin' class=\"getAllNetworkProfile\" id=\"liid_" + item.LinkedinUserId + "\"   onclick=\"composemessage(this.id,'lin')\"><a><img id=\"img_" + item.LinkedinUserId + "\" src=\"../Contents/img/link.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.LinkedinUserId + "\" style=\"display:none;\">" + profileurl + "</span><span id=\"composename_" + item.LinkedinUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.LinkedinUserName + "</span></a></li>";
                            }
                        }
                        profiles += "</ul> </div>";
                    }
                    catch (Exception ex)
                    {

                        logger.Error(ex.Message);

                    }

                    Response.Write(profiles);
                }

                else if (Request.QueryString["op"] == "sendmessage")
                {
                    string messagecount = string.Empty;
                    string message = Request.QueryString["message"];
                    string time = Request.QueryString["now"];
                    //message = Request.Form["massagee"];
                    var userid = Request.QueryString["userid[]"].Split(',');
                    //var userid = Request.Form["userid[]"].Split(',');
                    var files = Request.Files.Count;
                    var fi = Request.Files["file"];
                    string file = string.Empty;
                    try
                    {

                        if (Request.Files.Count > 0)
                        {
                            if (fi != null)
                            {
                                var path = Server.MapPath("~/Contents/img/upload");

                               // var path = System.Configuration.ConfigurationManager.AppSettings["MailSenderDomain"]+"Contents/img/upload";
                                file = path + "/" + fi.FileName;
                                if (!Directory.Exists(path))
                                {
                                    Directory.CreateDirectory(path);
                                }
                                fi.SaveAs(file);
                            }
                        }

                    }
                    catch (Exception ex)
                    {

                        logger.Error(ex.Message);

                    }

                    foreach (var item in userid)
                    {
                        string[] networkingwithid = item.Split('_');
                        if (networkingwithid[0] == "fb")
                        {
                            try
                            {
                               //for (int i = 0; i < 5000; i++)
                               // {

                                    FacebookAccountRepository fbaccountrepo = new FacebookAccountRepository();
                                    FacebookAccount fbaccount = fbaccountrepo.getFacebookAccountDetailsById(networkingwithid[1]);
                                    var args = new Dictionary<string, object>();

                                    args["message"] = message;

                                    if (Request.Files.Count > 0)
                                    {
                                        string strPathAndQuery = HttpContext.Current.Request.Url.PathAndQuery;
                                        string strUrl = HttpContext.Current.Request.Url.AbsoluteUri.Replace(strPathAndQuery, "/");
                                        string filepath = strUrl + "/Contents/img/upload/" + fi.FileName;
                                        args["picture"] = filepath;
                                    }
                                    FacebookClient fc = new FacebookClient(fbaccount.AccessToken);

                                    string facebookpost = string.Empty;
                                    if (fbaccount.Type == "page")
                                    {
                                        facebookpost = fc.Post("/" + fbaccount.FbUserId + "/feed", args).ToString();
                                    }
                                    else
                                    {
                                        facebookpost = fc.Post("/me/feed", args).ToString();
                                    }

                                //}

                            }
                            catch (Exception ex)
                            {

                                logger.Error(ex.Message);

                                Console.WriteLine(ex.Message);
                            }

                        }
                        else if (networkingwithid[0] == "twt")
                        {
                            try
                            {
                                TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository();
                                SocioBoard.Domain.TwitterAccount twtaccount = twtaccountrepo.getUserInformation(networkingwithid[1]);

                                TwitterHelper twthelper = new TwitterHelper();

                                oAuthTwitter OAuthTwt = new oAuthTwitter();
                                OAuthTwt.AccessToken = twtaccount.OAuthToken;
                                OAuthTwt.AccessTokenSecret = twtaccount.OAuthSecret;
                                OAuthTwt.TwitterScreenName = twtaccount.TwitterScreenName;
                                OAuthTwt.TwitterUserId = twtaccount.TwitterUserId;

                                twthelper.SetCofigDetailsForTwitter(OAuthTwt);

                                #region For Testing
                                // For Testing

                                //OAuthTwt.ConsumerKey = "udiFfPxtCcwXWl05wTgx6w";
                                //OAuthTwt.ConsumerKeySecret = "jutnq6N32Rb7cgbDSgfsrUVgRQKMbUB34yuvAfCqTI";
                                //OAuthTwt.AccessToken = "1453351098-Lz4H7cHKp26pXarF6l9zEwdiHDnwH7D0H4zteH3";
                                //OAuthTwt.AccessTokenSecret = "dGBPxR9wxhQMioIcj5P4Wemxo5EZIZ8wlvDz7i39lSNFg";
                                //OAuthTwt.TwitterScreenName = "";
                                //OAuthTwt.TwitterUserId = "";
                                #endregion

                                Tweet twt = new Tweet();
                                if (Request.Files.Count > 0)
                                {

                                    PhotoUpload ph = new PhotoUpload();
                                    //ph.Tweet(file, message, OAuthTwt);
                                    string res = string.Empty;
                                    ph.NewTweet(file, message, OAuthTwt, ref res);

                                    // for testing

                                    Response.Write(res);
                                    Console.WriteLine(res);
                                }
                                else
                                {
                                    JArray post = twt.Post_Statuses_Update(OAuthTwt, message);
                                }
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.Message);
                                logger.Error(ex.Message);

                            }
                        }
                        else if (networkingwithid[0] == "lin")
                        {
                            try
                            {
                                LinkedInAccountRepository linkedinaccrepo = new LinkedInAccountRepository();
                                LinkedInAccount linkedaccount = linkedinaccrepo.getUserInformation(networkingwithid[1]);
                                oAuthLinkedIn Linkedin_oauth = new oAuthLinkedIn();

                                Linkedin_oauth.Verifier = linkedaccount.OAuthVerifier;
                                Linkedin_oauth.TokenSecret = linkedaccount.OAuthSecret;
                                Linkedin_oauth.Token = linkedaccount.OAuthToken;
                                Linkedin_oauth.Id = linkedaccount.LinkedinUserId;
                                Linkedin_oauth.FirstName = linkedaccount.LinkedinUserName;
                                SocialStream sociostream = new SocialStream();
                                string res = sociostream.SetStatusUpdate(Linkedin_oauth, message);
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.Message);
                                logger.Error(ex.Message);

                            }
                        }
                        else if (networkingwithid[0] == "tumb")
                        {
                            string title = string.Empty;
                            try
                            {
                                TumblrAccountRepository objTumblrAccountRepository = new TumblrAccountRepository();
                                TumblrAccount tumblraccount = objTumblrAccountRepository.getTumblrAccountDetailsById(networkingwithid[1]);

                                PublishedPosts objPublishedPosts = new PublishedPosts();
                                objPublishedPosts.PostData(tumblraccount.tblrAccessToken, tumblraccount.tblrAccessTokenSecret, networkingwithid[1], message, title, "text");

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

                            }
                        }
                        string profiletype="";
                        if(networkingwithid[0] == "fb")
                        {
                        profiletype="facebook";
                        }
                        else if(networkingwithid[0] == "twt")
                        {
                         profiletype="twitter";
                        }
                         else if(networkingwithid[0] == "lin")
                        {
                         profiletype="linkedin";
                        }
                        else if (networkingwithid[0] == "tumb")
                        {
                            profiletype = "tumblr";
                        }

                        ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository();
                        ScheduledMessage objScheduledMessage = new ScheduledMessage();
                        try
                        {
                            objScheduledMessage.ShareMessage = message;
                            objScheduledMessage.ClientTime = Convert.ToDateTime(time);
                            objScheduledMessage.ScheduleTime = Convert.ToDateTime(time);
                            objScheduledMessage.CreateTime = Convert.ToDateTime(time);
                            objScheduledMessage.Status = true;
                            objScheduledMessage.UserId = user.Id;
                            objScheduledMessage.ProfileType = profiletype;
                            try
                            {   var path = System.Configuration.ConfigurationManager.AppSettings["MailSenderDomain"]+"Contents/img/upload";
                                file = path + "/" + fi.FileName;
                                objScheduledMessage.PicUrl = file;
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.StackTrace);
                            }

                            objScheduledMessage.ProfileId = networkingwithid[1];
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        objScheduledMessageRepository.addNewMessage(objScheduledMessage);
                        messagecount = objScheduledMessageRepository.getAllSentMessagesOfUser(user.Id).Count().ToString();
                    }

                    Response.Write("~"+messagecount);

                }
                else if (Request.QueryString["op"] == "wooqueue_messages")
                {
                    ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository();
                }
                else if (Request.QueryString["op"] == "schedulemessage")
                {

                    var userid = Request.QueryString["users[]"].Split(',');
                    var datearr = Request.QueryString["datearr[]"].Split(',');
                    string message = Request.QueryString["message"];
                    message = Request.Form["messagee"];
                    ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository();
                    string time = Request.QueryString["time"];
                    string clienttime = Request.QueryString["clittime"];

                    foreach (var item in userid)
                    {
                        if (!string.IsNullOrEmpty(item.ToString()))
                        {
                            foreach (var child in datearr)
                            {

                                ScheduledMessage schmessage = new ScheduledMessage();
                                string[] networkingwithid = item.Split('_');

                                if (networkingwithid[0] == "fbscheduler")
                                {
                                    schmessage.CreateTime = DateTime.Now;
                                    schmessage.ProfileType = "facebook";
                                    schmessage.ProfileId = networkingwithid[1];
                                    schmessage.Id = Guid.NewGuid();
                                    schmessage.PicUrl = string.Empty;
                                    schmessage.ClientTime = Convert.ToDateTime(clienttime);
                                    string servertime = this.CompareDateWithclient(clienttime, child + " " + time);
                                    schmessage.ScheduleTime = Convert.ToDateTime(servertime);
                                    schmessage.ShareMessage = message;
                                    schmessage.UserId = user.Id;
                                    schmessage.Status = false;

                                }
                                else if (networkingwithid[0] == "twtscheduler")
                                {

                                    schmessage.CreateTime = DateTime.Now;
                                    schmessage.ProfileType = "twitter";
                                    schmessage.ProfileId = networkingwithid[1];
                                    schmessage.Id = Guid.NewGuid();
                                    schmessage.PicUrl = string.Empty;
                                    schmessage.ClientTime = Convert.ToDateTime(clienttime);
                                    string servertime = this.CompareDateWithServer(clienttime, child + " " + time);
                                    schmessage.ScheduleTime = Convert.ToDateTime(servertime);
                                    schmessage.ShareMessage = message;
                                    schmessage.UserId = user.Id;
                                    schmessage.Status = false;

                                }
                                else if (networkingwithid[0] == "linscheduler")
                                {
                                    schmessage.ClientTime = Convert.ToDateTime(clienttime);
                                    schmessage.CreateTime = DateTime.Now;
                                    schmessage.ProfileType = "linkedin";
                                    schmessage.ProfileId = networkingwithid[1];
                                    schmessage.Id = Guid.NewGuid();
                                    schmessage.PicUrl = string.Empty;
                                    string servertime = this.CompareDateWithServer(clienttime, child + " " + time);
                                    schmessage.ScheduleTime = Convert.ToDateTime(servertime);
                                    schmessage.ShareMessage = message;
                                    schmessage.UserId = user.Id;
                                    schmessage.Status = false;

                                }
                                if (!string.IsNullOrEmpty(message))
                                {
                                    if (!schmsgrepo.checkMessageExistsAtTime(user.Id, schmessage.ShareMessage, schmessage.ScheduleTime, schmessage.ProfileId))
                                    {
                                        schmsgrepo.addNewMessage(schmessage);
                                    }
                                }
                            }
                        }
                    }
                }
                else if (Request.QueryString["op"] == "insight")
                {
                    string check = "";
                    FacebookAccount objFacebookAccount = (FacebookAccount)Session["fbpagedetail"];
                    FacebookHelper objFbHelper = new FacebookHelper();
                    SocialProfile socioprofile = new SocialProfile();
                    SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository();
                    FacebookAccountRepository fbrepo = new FacebookAccountRepository();
                    FacebookClient fbClient = new FacebookClient(objFacebookAccount.AccessToken);
                    int fancountPage = 0;
                    dynamic fancount = fbClient.Get("fql", new { q = " SELECT fan_count FROM page WHERE page_id =" + Request["id"].ToString() });

                    foreach (var friend in fancount.data)
                    {
                        fancountPage = Convert.ToInt32(friend.fan_count);
                    }
                    objFacebookAccount.Friends = Convert.ToInt32(fancountPage);
                    objFacebookAccount.FbUserId = Request["id"].ToString();
                    objFacebookAccount.FbUserName = Request["name"].ToString();
                    objFacebookAccount.Type = "page";
                    objFacebookAccount.UserId = user.Id;
                    socioprofile.Id = Guid.NewGuid();
                    socioprofile.ProfileDate = DateTime.Now;
                    socioprofile.ProfileId = Request["id"].ToString();
                    socioprofile.ProfileStatus = 1;
                    socioprofile.ProfileType = "facebook";
                    socioprofile.UserId = user.Id;
                    if (!fbrepo.checkFacebookUserExists(objFacebookAccount.FbUserId, user.Id))
                    {
                        fbrepo.addFacebookUser(objFacebookAccount);

                        Groups lstDetails = objGroupRepository.getGroupName(team.GroupId);
                        if (lstDetails.GroupName == "Socioboard")
                        {

                            TeamMemberProfile teammemberprofile = new TeamMemberProfile();
                            teammemberprofile.Id = Guid.NewGuid();
                            teammemberprofile.TeamId = team.Id;
                            teammemberprofile.ProfileId = objFacebookAccount.FbUserId;
                            teammemberprofile.ProfileType = "facebook";
                            teammemberprofile.StatusUpdateDate = DateTime.Now;

                            objTeamMemberProfileRepository.addNewTeamMember(teammemberprofile);

                        }

                        if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                        {
                            socioprofilerepo.addNewProfileForUser(socioprofile);
                        }
                        else
                        {
                            socioprofilerepo.updateSocialProfile(socioprofile);
                        }
                    }
                    else
                    {
                        check = "exist";
                        Session["alreadypageexist"] = objFacebookAccount;
                        fbrepo.updateFacebookUser(objFacebookAccount);
                        if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                        {
                            socioprofilerepo.addNewProfileForUser(socioprofile);
                        }
                        else
                        {
                            socioprofilerepo.updateSocialProfile(socioprofile);
                        }
                    }

                    //get facebookpagefeeds
                    fbClient = new FacebookClient(objFacebookAccount.AccessToken);
                    FacebookHelper fbhelper = new FacebookHelper();
                    FacebookInsightStatsHelper fbiHelper = new FacebookInsightStatsHelper();
                    var feeds = fbClient.Get("/" + Request["id"].ToString() + "/feed");

                    fbiHelper.getPageImpresion(Request["id"].ToString(), user.Id, 15);
                    fbiHelper.getFanPageLikesByGenderAge(Request["id"].ToString(), user.Id, 15);
                    fbiHelper.getLocation(Request["id"].ToString(), user.Id, 15);
                    //  fbiHelper.getFanPost("459630637383010", user.Id, 10);
                    dynamic profile = fbClient.Get(Request["id"].ToString());
                    fbhelper.getFacebookUserFeeds(feeds, profile);
                    //end facebookpagefeeds

                    string id = "id";
                    string value = Request["id"].ToString();

                    Dictionary<string, string> Did = new Dictionary<string, string>();
                    Did.Add(id, value);

                    dynamic Pageid = Did;

                    // var friendgenderstats=fbClient.Get("me/friends?fields=gender");
                    objFbHelper.getfbFriendsGenderStatsForFanPage(Pageid, user.Id, ref objFacebookAccount);

                    Session["fbSocial"] = null;
                    Response.Write(RemainingAccount(user));
                }
                else if (Request.QueryString["op"] == "countmessages")
                {
                    try
                    {
                        int val = 0;
                        /*facebook*/
                        FacebookAccountRepository fbAccoutsRepo = new FacebookAccountRepository();
                        ArrayList lstfacebookAccounts = fbAccoutsRepo.getAllFacebookAccountsOfUser(user.Id);
                        foreach (FacebookAccount item in lstfacebookAccounts)
                        {
                            try
                            {
                                FacebookClient fb = new FacebookClient(item.AccessToken);
                                dynamic unreadcount = fb.Get("fql", new { q = "SELECT unread_count FROM mailbox_folder WHERE folder_id = 0 AND viewer_id = " + item.FbUserId + "" });
                                foreach (var chile in unreadcount.data)
                                {
                                    var count = chile.unread_count;
                                    int countable = Convert.ToInt32(count.ToString());
                                    val = val + countable;

                                }
                            }
                            catch (Exception ex)
                            {
                                logger.Error(ex.Message);
                                Console.WriteLine(ex.Message);
                            }
                        }
                        /*Twitter*/
                        Session["CountMessages"] = val;
                        Response.Write(val);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }

                }

                else if (Request.QueryString["op"] == "recentfollowers")
                {
                    string recentfollowers = string.Empty;
                    #region RecentFollowers
                    Users twtUsers = new Users();
                    TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                    ArrayList lstAccRepo = twtAccRepo.getAllTwitterAccountsOfUser(user.Id);
                    oAuthTwitter oauth = null;
                    foreach (TwitterAccount itemTwt in lstAccRepo)
                    {
                        oauth = new oAuthTwitter();
                        oauth.AccessToken = itemTwt.OAuthToken;
                        oauth.AccessTokenSecret = itemTwt.OAuthSecret;
                        oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
                        oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
                        oauth.TwitterScreenName = itemTwt.TwitterScreenName;
                        oauth.TwitterUserId = itemTwt.TwitterUserId;
                        JArray jarresponse = twtUsers.Get_Followers_ById(oauth, itemTwt.TwitterUserId);
                        foreach (var item in jarresponse)
                        {
                            int resposecount = 0;
                            if (item["ids"] != null)
                            {
                                foreach (var child in item["ids"])
                                {
                                    if (resposecount < 2)
                                    {
                                        JArray userprofile = twtUsers.Get_Users_LookUp(oauth, child.ToString());

                                        foreach (var items in userprofile)
                                        {
                                            resposecount++;
                                            try
                                            {
                                                recentfollowers += "<li><a href=\"https://twitter.com/" + items["screen_name"] + "\" target=\"_blank\"><img style=\"border:3px solid #FCFCFC;\" title=\"" + items["name"] + "\" width=\"48\" height=\"48\" alt=\"\" src=\"" + items["profile_image_url"] + "\"></a></li>";
                                            }
                                            catch (Exception ex)
                                            {
                                                Console.WriteLine(ex.Message);
                                            }

                                        }
                                    }
                                }
                            }
                        }
                    }

                    Response.Write(recentfollowers);

                    #endregion

                }
                else if (Request.QueryString["op"] == "removefollowers")
                {
                    string removeid = Request.QueryString["removeid"];
                    string userid = Request.QueryString["userid"];
                    Friendship friendship = new Friendship();
                    oAuthTwitter oauth = new oAuthTwitter();
                    TwitterAccountRepository twtaccrepo = new TwitterAccountRepository();
                    TwitterAccount twtAccount = twtaccrepo.getUserInformation(user.Id, userid);
                    oauth.TwitterUserId = twtAccount.TwitterUserId;
                    oauth.TwitterScreenName = twtAccount.TwitterScreenName;
                    oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
                    oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
                    oauth.AccessToken = twtAccount.OAuthToken;
                    oauth.AccessTokenSecret = twtAccount.OAuthSecret;
                    JArray responseremove = friendship.Post_Friendship_Destroy(oauth, removeid);

                }
                //for Deleting socialqueue Message

                else if (Request.QueryString["op"] == "deletequeuemsg")
                {
                    try
                    {
                        string res = string.Empty;
                        string messageId = Request.QueryString["messageid"].ToString();
                        Guid userid = user.Id;
                        ScheduledMessageRepository obj = new ScheduledMessageRepository();
                        bool check = obj.deleteScheduleMessage(userid, messageId);
                        if (check == true)
                        {
                            res = "success";
                        }
                        else
                        {

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

                    //for Editing socialqueue Message
                else if (Request.QueryString["op"] == "Editqueuemsg")
                {
                    try
                    {
                        string messageId = Request.QueryString["messageid"].ToString();
                        string newstr = Request.QueryString["newstr"];
                        Guid userid = user.Id;
                        DateTime dt = DateTime.Now;
                        ScheduledMessageRepository obj = new ScheduledMessageRepository();
                        obj.UpdateScheduleMessage(userid, messageId, newstr, dt);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);

                    }
                }

                else if (Request.QueryString["op"] == "wooqueuemessages")
                {
                    string profileid = string.Empty;
                    ScheduledMessageRepository schmsgRepo = new ScheduledMessageRepository();
                    List<TeamMemberProfile> allprofiles = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(team.Id);
                    foreach (TeamMemberProfile item in allprofiles)
                    {
                        profileid += item.ProfileId + ',';

                    }
                    profileid = profileid.Substring(0, profileid.Length - 1);

                    List<ScheduledMessage> lstschMsg = schmsgRepo.getAllMessagesDetail(profileid);
                    string schmessages = string.Empty;
                    //string profurl = string.Empty;
                    //if (string.IsNullOrEmpty(user.ProfileUrl))
                    //{
                    string profurls = "../Contents/img/blank_img.png";
                    //}
                    //else
                    //{
                    //    // profurl = "../Contents/img/blank_img.png";
                    //    profurl = user.ProfileUrl;
                    //}
                    if (lstschMsg.Count != 0)
                    {
                        foreach (ScheduledMessage item in lstschMsg)
                            try
                            {
                                UserRepository objUserRepository=new UserRepository();
                                User objuser = objUserRepository.getUsersById(item.UserId);
                                string profurl = string.Empty;
                                if (string.IsNullOrEmpty(objuser.ProfileUrl))
                                {
                                    profurl = "../Contents/img/blank_img.png";
                                }
                                else
                                {
                                    // profurl = "../Contents/img/blank_img.png";
                                    profurl = objuser.ProfileUrl;
                                }

                                {
                                    schmessages += "<section class=\"section\"><div  class=\"js-task-cont read\">" +
                                                             "<section class=\"task-owner\">" +
                                                                 "<img width=\"32\" height=\"32\" border=\"0\" src=\"" + profurl + "\" class=\"avatar\">" +
                                                             "</section>" +
                                                             "<section class=\"task-activity third\">" +
                                                                 "<p>" + objuser.UserName + "</p>" +
                                                                 "<div>" + CompareDateWithServerNew(item.ClientTime, item.CreateTime, item.ScheduleTime) + "</div>" +
                                                                 "<input type=\"hidden\" value=\"#\" id=\"hdntaskid_1\">" +
                                                                 "<p></p>" +
                                                           "</section>" +
                                                           "<section class=\"task-message font-13 third\" style=\"height: auto; width: 31%; margin-right: 9px;\"><a id=\"edit_" + item.Id + "\" onclick=\"Editqueue('" + item.Id + "','" + item.ShareMessage + "');\" class=\"tip_left\">" + gethtmlfromstring(item.ShareMessage) + "</a></section>";

                                    if (item.ProfileType == "facebook")
                                    {
                                        schmessages += "<div style=\"height:70px; margin-top: 0;\" class=\"userpictiny\">" +
                                                            "<img width=\"48\" height=\"48\" src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\" alt=\"\">" +
                                                            "<a style=\"right: 2px; top: 40px;\" title=\"\" class=\"userurlpic\" href=\"#\">" +
                                                                "<img  alt=\"\" src=\"../Contents/img/facebook.png\" style=\"height: 16px;width: 16x;\"></a></div>";
                                    }
                                    else if (item.ProfileType == "twitter")
                                    {
                                        TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                                        TwitterAccount twtAccount = twtAccRepo.getUserInformation(item.ProfileId);
                                        if (twtAccount != null)
                                        {
                                            schmessages += "<div style=\"height:70px; margin-top: 0;\" class=\"userpictiny\">" +
                                                            "<img width=\"48\" height=\"48\" src=\"" + twtAccount.ProfileImageUrl + "\" alt=\"\">" +
                                                            "<a style=\"right: 2px; top: 40px;\" title=\"\" class=\"userurlpic\" href=\"#\">" +
                                                                "<img  alt=\"\" src=\"../Contents/img/twitter.png\" style=\"height: 16px;width: 16x;\"></a></div>";
                                        }
                                    }
                                    else if (item.ProfileType == "linkedin")
                                    {
                                        LinkedInAccountRepository linkAccRepo = new LinkedInAccountRepository();
                                        LinkedInAccount linkedAccount = linkAccRepo.getUserInformation(item.ProfileId);
                                        if (linkedAccount != null)
                                        {
                                            schmessages += "<div style=\"height:70px; margin-top: 0;\" class=\"userpictiny\">" +
                                                                "<img width=\"48\" height=\"48\" src=\"" + linkedAccount.ProfileImageUrl + "\" alt=\"\">" +
                                                                "<a style=\"right: 2px; top: 40px;\" title=\"\" class=\"userurlpic\" href=\"#\">" +
                                                                    "<img  alt=\"\" src=\"../Contents/img/link.png\" style=\"height: 16px;width: 16x;\"></a></div>";
                                        }

                                    }
                                    string status = (item.Status == true) ? "Completed" : "Pending";
                                    schmessages += "<section class=\"task-status\" style=\"width:34px;\"><div class=\"ui_light floating task_status_change\">" +
                                        //"<a href=\"#nogo\" class=\"ui-sproutmenu\"><span class=\"ui-sproutmenu-status\"><img title=\"Edit Status\" onclick=\"PerformClick(this.id)\" src=\"../Contents/img/icon_edit.png\" class=\"edit_button\" id=\"img_" + item.Id + "_" + item.Status + "\"></span></a></div></section>" +
                                                    "<a class=\"ui-sproutmenu\"><span class=\"ui-sproutmenu-status\"><img title=\"Edit Status\" onclick=\"PerformClick(this.id)\" src=\"../Contents/img/icon_edit.png\" class=\"edit_button\" id=\"img_" + item.Id + "_" + item.Status + "\"></span></a></div></section>" +
                                                   "<section class=\"task-status\" style=\"width: 65px; margin-right: 39px;\">" +
                                                  "<div class=\"ui_light floating task_status_change\">" +
                                                           "<span class=\"ui-sproutmenu-status\">" + status + "</span>" +
                                                  "</div>" +
                                              "</section>" +

                                               "<section class=\"task-status\" style=\"width: 65px; margin-right: 39px;\">" +
                                                  "<div class=\"ui_light floating task_status_change\">" +
                                                           "<span  class=\"ui-sproutmenu-status\"><img title=\"Delete\" onclick=\"deletequeue(this.id)\" style=\"width:33px;margin-left:60px;margin-top:-10px;\" img src=\"../Contents/img/deleteimage.png\" img id=\"" + item.Id + "\"></span>" +
                                                  "</div>" +
                                              "</section>" +

                                           "</div></section>";
                                }
                            }
                            catch (Exception ex)
                            {
                                 logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                               Response.Write(schmessages);
                            }
                    }
                    else
                    {
                        schmessages = "<section class=\"section\"><div class=\"js-task-cont read\"><section class=\"task-owner\">" +
                          "<img width=\"32\" height=\"32\" border=\"0\" class=\"avatar\" src=\"" + profurls + "\">" +
                          "</section><section class=\"task-activity third\"><p>" + user.UserName + "</p><div></div><p></p></section><section style=\"margin-right: 6px; width: 31%; height: auto;\" class=\"task-message font-13 third\">" +
                          "<a class=\"tip_left\">No Scheduled Messages</a></section><section style=\"width:113px;\" class=\"task-status\"><span class=\"ficon task_active\"></span>" +
                            //"<div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\" href=\"#nogo\">" +
                          "<div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\">" +
                          "<span class=\"ui-sproutmenu-status\"></span></a></div></section></div></section>";
                    }
                    Response.Write(schmessages);

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

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

                    updatequeue(Request.QueryString["id"], Request.QueryString["status"]);

                }

                else if (Request.QueryString["op"] == "messagechk")
                {
                    SocioBoard.Domain.Messages mstable = new SocioBoard.Domain.Messages();
                    string[] types = Request.QueryString["type[]"].Split(',');
                    DataSet ds = (DataSet)Session["MessageDataTable"];
                    DataSet dss = DataTableGenerator.CreateDataSetForTable(mstable);
                    DataTable dtt = dss.Tables[0];
                    DataView dv = new DataView(dtt);
                    AjaxMessage ajxfed = new AjaxMessage();
                    string message = string.Empty;
                    foreach (var item in types)
                    {
                        try
                        {
                            DataRow[] foundRows = ds.Tables[0].Select("Type = '" + item + "'");
                            foreach (var child in foundRows)
                            {
                                dtt.ImportRow(child);
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }
                    }
                    message = ajxfed.BindData(dtt);
                    Response.Write(message);
                }
            }
        }
Пример #13
0
        void ProcessRequest()
        {
            if (!string.IsNullOrEmpty(Request.QueryString["op"]))
            {
                if (Request.QueryString["op"] == "removedata")
                {

                    string network = Request.QueryString["network"];
                    string message = string.Empty;
                    var users = Request.QueryString["data[]"];
                    SocioBoard.Domain.Messages mstable = new SocioBoard.Domain.Messages();
                    DataSet ds = DataTableGenerator.CreateDataSetForTable(mstable);
                    DataTable dtt = ds.Tables[0];
                    string page = Request.QueryString["page"];
                    if (page == "feed")
                    {
                        AjaxFeeds ajxfed = new AjaxFeeds();
                        DataTable dt = null;
                        if (network == "facebook")
                        {
                            dt = (DataTable)Session["FacebookFeedDataTable"];
                        }
                        else if (network == "twitter")
                        {
                            dt = (DataTable)Session["TwitterFeedDataTable"];
                        }
                        else if (network == "linkedin")
                        {
                            dt = (DataTable)Session["LinkedInFeedDataTable"];
                        }

                        foreach (var parent in users)
                        {
                            DataView dv = new DataView(dtt);
                            DataRow[] foundRows = dt.Select("ProfileId = '" + parent + "'");
                            foreach (var child in foundRows)
                            {
                                dtt.ImportRow(child);
                            }
                        }
                        message = ajxfed.BindData(dtt);

                    }

                    else if (page == "message")
                    {
                        AjaxMessage ajxmes = new AjaxMessage();
                        DataSet dss = (DataSet)Session["MessageDataTable"];
                        //foreach (var parent in users)
                        //{
                        DataView dv = new DataView(dtt);
                        DataRow[] foundRows = dss.Tables[0].Select("ProfileId = '" + users + "'");
                        foreach (var child in foundRows)
                        {
                            dtt.ImportRow(child);
                        }

                        //}
                        message = ajxmes.BindData(dtt);
                    }
                    Response.Write(message);
                }
                else if (Request.QueryString["op"] == "saveRss")
                {
                    try
                    {
                        User user = (User)Session["LoggedUser"];
                        RssFeedsRepository objRssFeedRepo = new RssFeedsRepository();
                        RssFeeds objRssFeeds = new RssFeeds();
                        objRssFeeds.ProfileScreenName = Request.QueryString["user"];
                        objRssFeeds.FeedUrl = Request.QueryString["feedsurl"];
                        objRssFeeds.UserId = user.Id;
                        objRssFeeds.Status = false;
                        objRssFeeds.Message = Request.QueryString["message"];
                        objRssFeeds.Duration = Request.QueryString["duration"];
                        objRssFeeds.CreatedDate = DateTime.Now;
                        objRssFeedRepo.AddRssFeed(objRssFeeds);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        Console.WriteLine(ex.Message);
                    }
                }

                else if (Request.QueryString["op"] == "savedrafts")
                {
                    Guid Id = Guid.Parse(Request.QueryString["id"]);
                    string newstr = Request.QueryString["newstr"];
                    DraftsRepository draftsRepo = new DraftsRepository();
                    draftsRepo.UpdateDrafts(Id, newstr);

                }

                else if (Request.QueryString["op"] == "chkrssurl")
                {
                    try
                    {
                        string url = Request.QueryString["url"];
                        var facerequest = (HttpWebRequest)WebRequest.Create(url);
                        facerequest.Method = "GET";
                        string outputface = string.Empty;
                        using (var response = facerequest.GetResponse())
                        {
                            using (var stream = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(1252)))
                            {
                                outputface = stream.ReadToEnd();
                                if (outputface.Contains("<rss version=\"2.0\""))
                                {
                                    Response.Write("true");
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        Console.WriteLine(ex.Message);
                        Response.Write("Error");
                    }

                }

                else if (Request.QueryString["op"] == "detailsdiscoveryfacebook")
                {
                    User user = (User)Session["LoggedUser"];
                    string userid = Request.QueryString["profileid"];
                    FacebookAccountRepository fbRepo = new FacebookAccountRepository();
                    ArrayList alst = fbRepo.getAllFacebookAccountsOfUser(user.Id);
                    string accesstoken = string.Empty;

                    foreach (FacebookAccount childnoe in alst)
                    {
                        try
                        {

                            //accesstoken = childnoe.AccessToken;
                            if (CheckFacebookTokenByUserId(childnoe.AccessToken.ToString(), userid))
                            {
                                accesstoken = childnoe.AccessToken;
                                break;
                            }
                            //break;
                        }
                        catch (Exception ex)
                        {

                            Console.WriteLine(ex.Message);
                        }
                    }

                    FacebookClient fbclient = new FacebookClient(accesstoken);
                    string jstring = string.Empty;
                    dynamic item = fbclient.Get(userid);

                    jstring += "<div class=\"modal-small draggable\">";
                    jstring += "<div class=\"modal-content\">";
                    jstring += "<button class=\"modal-btn button b-close\" type=\"button\">";
                    jstring += "<span class=\"icon close-medium\"><span class=\"visuallyhidden\">X</span></span></button>";
                    jstring += "<div class=\"modal-header\"><h3 class=\"modal-title\">Profile summary</h3></div>";
                    jstring += "<div class=\"modal-body profile-modal\">";
                    jstring += "<div class=\"module profile-card component profile-header\">";

                    try
                    {
                        jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('" + item["cover"]["source"] + "');\">";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('https://pbs.twimg.com/profile_banners/215936249/1371721359');\">";
                    }
                    jstring += "<div class=\"profile-header-inner-overlay\"></div>";
                    try
                    {
                        jstring += "<a class=\"profile-picture media-thumbnail js-nav\" href=\"#\"><img class=\"avatar size73\" alt=\"\" src=\"http://graph.facebook.com/" + item["id"] + "/picture?type=small\" /></a>";
                    }
                    catch (Exception)
                    {

                        jstring += "<a class=\"profile-picture media-thumbnail js-nav\" href=\"#\"><img class=\"avatar size73\" alt=\"\" src=\"http://graph.facebook.com/picture?type=small\" /></a>";
                    }
                    jstring += "<div class=\"profile-card-inner\">";
                    jstring += "<h1 class=\"fullname editable-group\">";
                    try
                    {
                        jstring += "<a href=\"#\" class=\"js-nav\">" + item["name"] + "</a>";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    jstring += "<a class=\"verified-link js-tooltip\" href=\"#\"><span class=\"icon verified verified-large-border\"><span class=\"visuallyhidden\"></span> </span></a>";
                    jstring += "</h1>";
                    try
                    {
                        jstring += "<h2 class=\"username\"><a href=\"#\" class=\"pretty-link js-nav\"><span class=\"screen-name\"><s>@</s>" + item["username"] + "</span> </a></h2>";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    jstring += "<div class=\"bio-container editable-group\"><p class=\"bio profile-field\">";
                    try
                    {
                        jstring += item["about"];
                    }
                    catch (Exception ex) { logger.Error(ex.Message); }

                    jstring += "</p></div>";
                    jstring += "<p class=\"location-and-url\">";
                    jstring += "<span class=\"location-container editable-group\"><span class=\"location profile-field\"></span></span>";
                    jstring += "<span class=\"divider hidden\"></span> ";
                    jstring += "<span class=\"url editable-group\">  <span class=\"profile-field\"><a title=\"#\" href=\"http://www.facebook.com/" + item["id"] + "\" rel=\"me nofollow\"  </a>";
                    jstring += "<div style=\"cursor: pointer; width: 16px; height: 16px; display: inline-block;\">&nbsp;</div>";
                    jstring += "</span></span></p></div></div>";
                    jstring += "<div class=\"clearfix\">";
                    jstring += "<div class=\"default-footer\">";

                    jstring += "<div class=\"btn-group\">" +
                                  "<div class=\"follow_button\">" +

                                      //"<span class=\"button-text following-text\">Following</span>" +
                        //"<span class=\"button-text unfollow-text\">Unfollow</span>" +
                                  "</div>" +
                               "</div>";
                    jstring += "</div></div>";
                    jstring += "<div class=\"profile-social-proof\"><div class=\"follow-bar\"></div></div></div>";
                    jstring += "<ol class=\"recent-tweets\">" +
                                  "<li class=\"\">" +
                                      "<div>" +
                                        "<i class=\"dogear\"></i>" +

                                      "</div>" +
                                  "</li>" +
                              "</ol>" +
                              "<div class=\"go_to_profile\">" +
                                  "<small><a href=\"http://www.facebook.com/" + item["id"] + "\" target=\"_blank\" class=\"view_profile\">Go to full profile →</a></small>" +
                              "</div>" +
                          "</div>" +
                          "<div class=\"loading\">" +
                              "<span class=\"spinner-bigger\"></span>" +
                          "</div>" +
                      "</div>";
                    jstring += "</div>";

                    Response.Write(jstring);

                }

                else if (Request.QueryString["op"] == "rssusers")
                {
                    try
                    {
                        User user = (User)Session["LoggedUser"];
                        TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                        ArrayList alst = twtAccRepo.getAllTwitterAccountsOfUser(user.Id);
                        string message = string.Empty;
                        foreach (TwitterAccount item in alst)
                        {
                            message += "<option value=\"" + item.TwitterScreenName + "\">@" + item.TwitterScreenName + "</option>";
                        }
                        Response.Write(message);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        Console.WriteLine(ex.Message);
                    }

                }
                else if (Request.QueryString["op"] == "searchkeyword")
                {
                    User user = (User)Session["LoggedUser"];
                    DiscoverySearchRepository disrepo = new DiscoverySearchRepository();
                    List<string> alst = disrepo.getAllSearchKeywords(user.Id);
                    string message = string.Empty;

                    foreach (var item in alst)
                    {
                        message += "<li onclick=\"getSearchResults('" + item + "');\"><a href=\"#\"><i class=\"show icon-caret-right\" style=\"visibility:visible;margin-right:5px\"></i>" + item + "</a></li>";
                    }
                    Response.Write(message);

                }
                else if (Request.QueryString["op"] == "getResults")
                {
                    string type = Request.QueryString["type"];
                    string key = Request.QueryString["keyword"];
                    Discovery discoverypage = new Discovery();
                    string search = discoverypage.getlistresults(key);
                    string message = "<ul id=\"message-list\">" + search + "</ul>";
                    Response.Write(message);
                }
                else if (Request.QueryString["op"] == "getFollowers")
                {
                    User user = (User)Session["LoggedUser"];
                    Users twtUser = new Users();
                    oAuthTwitter oauth = new oAuthTwitter();
                    TwitterAccountRepository TwtAccRepo = new TwitterAccountRepository();
                    TwitterAccount TwtAccount = TwtAccRepo.getUserInformation(user.Id, Request.QueryString["id"]);
                    oauth.AccessToken = TwtAccount.OAuthToken;
                    oauth.AccessTokenSecret = TwtAccount.OAuthSecret;
                    oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
                    oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
                    oauth.TwitterScreenName = TwtAccount.TwitterScreenName;
                    oauth.TwitterUserId = TwtAccount.TwitterUserId;

                    JArray response = twtUser.Get_Followers_ById(oauth, Request.QueryString["id"]);

                    string jquery = string.Empty;

                    foreach (var item in response)
                    {
                        if (item["ids"] != null)
                        {
                            foreach (var child in item["ids"])
                            {
                                JArray userprofile = twtUser.Get_Users_LookUp(oauth, child.ToString());
                                foreach (var items in userprofile)
                                {

                                    try
                                    {

                                        jquery += "<li class=\"shadower\">" +
                                              "<div class=\"disco-feeds\">" +
                                                  "<div class=\"star-ribbon\"></div>" +
                                                  "<div class=\"disco-feeds-img\">" +
                                                      "<img alt=\"\" src=\"" + items["profile_image_url"] + "\" style=\"height: 100px; width: 100px;\" class=\"pull-left\">" +
                                                  "</div>" +
                                                  "<div class=\"disco-feeds-content\">" +
                                                      "<div class=\"disco-feeds-title\">" +
                                                          "<h3 class=\"no-margin\">" + items["name"] + "</h3>" +
                                                          "<span>@" + items["screen_name"] + "</span>" +
                                                      "</div>" +
                                                      "<p>";

                                        try
                                        {
                                            jquery += items["status"]["text"];
                                        }
                                        catch (Exception ex)
                                        {
                                            logger.Error(ex.Message);
                                        }

                                        lnk = "http://www.twitter.com/" + items["screen_name"].ToString();
                                        jquery += "</p>" +
                                            //"<a href=\"#\" class=\"btn\">Hide</a>" +
                                            //"<a href=\"#\" onclick=\"detailsprofile('" + items["id_str"] + "')\" class=\"btn\">Full Profile <i class=\"icon-caret-right\"></i> </a><div class=\"scl\">" +
                                           "<a href=" + lnk + "  class=\"btn\" target=\"_blank\" rel=\"me nofollow\">Full Profile <i class=\"icon-caret-right\"></i> </a><div class=\"scl\">" +
                                          "<a href=\"#\"><img alt=\"\" src=\"../Contents/img/admin/usergrey.png\"></a>" +
                                          "<a href=\"#\"><img alt=\"\" src=\"../Contents/img/admin/goto.png\"></a>" +
                                          "<a href=\"#\"><img alt=\"\" src=\"../Contents/img/admin/setting.png\"></a>" +
                                      "</div></div></div>" +
                                  "<div class=\"disco-feeds-info\">" +
                                      "<ul class=\"no-margin\">" +
                                          "<li><a href=\"#\"><img src=\"../Contents/img/admin/markerbtn2.png\" alt=\"\">";

                                        if (!string.IsNullOrEmpty(items["time_zone"].ToString()))
                                        {
                                            jquery += items["time_zone"];
                                        }
                                        else
                                        {
                                            jquery += "Not Specific";
                                        }
                                        jquery += "</a></li>";

                                        if (string.IsNullOrEmpty(items["url"].ToString()))
                                        {
                                            jquery += "<li><a href=\"#\"><img src=\"../Contents/img/admin/url.png\" alt=\"\">";
                                            jquery += "Not Specific";
                                        }
                                        else
                                        {
                                            jquery += "<li><a target=\"_blank\" href=\"" + items["url"] + "\"><img src=\"../Contents/img/admin/url.png\" alt=\"\">";
                                            jquery += items["url"];
                                        }
                                        jquery += "</a></li></ul>" +
                                        "<ul class=\"no-margin\" style=\"margin-top:20px\">" +
                                            "<li><a href=\"#\"><img src=\"../Contents/img/admin/twittericon-white.png\" alt=\"\">Followers <big><b>" + items["followers_count"] + "</b></big></a></li>" +
                                            "<li><a href=\"#\"><img src=\"../Contents/img/admin/twitter-white.png\" alt=\"\">Following <big><b>" + items["friends_count"] + "</b></big></a></li>" +
                                            "</ul>" +
                                    "</div>" +
                                "</li>";

                                        #region old
                                        //            jquery += "<div class=\"wentbg\">" +
                                        //                          "<div class=\"over\">" +
                                        //                            "<div class=\"topicon\">" +
                                        //                //"<a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/manplus.png\"></a>" +
                                        //                //"<a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/replay.png\"></a>" +
                                        //                //"<a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/setting.png\"></a>" +
                                        //                            "</div>" +
                                        //                                  "<div class=\"botombtn\">" +
                                        //                              "<div class=\"clickbtn\"><a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/full_profile.png\" onclick=\"detailsprofile('" + items["id_str"] + "')\"></a></div>" +
                                        //                            "</div>" +
                                        //                            "</div>" +
                                        //                                   "<div class=\"wentbgf\"><img alt=\"\" src=\"" + items["profile_image_url"] + "\"></div>" +

                                        //                                            "<div class=\"wentbgtext\">" +
                                        //"<span class=\"heading\">\"" + items["name"] + "\"</span> <span>@\"" + items["screen_name"] + "\"</span>" +
                                        //"<div class=\"viegil\">\"" + items["status"]["text"] + "\"</div>" +

                                        //            "<div class=\"avenue\">" +
                                        //             "<img alt=\"\" src=\"../Contents/img/avenue.png\">" +
                                        //             "<div class=\"avenuetext\">\"" + items["time_zone"] + "\"</div>" +
                                        //              "<img class=\"link\" alt=\"\" src=\"../Contents/img/url.png\">" +
                                        //             "<div class=\"nourl\">No URL</div>" +
                                        //         "</div>";

                                        //            jquery += "<div class=\"followerbg\">" +
                                        //                     "<div class=\"follower\">Followers <span>\"" + items["followers_count"] + "\"</span></div>" +
                                        //                     "<div class=\"following\">Friends <span>\"" + items["friends_count"] + "\"</span></div>" +
                                        //                  "</div>" +
                                        //              "</div>" +
                                        //          "</div>";
                                        #endregion
                                    }
                                    catch (Exception ex)
                                    {
                                        logger.Error(ex.Message);
                                        Console.WriteLine(ex.Message);
                                    }
                                }
                            }
                        }
                        else
                        {
                            jquery += "None of the User Is Following";
                        }

                    }

                    Response.Write(jquery);
                }
                else if (Request.QueryString["op"] == "deletedrafts")
                {
                    Guid id = Guid.Parse(Request.QueryString["id"]);
                    DraftsRepository draftsRepo = new DraftsRepository();
                    draftsRepo.DeleteDrafts(id);

                }
                else if (Request.QueryString["op"] == "usersearchresults")
                {
                    ArrayList alstallusers = null;
                    if (Session["AllUserList"] == null)
                    {
                        User user = (User)Session["LoggedUser"];
                        alstallusers = new ArrayList();

                        /*facebook*/
                        try
                        {
                            FacebookAccountRepository faceaccount = new FacebookAccountRepository();
                            ArrayList lstfacebookaccount = faceaccount.getAllFacebookAccountsOfUser(user.Id);
                            foreach (FacebookAccount item in lstfacebookaccount)
                            {
                                alstallusers.Add(item.FbUserName + "_fb_" + item.FbUserId);
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }

                        /*twitter*/
                        try
                        {
                            TwitterAccountRepository twtAccountrepo = new TwitterAccountRepository();
                            ArrayList lsttwitteraccount = twtAccountrepo.getAllTwitterAccountsOfUser(user.Id);

                            foreach (TwitterAccount item in lsttwitteraccount)
                            {
                                alstallusers.Add(item.TwitterScreenName + "_twt_" + item.TwitterUserId);
                            }

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

                        /*linkedin*/
                        try
                        {
                            LinkedInAccountRepository linkedinaccountrepo = new LinkedInAccountRepository();
                            ArrayList lstaccount = linkedinaccountrepo.getAllLinkedinAccountsOfUser(user.Id);

                            foreach (LinkedInAccount item in lstaccount)
                            {
                                alstallusers.Add(item.LinkedinUserName + "_lin_" + item.LinkedinUserId);
                            }

                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }
                        /*instagram*/
                        try
                        {
                            InstagramAccountRepository instaaccrepo = new InstagramAccountRepository();
                            ArrayList lstinstagramaccount = instaaccrepo.getAllInstagramAccountsOfUser(user.Id);
                            foreach (InstagramAccount item in lstinstagramaccount)
                            {
                                alstallusers.Add(item.InsUserName + "_ins_" + item.InstagramId);
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }

                        ///*googleplus*/
                        try
                        {
                            GooglePlusAccountRepository gpaccountrepo = new GooglePlusAccountRepository();
                            ArrayList lstgpaccount = gpaccountrepo.getAllGooglePlusAccountsOfUser(user.Id);
                            foreach (GooglePlusAccount item in lstgpaccount)
                            {
                                alstallusers.Add(item.GpUserName + "_gp_" + item.GpUserId);
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }

                        Session["AllUserList"] = alstallusers;
                    }
                    else
                    {
                        alstallusers = (ArrayList)Session["AllUserList"];
                    }

                }
                else if (Request.QueryString["op"] == "searchingresults")
                {
                    string txtvalue = Request.QueryString["txtvalue"];
                    string message = string.Empty;
                    if (!string.IsNullOrEmpty(txtvalue))
                    {
                        ArrayList alstall = (ArrayList)Session["AllUserList"];

                        if (alstall.Count != 0)
                        {
                            foreach (string item in alstall)
                            {
                                if (item.ToLower().StartsWith(txtvalue))
                                {
                                    string[] nametype = item.Split('_');

                                    if (nametype[1] == "fb")
                                    {
                                        //message += "<div  class=\"btn srcbtn\">" +
                                        //                "<img width=\"15\" src=\"../Contents/img/facebook.png\" alt=\"\">" +
                                        //          "<span onclick=\"getFacebookProfiles('" + nametype[2] + "')\">" + nametype[0] + "</span>" +
                                        //           "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                        //           "</div>";
                                        lnk = "https://www.facebook.com/" + nametype[2];
                                        message += "<div  class=\"btn srcbtn\">" +
                                                       "<img width=\"15\" src=\"../Contents/img/facebook.png\" alt=\"\">" +
                                                "<a target=\"_blank\" rel=\"me nofollow\" href=" + lnk + ">" + nametype[0] + "</a>" +
                                                  "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                  "</div>";
                                    }
                                    else if (nametype[1] == "twt" || item.Contains("_twt_"))
                                    {
                                        if (nametype.Count() < 4)
                                        {
                                            //message += "<div class=\"btn srcbtn\">" +
                                            //              "<img width=\"15\" src=\"../Contents/img/twticon.png\" alt=\"\">" +
                                            //                " <span onclick=\"detailsprofile('" + nametype[0] + "');\">" + nametype[0] + "</span>" +
                                            //         "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                            //                 "</div>";
                                            lnk = "https://twitter.com/" + nametype[0];
                                            message += "<div class=\"btn srcbtn\">" +
                                                         "<img width=\"15\" src=\"../Contents/img/twticon.png\" alt=\"\">" +
                                                          "<a target=\"_blank\" rel=\"me nofollow\" href=" + lnk + ">" + nametype[0] + "</a>" +
                                                    "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                            "</div>";
                                        }
                                        else
                                        {
                                            string[] containstwitter = item.Split(new string[] { "_twt_" }, StringSplitOptions.None);

                                            //message += "<div  class=\"btn srcbtn\">" +
                                            //                 "<img width=\"15\" src=\"../Contents/img/twticon.png\" alt=\"\">" +
                                            //                    "<span onclick=\"detailsprofile('" + containstwitter[0] + "');\"> " + containstwitter[0] + "</span>" +
                                            //            "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                            //                    "</div>";
                                            lnk = "https://twitter.com/" + containstwitter[0];
                                            message += "<div  class=\"btn srcbtn\">" +
                                                            "<img width=\"15\" src=\"../Contents/img/twticon.png\" alt=\"\">" +
                                                             "<a target=\"_blank\" rel=\"me nofollow\" href=" + lnk + ">" + containstwitter[0] + "</a>" +
                                                       "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                               "</div>";

                                        }
                                    }
                                    else if (nametype[1] == "ins")
                                    {

                                        message += "<div class=\"btn srcbtn\">" +
                                                   "<a target=\"_blank\" rel=\"" + nametype[0] + "\" href=\"http://instagram.com/" + nametype[0] + "\">" +
                                                   "<img width=\"15\" src=\"../Contents/img/instagram_24X24.png\" alt=\"\">" + nametype[0] +
                                                   "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                   "</a>" +
                                                "</div>";
                                        //message += "<div class=\"btn srcbtn\">" +
                                        //              "<img width=\"15\" src=\"../Contents/img/instagram_24X24.png\" alt=\"\">" +
                                        //         nametype[0] +
                                        //         "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                        //         "</div>";
                                    }
                                    else if (nametype[1] == "lin")
                                    {
                                        LinkedInAccountRepository liRepo = new LinkedInAccountRepository();
                                        LinkedInAccount liaccount = liRepo.getLinkedinAccountDetailsById(nametype[2]);
                                        message += "<div class=\"btn srcbtn\">" +
                                                    "<a target=\"_blank\" rel=\"" + nametype[0] + "\" href=" + liaccount.ProfileUrl + ">" +
                                                    "<img width=\"15\" src=\"../Contents/img/link_icon.png\" alt=\"\">" + nametype[0] +
                                                    "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                    "</a>" +
                                                 "</div>";
                                        //message += "<div class=\"btn srcbtn\">" +
                                        //              "<img width=\"15\" src=\"../Contents/img/link_icon.png\" alt=\"\">" +
                                        //         nametype[0] +
                                        //         "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                        //         "</div>";
                                    }
                                    else if (nametype[1] == "gp")
                                    {
                                        message += "<div class=\"btn srcbtn\">" +
                                                          "<img width=\"15\" src=\"../Contents/img/google_plus.png\" alt=\"\">" +
                                                     nametype[0] +
                                                     "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                     "</div>";

                                    }
                                }

                            }
                        }
                        else
                        {
                            message += "<div class=\"btn srcbtn\">" +
                                                  "<img width=\"15\" src=\"../Contents/img/norecord.png\" alt=\"\">" +
                                             "No Records Found" +
                                             "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                             "</div>";

                        }

                        message += "<div class=\"socailtile\">Twitter</div>";

                        /*twitter contact search */

                        #region twitter contact search
                        try
                        {
                            User user = (User)Session["LoggedUser"];
                            Users twtUser = new Users();
                            oAuthTwitter oAuthTwt = new oAuthTwitter();
                            if (Session["oAuthUserSearch"] == null)
                            {
                                oAuthTwitter oauth = new oAuthTwitter();
                                oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"].ToString();
                                oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"].ToString();
                                oauth.CallBackUrl = ConfigurationManager.AppSettings["callbackurl"].ToString();
                                TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                                ArrayList alst = twtAccRepo.getAllTwitterAccountsOfUser(user.Id);
                                foreach (TwitterAccount item in alst)
                                {
                                    oauth.AccessToken = item.OAuthToken;
                                    oauth.AccessTokenSecret = item.OAuthSecret;
                                    oauth.TwitterUserId = item.TwitterUserId;
                                    oauth.TwitterScreenName = item.TwitterScreenName;
                                    if (CheckTwitterToken(oauth, txtvalue))
                                    {
                                        break;
                                    }
                                }
                                Session["oAuthUserSearch"] = oauth;
                                oAuthTwt = oauth;
                            }
                            else
                            {
                                oAuthTwitter oauth = (oAuthTwitter)Session["oAuthUserSearch"];
                                oAuthTwt = oauth;
                            }

                            JArray twtuserjson = twtUser.Get_Users_Search(oAuthTwt, txtvalue, "5");

                            foreach (var item in twtuserjson)
                            {
                                //message += "<div class=\"btn srcbtn\">" +
                                //                         "<img width=\"15\" src=\"../Contents/img/twticon.png\" alt=\"\">" +
                                //                           " <span> " + item["screen_name"].ToString().TrimStart('"').TrimEnd('"') + "</span>" +
                                //                    "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                //                            "</div>";

                                lnk = "https://twitter.com/" + item["screen_name"].ToString().TrimStart('"').TrimEnd('"');

                                message += "<div class=\"btn srcbtn\">" +
                                                        "<img width=\"15\" src=\"../Contents/img/twticon.png\" alt=\"\">" +
                                                          "<a target=\"_blank\" rel=\"me nofollow\" href=" + lnk + ">" + item["screen_name"].ToString().TrimStart('"').TrimEnd('"') + "</a>" +
                                                   "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                           "</div>";

                            }

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

                        #endregion

                        message += "<div class=\"socailtile\">Facebook</div>";

                        #region Facebook Contact search
                        try
                        {
                            string accesstoken = string.Empty;
                            FacebookAccountRepository facebookaccrepo = new FacebookAccountRepository();
                            ArrayList alstfacbookusers = facebookaccrepo.getAllFacebookAccounts();

                            foreach (FacebookAccount item in alstfacbookusers)
                            {
                                accesstoken = item.AccessToken;
                                if (CheckFacebookToken(accesstoken, txtvalue))
                                {
                                    break;
                                }
                            }

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

                            JArray facebookSearchResult = JArray.Parse(outputface);

                            foreach (var item in facebookSearchResult)
                            {
                                var data = item["data"];
                                foreach (var chlid in data)
                                {
                                    lnk = "https://www.facebook.com/" + chlid["id"];
                                    message += "<div  class=\"btn srcbtn\">" +
                                                        "<img width=\"15\" src=\"../Contents/img/facebook.png\" alt=\"\">" +
                                                 "<a target=\"_blank\" rel=\"me nofollow\" href=" + lnk + ">" + chlid["name"] + "</a>" +
                                                   "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                   "</div>";
                                }

                            }

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

                        Response.Write(message);
                    }
                }

                    //start descovery details

                    //start descovery details for twitter
                else if (Request.QueryString["op"] == "detailsdiscoverytwitter")
                {
                    User user = (User)Session["LoggedUser"];
                    string userid = Request.QueryString["profileid"];
                    TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository();
                    ArrayList alst = twtAccountRepo.getAllTwitterAccountsOfUser(user.Id);
                    oAuthTwitter oauth = new oAuthTwitter();
                    foreach (TwitterAccount childnoe in alst)
                    {
                        oauth.AccessToken = childnoe.OAuthToken;
                        oauth.AccessTokenSecret = childnoe.OAuthSecret;
                        oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
                        oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
                        oauth.TwitterUserId = childnoe.TwitterUserId;
                        oauth.TwitterScreenName = childnoe.TwitterScreenName;
                        if (CheckTwitterTokenByUserId(oauth, userid))
                        {
                            break;
                        }
                    }

                    Users userinfo = new Users();
                    JArray userlookup = userinfo.Get_Users_LookUp(oauth, userid);
                    string jstring = string.Empty;

                    foreach (var item in userlookup)
                    {

                        jstring += "<div class=\"modal-small draggable\">";
                        jstring += "<div class=\"modal-content\">";
                        jstring += "<button class=\"modal-btn button b-close\" type=\"button\">";
                        jstring += "<span class=\"icon close-medium\"><span class=\"visuallyhidden\">X</span></span></button>";
                        jstring += "<div class=\"modal-header\"><h3 class=\"modal-title\">Profile summary</h3></div>";
                        jstring += "<div class=\"modal-body profile-modal\">";
                        jstring += "<div class=\"module profile-card component profile-header\">";
                        jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('" + item["profile_banner_url"] + "');\">";
                        jstring += "<div class=\"profile-header-inner-overlay\"></div>";
                        jstring += "<a class=\"profile-picture media-thumbnail js-nav\" href=\"#\"><img class=\"avatar size73\" alt=\"" + item["name"] + "\" src=\"" + item["profile_image_url"] + "\" /></a>";
                        jstring += "<div class=\"profile-card-inner\">";
                        jstring += "<h1 class=\"fullname editable-group\">";
                        jstring += "<a href=\"www.twitter.com/" + item["name"] + "\" class=\"js-nav\">" + item["name"] + "</a>";
                        jstring += "<a class=\"verified-link js-tooltip\" href=\"#\"><span class=\"icon verified verified-large-border\"><span class=\"visuallyhidden\"></span> </span></a>";
                        jstring += "</h1>";
                        jstring += "<h2 class=\"username\"><a href=\"#\" class=\"pretty-link js-nav\"><span class=\"screen-name\"><s>@</s>" + item["screen_name"] + "</span> </a></h2>";
                        jstring += "<div class=\"bio-container editable-group\"><p class=\"bio profile-field\">";
                        try
                        {
                            jstring += item["status"]["text"];
                        }
                        catch (Exception ex) { logger.Error(ex.Message); }

                        jstring += "</p></div>";
                        jstring += "<p class=\"location-and-url\">";
                        jstring += "<span class=\"location-container editable-group\"><span class=\"location profile-field\"></span></span>";
                        jstring += "<span class=\"divider hidden\"></span> ";
                        jstring += "<span class=\"url editable-group\">  <span class=\"profile-field\"><a title=\"#\" href=\"" + item["url"] + "\" rel=\"me nofollow\" target=\"_blank\">" + item["url"] + " </a>";
                        jstring += "<div style=\"cursor: pointer; width: 16px; height: 16px; display: inline-block;\">&nbsp;</div>";
                        jstring += "</span></span></p></div></div>";
                        jstring += "<div class=\"clearfix\">";
                        jstring += "<div class=\"default-footer\">";
                        jstring += "<ul class=\"stats js-mini-profile-stats\">" +
                            //"<li><a href=\"#\" class=\"js-nav\"><strong> 6,274</strong> Tweets </a></li>" +
                                          "<li><a href=\"#\" class=\"js-nav\"><strong>" + item["friends_count"] + "</strong> Following </a></li>" +
                                          "<li><a href=\"#\" class=\"js-nav\"><strong>" + item["followers_count"] + "</strong> Followers </a></li>";
                        jstring += "</ul>";
                        jstring += "<div class=\"btn-group\">" +
                                      "<div class=\"follow_button\">" +
                            //"<span class=\"button-text follow-text\">Follow</span> " +
                                          "<span class=\"button-text following-text\">Following</span>" +
                                          "<span class=\"button-text unfollow-text\">Unfollow</span>" +
                                      "</div>" +
                                   "</div>";
                        jstring += "</div></div>";
                        jstring += "<div class=\"profile-social-proof\"><div class=\"follow-bar\"></div></div></div>";
                        jstring += "<ol class=\"recent-tweets\">" +
                                      "<li class=\"\">" +
                                          "<div>" +
                                            "<i class=\"dogear\"></i>" +

                                          "</div>" +
                                      "</li>" +
                                  "</ol>" +
                                  "<div class=\"go_to_profile\">" +
                                      "<small><a href=\"https://twitter.com/" + item["screen_name"] + "\" target=\"_blank\" class=\"view_profile\">Go to full profile →</a></small>" +
                                  "</div>" +
                              "</div>" +
                              "<div class=\"loading\">" +
                                  "<span class=\"spinner-bigger\"></span>" +
                              "</div>" +
                          "</div>";
                        jstring += "</div>";

                    }
                    Response.Write(jstring);
                }

                    //twitter Descovery End

                    //facebook start

                else if (Request.QueryString["op"] == "detailsdiscoveryfacebook")
                {
                    User user = (User)Session["LoggedUser"];
                    string userid = Request.QueryString["profileid"];
                    FacebookAccountRepository fbRepo = new FacebookAccountRepository();
                    ArrayList alst = fbRepo.getAllFacebookAccountsOfUser(user.Id);
                    string accesstoken = string.Empty;

                    foreach (FacebookAccount childnoe in alst)
                    {
                        accesstoken = childnoe.AccessToken;

                        break;
                    }

                    FacebookClient fbclient = new FacebookClient(accesstoken);
                    string jstring = string.Empty;
                    dynamic item = fbclient.Get(userid);

                    jstring += "<div class=\"modal-small draggable\">";
                    jstring += "<div class=\"modal-content\">";
                    jstring += "<button class=\"modal-btn button b-close\" type=\"button\">";
                    jstring += "<span class=\"icon close-medium\"><span class=\"visuallyhidden\">X</span></span></button>";
                    jstring += "<div class=\"modal-header\"><h3 class=\"modal-title\">Profile summary</h3></div>";
                    jstring += "<div class=\"modal-body profile-modal\">";
                    jstring += "<div class=\"module profile-card component profile-header\">";

                    try
                    {
                        jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('" + item["cover"]["source"] + "');\">";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('https://pbs.twimg.com/profile_banners/215936249/1371721359');\">";
                    }
                    jstring += "<div class=\"profile-header-inner-overlay\"></div>";
                    try
                    {
                        jstring += "<a class=\"profile-picture media-thumbnail js-nav\" href=\"#\"><img class=\"avatar size73\" alt=\"\" src=\"http://graph.facebook.com/" + item["id"] + "/picture?type=small\" /></a>";
                    }
                    catch (Exception)
                    {

                        jstring += "<a class=\"profile-picture media-thumbnail js-nav\" href=\"#\"><img class=\"avatar size73\" alt=\"\" src=\"http://graph.facebook.com/picture?type=small\" /></a>";
                    }
                    jstring += "<div class=\"profile-card-inner\">";
                    jstring += "<h1 class=\"fullname editable-group\">";
                    try
                    {
                        jstring += "<a href=\"#\" class=\"js-nav\">" + item["name"] + "</a>";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    jstring += "<a class=\"verified-link js-tooltip\" href=\"#\"><span class=\"icon verified verified-large-border\"><span class=\"visuallyhidden\"></span> </span></a>";
                    jstring += "</h1>";
                    try
                    {
                        jstring += "<h2 class=\"username\"><a href=\"#\" class=\"pretty-link js-nav\"><span class=\"screen-name\"><s>@</s>" + item["username"] + "</span> </a></h2>";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    jstring += "<div class=\"bio-container editable-group\"><p class=\"bio profile-field\">";
                    try
                    {
                        jstring += item["about"];
                    }
                    catch (Exception ex) { logger.Error(ex.Message); }

                    jstring += "</p></div>";
                    jstring += "<p class=\"location-and-url\">";
                    jstring += "<span class=\"location-container editable-group\"><span class=\"location profile-field\"></span></span>";
                    jstring += "<span class=\"divider hidden\"></span> ";
                    jstring += "<span class=\"url editable-group\">  <span class=\"profile-field\"><a title=\"#\" href=\"http://www.facebook.com/" + item["id"] + "\" rel=\"me nofollow\"  </a>";
                    jstring += "<div style=\"cursor: pointer; width: 16px; height: 16px; display: inline-block;\">&nbsp;</div>";
                    jstring += "</span></span></p></div></div>";
                    jstring += "<div class=\"clearfix\">";
                    jstring += "<div class=\"default-footer\">";

                    jstring += "<div class=\"btn-group\">" +
                                  "<div class=\"follow_button\">" +

                                      //"<span class=\"button-text following-text\">Following</span>" +
                        //"<span class=\"button-text unfollow-text\">Unfollow</span>" +
                                  "</div>" +
                               "</div>";
                    jstring += "</div></div>";
                    jstring += "<div class=\"profile-social-proof\"><div class=\"follow-bar\"></div></div></div>";
                    jstring += "<ol class=\"recent-tweets\">" +
                                  "<li class=\"\">" +
                                      "<div>" +
                                        "<i class=\"dogear\"></i>" +

                                      "</div>" +
                                  "</li>" +
                              "</ol>" +
                              "<div class=\"go_to_profile\">" +
                                  "<small><a href=\"http://www.facebook.com/" + item["id"] + "\" target=\"_blank\" class=\"view_profile\">Go to full profile →</a></small>" +
                              "</div>" +
                          "</div>" +
                          "<div class=\"loading\">" +
                              "<span class=\"spinner-bigger\"></span>" +
                          "</div>" +
                      "</div>";
                    jstring += "</div>";

                    Response.Write(jstring);

                }

                    //facebook end

                    //End descovery details

                else if (Request.QueryString["op"] == "getTwitterUserDetails")
                {
                    User user = (User)Session["LoggedUser"];
                    string userid = Request.QueryString["profileid"];
                    TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository();
                    ArrayList alst = twtAccountRepo.getAllTwitterAccountsOfUser(user.Id);
                    oAuthTwitter oauth = new oAuthTwitter();
                    foreach (TwitterAccount childnoe in alst)
                    {
                        oauth.AccessToken = childnoe.OAuthToken;
                        oauth.AccessTokenSecret = childnoe.OAuthSecret;
                        oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
                        oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
                        oauth.TwitterUserId = childnoe.TwitterUserId;
                        oauth.TwitterScreenName = childnoe.TwitterScreenName;
                        if (CheckTwitterTokenByUserId(oauth, userid))
                        {
                            break;
                        }
                    }

                    Users userinfo = new Users();
                    JArray userlookup = userinfo.Get_Users_LookUp(oauth, userid);
                    string jstring = string.Empty;

                    foreach (var item in userlookup)
                    {
                        //jstring = "<div class=\"big-puff\">";
                        //jstring += "<article><dl>";
                        //jstring += "<img src=\"" + item["profile_image_url"] + "\" alt=\"\" class=\"photo\">";
                        //jstring += "<div class=\"descrption\">";
                        //jstring += "<h3 title=\"Carlos Ullon\" class=\"fn\">" + item["name"] + "<span class=\"screenname prof_meta\">" + item["screen_name"];
                        //jstring += "<span class=\"ficon blue_bird_sm nickname\"></span></span>";
                        //jstring += "</h3><p class=\"note\"></p>";
                        //jstring += "<ul class=\"prof_meta\">";
                        //try
                        //{
                        //    jstring += "<li>" + item["status"]["text"] + "</li>";
                        //}
                        //catch { }
                        //jstring += "<li></li>";
                        //jstring += "</ul></div></dl><section class=\"profile_sub_wrap\"><a class=\"klout_link\" target=\"_blank\" href=\"http://www.klout.com/carlosullon\">";
                        //jstring += "<div class=\"klout_container\"><span class=\"score\"></span>";
                        //jstring += "<div class=\"icon klout_score\"></div>";
                        //jstring += "</div></a>";
                        //jstring += "<ul class=\"follow\">";
                        //jstring += "<li><span class=\"followers filter\"><span>Followers</span>";
                        //jstring += "<a data-msg_type=\"followers\" href=\"javascript:void(0)\">" + item["followers_count"] + "</a></span></li>";
                        //jstring += "<li><span class=\"friends filter\"><span>Following</span> <a data-msg_type=\"friends\" href=\"javascript:void(0)\">" + item["friends_count"] + "</a></span></li>";
                        //jstring += "</ul></section></article>";
                        //jstring += "<div class=\"usertweets\">";
                        //jstring += "<div class=\"tweetstitle\">User Tweets</div>";
                        //jstring += "<div id=\"offmessages\" class=\"usertweets_div\">";
                        //jstring += "</div>";
                        //jstring += "</div>";
                        //jstring += "</div></div>";

                        //============================

                        jstring += "<div class=\"modal-small draggable\">";
                        jstring += "<div class=\"modal-content\">";
                        jstring += "<button class=\"modal-btn button b-close\" type=\"button\">";
                        jstring += "<span class=\"icon close-medium\"><span class=\"visuallyhidden\">X</span></span></button>";
                        jstring += "<div class=\"modal-header\"><h3 class=\"modal-title\">Profile summary</h3></div>";
                        jstring += "<div class=\"modal-body profile-modal\">";
                        jstring += "<div class=\"module profile-card component profile-header\">";
                        jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('" + item["profile_banner_url"] + "');\">";
                        jstring += "<div class=\"profile-header-inner-overlay\"></div>";
                        jstring += "<a class=\"profile-picture media-thumbnail js-nav\" href=\"#\"><img class=\"avatar size73\" alt=\"" + item["name"] + "\" src=\"" + item["profile_image_url"] + "\" /></a>";
                        jstring += "<div class=\"profile-card-inner\">";
                        jstring += "<h1 class=\"fullname editable-group\">";
                        jstring += "<a href=\"www.twitter.com/" + item["name"] + "\" class=\"js-nav\">" + item["name"] + "</a>";
                        jstring += "<a class=\"verified-link js-tooltip\" href=\"#\"><span class=\"icon verified verified-large-border\"><span class=\"visuallyhidden\"></span> </span></a>";
                        jstring += "</h1>";
                        jstring += "<h2 class=\"username\"><a href=\"#\" class=\"pretty-link js-nav\"><span class=\"screen-name\"><s>@</s>" + item["screen_name"] + "</span> </a></h2>";
                        jstring += "<div class=\"bio-container editable-group\"><p class=\"bio profile-field\">";
                        try
                        {
                            jstring += item["status"]["text"];
                        }
                        catch (Exception ex) { logger.Error(ex.Message); }

                        jstring += "</p></div>";
                        jstring += "<p class=\"location-and-url\">";
                        jstring += "<span class=\"location-container editable-group\"><span class=\"location profile-field\"></span></span>";
                        jstring += "<span class=\"divider hidden\"></span> ";
                        jstring += "<span class=\"url editable-group\">  <span class=\"profile-field\"><a title=\"#\" href=\"" + item["url"] + "\" rel=\"me nofollow\" target=\"_blank\">" + item["url"] + " </a>";
                        jstring += "<div style=\"cursor: pointer; width: 16px; height: 16px; display: inline-block;\">&nbsp;</div>";
                        jstring += "</span></span></p></div></div>";
                        jstring += "<div class=\"clearfix\">";
                        jstring += "<div class=\"default-footer\">";
                        jstring += "<ul class=\"stats js-mini-profile-stats\">" +
                            //"<li><a href=\"#\" class=\"js-nav\"><strong> 6,274</strong> Tweets </a></li>" +
                                          "<li><a href=\"#\" class=\"js-nav\"><strong>" + item["friends_count"] + "</strong> Following </a></li>" +
                                          "<li><a href=\"#\" class=\"js-nav\"><strong>" + item["followers_count"] + "</strong> Followers </a></li>";
                        jstring += "</ul>";
                        jstring += "<div class=\"btn-group\">" +
                                      "<div class=\"follow_button\">" +
                            //"<span class=\"button-text follow-text\">Follow</span> " +
                                          "<span class=\"button-text following-text\">Following</span>" +
                                          "<span class=\"button-text unfollow-text\">Unfollow</span>" +
                                      "</div>" +
                                   "</div>";
                        jstring += "</div></div>";
                        jstring += "<div class=\"profile-social-proof\"><div class=\"follow-bar\"></div></div></div>";
                        jstring += "<ol class=\"recent-tweets\">" +
                                      "<li class=\"\">" +
                                          "<div>" +
                                            "<i class=\"dogear\"></i>" +
                            //"<div class=\"content\">" +
                            //    "<div class=\"stream-item-header\">" +
                            //        "<a href=\"#\" class=\"account-group\"> " +
                            //            "<img alt=\"\" src=\""+item["profile_img_url"]+"\" class=\"avatar js-action-profile-avatar\" />" +
                            //        "</a>" +
                            //        "<div class=\"content_stream\">" +
                            //            "<div class=\"content_time\">" +
                            //                "<a>" +
                            //                    "<strong class=\"fullname\">"+item["name"]+"</strong>" +
                            //                    "<span>&rlm;</span> " +
                            //                    "<span class=\"username_action_name\"><s>@</s><b>"+item["screen_name"]+"</b></span>" +
                            //                "</a>" +
                            //                "<small class=\"time\">" +
                            //                    "<a title=\"11:42 AM - 10 Jul 13 (GMT+05:30)\" class=\"tweet-timestamp js-permalink js-nav\" href=\"#\">" +
                            //                       "<span class=\"_timestamp js-short-timestamp js-relative-timestamp\">33m</span>" +
                            //                    "</a>" +
                            //                "</small>" +
                            //            "</div>" +
                            //            "<p class=\"tweet_text\">" +
                            //               "RT If you watched Bhuvneshwar Kumar's amazing bowling performance in yesterday's" +
                            //               " match. <a dir=\"ltr\" class=\"twitter_hashtag\" href=\"#\"><s>#</s><b>IndvsSL</b></a>" +
                            //            "</p>" +
                            //            "<div class=\"stream_item_footer\">" +
                            //                "<a href=\"#\" class=\"details\">" +
                            //                    "<b><span class=\"simple-details-link\">Details</span> </b>" +
                            //                "</a>" +
                            //            "</div>" +
                            //        "</div>" +
                            //    "</div>" +
                            //"</div>" +
                                          "</div>" +
                                      "</li>" +
                                  "</ol>" +
                                  "<div class=\"go_to_profile\">" +
                                      "<small><a href=\"https://twitter.com/" + item["screen_name"] + "\" target=\"_blank\" class=\"view_profile\">Go to full profile →</a></small>" +
                                  "</div>" +
                              "</div>" +
                              "<div class=\"loading\">" +
                                  "<span class=\"spinner-bigger\"></span>" +
                              "</div>" +
                          "</div>";
                        jstring += "</div>";

                    }
                    Response.Write(jstring);
                }
                else if (Request.QueryString["op"] == "pauseRssMessage")
                {
                    Guid ID = Guid.Parse(Request.QueryString["id"]);
                    RssFeedsRepository rssRepo = new RssFeedsRepository();
                    rssRepo.updateFeedStatus("pause", ID);
                }
                else if (Request.QueryString["op"] == "deleteRssMessage")
                {
                    Guid ID = Guid.Parse(Request.QueryString["id"]);
                    RssFeedsRepository rssRepo = new RssFeedsRepository();
                    rssRepo.DeleteRssMessage(ID);
                }
                else if (Request.QueryString["op"] == "playRssMessage")
                {
                    Guid ID = Guid.Parse(Request.QueryString["id"]);
                    RssFeedsRepository rssRepo = new RssFeedsRepository();
                    rssRepo.updateFeedStatus("play", ID);
                }

                    //below  code is used for facebook

                else if (Request.QueryString["op"] == "facebookProfileDetails")
                {
                    User user = (User)Session["LoggedUser"];
                    string userid = Request.QueryString["profileid"];
                    FacebookAccountRepository fbRepo = new FacebookAccountRepository();
                    ArrayList alst = fbRepo.getAllFacebookAccountsOfUser(user.Id);
                    string accesstoken = string.Empty;

                    foreach (FacebookAccount childnoe in alst)
                    {
                        accesstoken = childnoe.AccessToken;
                        if (CheckFacebookTokenByUserId(accesstoken, userid))
                        {
                            break;
                        }
                    }

                    FacebookClient fbclient = new FacebookClient(accesstoken);
                    string jstring = string.Empty;
                    dynamic item = fbclient.Get(userid);

                    jstring += "<div class=\"modal-small draggable\">";
                    jstring += "<div class=\"modal-content\">";
                    jstring += "<button class=\"modal-btn button b-close\" type=\"button\">";
                    jstring += "<span class=\"icon close-medium\"><span class=\"visuallyhidden\">X</span></span></button>";
                    jstring += "<div class=\"modal-header\"><h3 class=\"modal-title\">Profile summary</h3></div>";
                    jstring += "<div class=\"modal-body profile-modal\">";
                    jstring += "<div class=\"module profile-card component profile-header\">";

                    try
                    {
                        jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('" + item["cover"]["source"] + "');\">";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('https://pbs.twimg.com/profile_banners/215936249/1371721359');\">";
                    }
                    jstring += "<div class=\"profile-header-inner-overlay\"></div>";
                    jstring += "<a class=\"profile-picture media-thumbnail js-nav\" href=\"#\"><img class=\"avatar size73\" alt=\"" + item["name"] + "\" src=\"http://graph.facebook.com/" + item["id"] + "/picture?type=small\" /></a>";
                    jstring += "<div class=\"profile-card-inner\">";
                    jstring += "<h1 class=\"fullname editable-group\">";
                    try
                    {
                        jstring += "<a href=\"#\" class=\"js-nav\">" + item["name"] + "</a>";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    jstring += "<a class=\"verified-link js-tooltip\" href=\"#\"><span class=\"icon verified verified-large-border\"><span class=\"visuallyhidden\"></span> </span></a>";
                    jstring += "</h1>";
                    try
                    {
                        jstring += "<h2 class=\"username\"><a href=\"#\" class=\"pretty-link js-nav\"><span class=\"screen-name\"><s>@</s>" + item["username"] + "</span> </a></h2>";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    jstring += "<div class=\"bio-container editable-group\"><p class=\"bio profile-field\">";
                    try
                    {
                        jstring += item["about"];
                    }
                    catch (Exception ex) { logger.Error(ex.Message); }

                    jstring += "</p></div>";
                    jstring += "<p class=\"location-and-url\">";
                    jstring += "<span class=\"location-container editable-group\"><span class=\"location profile-field\"></span></span>";
                    jstring += "<span class=\"divider hidden\"></span> ";
                    jstring += "<span class=\"url editable-group\">  <span class=\"profile-field\"><a title=\"#\" href=\"http://www.facebook.com/" + item["id"] + "\" rel=\"me nofollow\" target=\"_blank\">" + item["link"] + " </a>";
                    jstring += "<div style=\"cursor: pointer; width: 16px; height: 16px; display: inline-block;\">&nbsp;</div>";
                    jstring += "</span></span></p></div></div>";
                    jstring += "<div class=\"clearfix\">";
                    jstring += "<div class=\"default-footer\">";

                    jstring += "<div class=\"btn-group\">" +
                                  "<div class=\"follow_button\">" +

                                      //"<span class=\"button-text following-text\">Following</span>" +
                        //"<span class=\"button-text unfollow-text\">Unfollow</span>" +
                                  "</div>" +
                               "</div>";
                    jstring += "</div></div>";
                    jstring += "<div class=\"profile-social-proof\"><div class=\"follow-bar\"></div></div></div>";
                    jstring += "<ol class=\"recent-tweets\">" +
                                  "<li class=\"\">" +
                                      "<div>" +
                                        "<i class=\"dogear\"></i>" +

                                      "</div>" +
                                  "</li>" +
                              "</ol>" +
                              "<div class=\"go_to_profile\">" +
                                  "<small><a href=\"http://www.facebook.com/" + item["id"] + "\" target=\"_blank\" class=\"view_profile\">Go to full profile →</a></small>" +
                              "</div>" +
                          "</div>" +
                          "<div class=\"loading\">" +
                              "<span class=\"spinner-bigger\"></span>" +
                          "</div>" +
                      "</div>";
                    jstring += "</div>";

                    Response.Write(jstring);

                }
            }
        }
Пример #14
0
 public bool CheckTwitterToken(oAuthTwitter objoAuthTwitter, string txtvalue)
 {
     bool CheckTwitterToken = false;
     //oAuthTwitter oAuthTwt = new oAuthTwitter();
     Users twtUser = new Users();
     try
     {
         JArray twtuserjson = twtUser.Get_Users_Search(objoAuthTwitter, txtvalue, "5");
         CheckTwitterToken = true;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     return CheckTwitterToken;
 }
Пример #15
0
    /// <summary>
 /// Blocks the specified user from following the authenticating user.
 /// </summary>
 /// <param name="oAuth"></param>
 /// <param name="user_id"></param>
 /// <returns></returns>
 public JArray PostBlocks_Destroy(oAuthTwitter oAuth, string user_id)
 {
     Users objUser = new Users();
     JArray jarrUser = new JArray();
     jarrUser = objUser.Post_Blocks_Destroy(oAuth, user_id);
     return jarrUser;
 }
Пример #16
0
 /// <summary>
 /// Returns an HTTP 200 OK response code and a representation of the requesting user if authentication was successful; 
 /// </summary>
 /// <param name="oAuth"></param>
 /// <returns></returns>
 public JArray GetAccount_Verify_Credentials(oAuthTwitter oAuth)
 {
     Users objUser = new Users();
     JArray jarrUser = new JArray();
     jarrUser = objUser.Get_Account_Verify_Credentials(oAuth);
     return jarrUser;
 }
Пример #17
0
 /// <summary>
 ///Returns fully-hydrated user objects for up to 100 users per request, as specified by comma-separated values passed to the screen_name
 /// </summary>
 /// <param name="oAuth"></param>
 /// <returns></returns>
 public JArray GetUsers_LookUp_ScreenName(oAuthTwitter oAuth, string screen_name)
 {
     Users objUser = new Users();
     JArray jarrUser = new JArray();
     jarrUser = objUser.Get_Users_LookUp_ByScreenName(oAuth, screen_name);
     return jarrUser;
 }
Пример #18
0
 /// <summary>
 /// Updates the authenticating user's settings.
 /// </summary>
 /// <param name="oAuth"></param>
 /// <param name="trend_location_woeid">The Yahoo! Where On Earth ID to use as the user's default trend location. Global information is available by using 1 as the WOEID.</param>
 /// <param name="sleep_time_enabled">When set to true, t or 1, will enable sleep time for the user.</param>
 /// <param name="start_sleep_time">The hour that sleep time should begin if it is enabled.</param>
 /// <param name="end_sleep_time">The hour that sleep time should end if it is enabled.</param>
 /// <param name="time_zone">The timezone dates and times should be displayed in for the user.</param>
 /// <param name="lang">The language which Twitter should render in for this user. </param>
 /// <returns></returns>
 public JArray PostAccount_Settings(oAuthTwitter oAuth, string trend_location_woeid, string sleep_time_enabled, string start_sleep_time, string end_sleep_time, string time_zone, string lang)
 {
     Users objUser = new Users();
     JArray jarrUser = new JArray();
     jarrUser = objUser.Post_Account_Settings(oAuth,trend_location_woeid,sleep_time_enabled,start_sleep_time,end_sleep_time,time_zone,lang);
     return jarrUser;
 }  
Пример #19
0
   /// <summary>
 ///Returns a collection of users who can contribute to the specified account.
 /// </summary>
 /// <param name="oAuth"></param>
 /// <returns></returns>
 public JArray GetUsers_Contributors(oAuthTwitter oAuth, string user_id)
 {
     Users objUser = new Users();
     JArray jarrUser = new JArray();
     jarrUser = objUser.Get_Users_Contributors(oAuth, user_id);
     return jarrUser;
 }
Пример #20
0
 /// <summary>
 /// Sets which device Twitter delivers updates to for the authenticating user.
 /// </summary>
 /// <param name="oAuth"></param>
 /// <param name="device">Must be one of: sms, none.</param>
 /// <returns></returns>
 public JArray PostAccount_Update_Delivery_Device(oAuthTwitter oAuth, string device)
 {
     Users objUser = new Users();
     JArray jarrUser = new JArray();
     jarrUser = objUser.Post_Account_Update_Delivery_Device(oAuth,device);
     return jarrUser;
 }
Пример #21
0
      /// <summary>
    /// Uploads a profile banner on behalf of the authenticating user.
    /// If providing any one of the height, width, offset_left, or offset_top parameters, you must provide all of the sizing parameters
 /// </summary>
 /// <param name="oAuth"></param>
 /// <param name="banner"></param>
 /// <param name="height"></param>
 /// <param name="width"></param>
 /// <param name="offset_left"></param>
 /// <param name="offset_top"></param>
 /// <returns></returns>
    public string PostAccount_Update_Profile_Banner(oAuthTwitter oAuth, string banner, int height, int width, string offset_left, string offset_top)
    {
        Users objUser = new Users();
        string jarrUser = objUser.Post_Account_Update_Profile_Banner(oAuth,banner,height,width,offset_left,offset_top);
        return jarrUser;
    }
Пример #22
0
 /// <summary>
 /// Sets values that users are able to set under the "Account" tab of their settings page. 
 /// </summary>
 /// <param name="oAuth"></param>
 /// <param name="name">Full name associated with the profile. Maximum of 20 characters.</param>
 /// <param name="url">URL associated with the profile. Will be prepended with "http://" if not present. </param>
 /// <param name="location">The city or country describing where the user of the account is located.</param>
 /// <param name="description">A description of the user owning the account. Maximum of 160 characters.</param>
 /// <param name="include_entities">The entities node will not be included when set to false.</param>
 /// <param name="skip_status">When set to either true, t or 1 statuses will not be included in the returned user objects.</param>
 /// <returns></returns>
 public JArray PostAccount_Update_Profile(oAuthTwitter oAuth, string name, string url, string location, string description, bool include_entities, bool skip_status)
 {
     Users objUser = new Users();
     JArray jarrUser = new JArray();
     jarrUser = objUser.Post_Account_Update_Profile(oAuth,name,url,location,description,include_entities,skip_status);
     return jarrUser;
 }
Пример #23
0
        void ProcessRequest()
        {
            if (!string.IsNullOrEmpty(Request.QueryString["op"]))
            {
                if (Request.QueryString["op"] == "removedata")
                {

                    string network = Request.QueryString["network"];
                    string message = string.Empty;
                    var users = Request.QueryString["data[]"];
                    Messages mstable = new Messages();
                    DataSet ds = DataTableGenerator.CreateDataSetForTable(mstable);
                    DataTable dtt = ds.Tables[0];
                    string page = Request.QueryString["page"];
                    if (page == "feed")
                    {
                        AjaxFeed ajxfed = new AjaxFeed();
                        DataTable dt = null;
                        if (network == "facebook")
                        {
                            dt = (DataTable)Session["FacebookFeedDataTable"];
                        }
                        else if (network == "twitter")
                        {
                            dt = (DataTable)Session["TwitterFeedDataTable"];
                        }
                        else if (network == "linkedin")
                        {
                            dt = (DataTable)Session["LinkedInFeedDataTable"];
                        }

                        foreach (var parent in users)
                        {
                            DataView dv = new DataView(dtt);
                            DataRow[] foundRows = dt.Select("ProfileId = '" + parent + "'");
                            foreach (var child in foundRows)
                            {
                                dtt.ImportRow(child);
                            }
                        }
                        message = ajxfed.BindData(dtt);

                    }

                    else if (page == "message")
                    {
                        WooSuite.Message.AjaxMessage ajxmes = new WooSuite.Message.AjaxMessage();
                        DataSet dss = (DataSet)Session["MessageDataTable"];
                        //foreach (var parent in users)
                        //{
                        DataView dv = new DataView(dtt);
                        DataRow[] foundRows = dss.Tables[0].Select("ProfileId = '" + users + "'");
                        foreach (var child in foundRows)
                        {
                            dtt.ImportRow(child);
                        }

                        //}
                        message = ajxmes.BindData(dtt);
                    }
                    Response.Write(message);
                }
                else if (Request.QueryString["op"] == "upgradeplan")
                {
                    User user = (User)Session["LoggedUser"];
                    UserRepository userRepo = new UserRepository();
                    string accounttype = Request.QueryString["planid"];
                    if (accounttype == AccountType.Deluxe.ToString().ToLower())
                    {
                        userRepo.UpdateAccountType(user.Id, AccountType.Deluxe.ToString());
                        user.AccountType = AccountType.Deluxe.ToString();
                    }
                    else if (accounttype == AccountType.Standard.ToString().ToLower())
                    {
                        userRepo.UpdateAccountType(user.Id, AccountType.Standard.ToString());
                        user.AccountType = AccountType.Standard.ToString();
                    }
                    else if (accounttype == AccountType.Premium.ToString().ToLower())
                    {
                        userRepo.UpdateAccountType(user.Id, AccountType.Premium.ToString());
                        user.AccountType = AccountType.Premium.ToString();
                    }
                    Session["LoggedUser"] = user;

                }
                else if (Request.QueryString["op"] == "bindrssActive")
                {
                    User user = (User)Session["LoggedUser"];
                    RssFeedsRepository rssFeedsRepo = new RssFeedsRepository();
                    List<RssFeeds> lstrssfeeds = rssFeedsRepo.getAllActiveRssFeeds(user.Id);
                    TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository();
                    if (lstrssfeeds != null)
                    {
                        if (lstrssfeeds.Count != 0)
                        {
                            int rssCount = 0;
                            string rssData = string.Empty;
                            rssData += "<h2 class=\"league section-ttl rss_header\">Active RSS Feeds</h2>";
                            foreach (RssFeeds item in lstrssfeeds)
                            {
                                TwitterAccount twtAccount = twtAccountRepo.getUserInformation(item.ProfileScreenName, user.Id);
                                string picurl = string.Empty;

                                if (string.IsNullOrEmpty(twtAccount.ProfileUrl))
                                {
                                    picurl = "../Contents/img/blank_img.png";

                                }
                                else
                                {
                                    picurl = twtAccount.ProfileUrl;

                                }
                                rssData +=

                                   " <section id=\"" + item.Id + "\" class=\"publishing\">" +
                                        "<section class=\"twothird\">" +
                                            "<article class=\"quarter\">" +
                                                "<div href=\"#\" class=\"avatar_link view_profile\" title=\"\">" +
                                                    "<img title=\"" + item.ProfileScreenName + "\" src=\"" + picurl + "\" data-src=\"\" class=\"avatar sm\">" +
                                                    "<article class=\"rss_ava_icon\"><span title=\"Twitter\" class=\"icon twitter_16\"></span></article>" +
                                                "</div>" +
                                            "</article>" +
                                            "<article class=\"threefourth\">" +
                                                "<ul>" +
                                                    "<li>" + item.FeedUrl + "</li>" +
                                                    "<li>Prefix: </li>" +
                                                    "<li class=\"freq\" title=\"New items from this feed will be posted at most once every hour\">Max Frequency: " + item.Duration + "</li>" +
                                                "</ul>" +
                                            "</article>" +
                                        "</section>" +
                                        "<section class=\"third\">" +
                                            "<ul class=\"rss_action_buttons\">" +
                                                "<li onclick=\"pauseFunction('" + item.Id + "');\" class=\"\"><a id=\"pause_" + item.Id + "\" href=\"#\" title=\"Pause\" class=\"small_pause icon pause\"></a></li>" +
                                                "<li onclick=\"deleteRssFunction('" + item.Id + "');\" class=\"show-on-hover\"><a id=\"delete_" + item.Id + "\" href=\"#\" title=\"Delete\" class=\"small_remove icon delete\"></a></li>" +
                                            "</ul>" +
                                        "</section>" +
                                     "</section>";
                            }
                            Response.Write(rssData);
                        }
                    }

                }

                else if (Request.QueryString["op"] == "savedrafts")
                {
                    Guid Id = Guid.Parse(Request.QueryString["id"]);
                    string newstr = Request.QueryString["newstr"];
                    DraftsRepository draftsRepo = new DraftsRepository();
                    draftsRepo.UpdateDrafts(Id, newstr);

                }
                else if (Request.QueryString["op"] == "getTwitterUserTweets")
                {
                    UrlExtractor urlext = new UrlExtractor();
                    User user = (User)Session["LoggedUser"];
                    string userid = Request.QueryString["profileid"];
                    TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository();
                    ArrayList alst = twtAccountRepo.getAllTwitterAccountsOfUser(user.Id);
                    oAuthTwitter oauth = new oAuthTwitter();
                    foreach (TwitterAccount childnoe in alst)
                    {
                        oauth.AccessToken = childnoe.OAuthToken;
                        oauth.AccessTokenSecret = childnoe.OAuthSecret;
                        oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
                        oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
                        oauth.TwitterUserId = childnoe.TwitterUserId;
                        oauth.TwitterScreenName = childnoe.TwitterScreenName;
                        break;
                    }

                    TimeLine timeLine = new TimeLine();

                    //need to be implement waiting for design
                    string mes = string.Empty;
                    JArray userlookup = timeLine.Get_Statuses_User_Timeline(oauth,userid);
                    string jstring = string.Empty;
                    int i = 0;
                    foreach (var item in userlookup)
                    {

                        if (i < 2)
                        {
                            string[] str = urlext.splitUrlFromString(item["text"].ToString());
                            mes += "<li class=\"\">" +
                                              "<div class=\"twtcommands\">" +
            "<a class=\"account-group\">" +
                "<img class=\"avatar\" alt=\"\" src=\"" + item["user"]["profile_image_url"] + "\" alt=\"\" />" +
            "</a>" +
            "<div class=\"stream-item-header\">" +
                "<div class=\"user-details\">" +
                    "<strong class=\"fullname\">" + item["user"]["name"] + "</strong>" +
                    "<span class=\"username\">" +
                        "<s>@</s>" +
                        "<b>" + item["screen_name"] + "</b>" +
                    "</span>" +
                    "<small class=\"time\"></small>" +
                "</div><p class=\"tweet-text\">";

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

                            //item["text"] " +
                            //"<a target=\"_blank\" class=\"twitter-timeline-link\" href=\"#\" f69e857af67d2c=\"true\">" +
                            //    "<span class=\"tco-ellipsis\"></span>" +
                            //    "<span class=\"invisible\">http://</span>" +
                            //    "<span class=\"js-display-url\">ow.ly/o4o7l</span>" +
                            //    "<span class=\"invisible\"></span>" +
                            //    "<span class=\"tco-ellipsis\"><span class=\"invisible\">&nbsp;</span></span>" +
                            //"</a>

                            mes += "</p>" +
                                 "<div class=\"details\">" +
                                     "<a class=\"stream_details\"></a>" +
                                 "</div>" +
                             "</div>" +
                       "</div>" +
                                                           "</li>";
                            i++;
                        }
                        else {
                            break;
                        }
                    }
                    Response.Write(mes);

                }
                else if (Request.QueryString["op"] == "saveWooQueue")
                {
                    Guid Id = Guid.Parse(Request.QueryString["id"]);
                    string profileid = Request.QueryString["profid"];
                    string message = Request.QueryString["message"];
                    string network = Request.QueryString["network"];
                    string net = string.Empty;

                    if (network == "fb")
                    {
                        net = "facebook";
                    }
                    else if (network == "twt")
                    {
                        net = "twitter";

                    }
                    else if (network == "lin")
                    {
                        net = "linkedin";
                    }
                    ScheduledMessageRepository schmsgRepo = new ScheduledMessageRepository();
                    schmsgRepo.UpdateProfileScheduleMessage(Id, profileid, message, net);

                }
                else if (Request.QueryString["op"] == "saveRss")
                {
                    try
                    {
                        User user = (User)Session["LoggedUser"];
                        RssFeedsRepository objRssFeedRepo = new RssFeedsRepository();
                        RssFeeds objRssFeeds = new RssFeeds();
                        objRssFeeds.ProfileScreenName = Request.QueryString["user"];
                        objRssFeeds.FeedUrl = Request.QueryString["feedsurl"];
                        objRssFeeds.UserId = user.Id;
                        objRssFeeds.Status = false;
                        objRssFeeds.Message = Request.QueryString["message"];
                        objRssFeeds.Duration = Request.QueryString["duration"];
                        objRssFeeds.CreatedDate = DateTime.Now;
                        objRssFeedRepo.AddRssFeed(objRssFeeds);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        Console.WriteLine(ex.Message);
                    }
                }
                else if (Request.QueryString["op"] == "deletewooqueuemessage")
                {
                    try
                    {
                        Guid id = Guid.Parse(Request.QueryString["id"]);
                        ScheduledMessageRepository schmsgRepo = new ScheduledMessageRepository();
                        schmsgRepo.deleteMessage(id);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }
                }
                else if (Request.QueryString["op"] == "chkrssurl")
                {
                    try
                    {
                        string url = Request.QueryString["url"];
                        var facerequest = (HttpWebRequest)WebRequest.Create(url);
                        facerequest.Method = "GET";
                        string outputface = string.Empty;
                        using (var response = facerequest.GetResponse())
                        {
                            using (var stream = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(1252)))
                            {
                                outputface = stream.ReadToEnd();
                                if (outputface.Contains("<rss version=\"2.0\""))
                                {
                                    Response.Write("true");
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        Console.WriteLine(ex.Message);
                        Response.Write("Error");
                    }

                }
                else if (Request.QueryString["op"] == "rssusers")
                {
                    try
                    {
                        User user = (User)Session["LoggedUser"];
                        TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                        ArrayList alst = twtAccRepo.getAllTwitterAccountsOfUser(user.Id);
                        string message = string.Empty;
                        foreach (TwitterAccount item in alst)
                        {
                            message += "<option value=\"" + item.TwitterScreenName + "\">@" + item.TwitterScreenName + "</option>";
                        }
                        Response.Write(message);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        Console.WriteLine(ex.Message);
                    }

                }
                else if (Request.QueryString["op"] == "searchkeyword")
                {
                    User user = (User)Session["LoggedUser"];
                    DiscoverySearchRepository disrepo = new DiscoverySearchRepository();
                    List<string> alst = disrepo.getAllSearchKeywords(user.Id);
                    string message = string.Empty;

                    foreach (var item in alst)
                    {
                        message += "<li onclick=\"getSearchResults('" + item + "');\"><a href=\"#\"><i class=\"show icon-caret-right\" style=\"visibility:visible;margin-right:5px\"></i>" + item + "</a></li>";
                    }
                    Response.Write(message);

                }
                else if (Request.QueryString["op"] == "getResults")
                {
                    string type = Request.QueryString["type"];
                    string key = Request.QueryString["keyword"];
                    Discovery discoverypage = new Discovery();
                    string search = discoverypage.getresults(key);
                    string message = "<ul id=\"message-list\">" + search + "</ul>";
                    Response.Write(message);
                }
                else if (Request.QueryString["op"] == "getFollowers")
                {
                    User user = (User)Session["LoggedUser"];
                    Users twtUser = new Users();
                    oAuthTwitter oauth = new oAuthTwitter();
                    TwitterAccountRepository TwtAccRepo = new TwitterAccountRepository();
                    TwitterAccount TwtAccount = TwtAccRepo.getUserInformation(user.Id, Request.QueryString["id"]);
                    oauth.AccessToken = TwtAccount.OAuthToken;
                    oauth.AccessTokenSecret = TwtAccount.OAuthSecret;
                    oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
                    oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
                    oauth.TwitterScreenName = TwtAccount.TwitterScreenName;
                    oauth.TwitterUserId = TwtAccount.TwitterUserId;
                    JArray response = twtUser.Get_Followers_ById(oauth, Request.QueryString["id"]);

                    string jquery = string.Empty;

                    foreach (var item in response)
                    {
                        if (item["ids"] != null)
                        {
                            foreach (var child in item["ids"])
                            {
                                JArray userprofile = twtUser.Get_Users_LookUp(oauth, child.ToString());
                                foreach (var items in userprofile)
                                {

                                    try
                                    {

                                        jquery += "<li class=\"shadower\">" +
                                              "<div class=\"disco-feeds\">" +
                                                  "<div class=\"star-ribbon\"></div>" +
                                                  "<div class=\"disco-feeds-img\">" +
                                                      "<img alt=\"\" src=\"" + items["profile_image_url"] + "\" style=\"height: 100px; width: 100px;\" class=\"pull-left\">" +
                                                  "</div>" +
                                                  "<div class=\"disco-feeds-content\">" +
                                                      "<div class=\"disco-feeds-title\">" +
                                                          "<h3 class=\"no-margin\">" + items["name"] + "</h3>" +
                                                          "<span>@" + items["screen_name"] + "</span>" +
                                                      "</div>" +
                                                      "<p>";

                                        try
                                        {
                                            jquery += items["status"]["text"];
                                        }
                                        catch (Exception ex)
                                        {
                                            logger.Error(ex.Message);
                                        }

                                        jquery += "</p>" +
                                            //"<a href=\"#\" class=\"btn\">Hide</a>" +
                                          "<a href=\"#\" onclick=\"detailsprofile('" + items["id_str"] + "')\" class=\"btn\">Full Profile <i class=\"icon-caret-right\"></i> </a><div class=\"scl\">" +
                                          "<a href=\"#\"><img alt=\"\" src=\"../Contents/img/admin/usergrey.png\"></a>" +
                                          "<a href=\"#\"><img alt=\"\" src=\"../Contents/img/admin/goto.png\"></a>" +
                                          "<a href=\"#\"><img alt=\"\" src=\"../Contents/img/admin/setting.png\"></a>" +
                                      "</div></div></div>" +
                                  "<div class=\"disco-feeds-info\">" +
                                      "<ul class=\"no-margin\">" +
                                          "<li><a href=\"#\"><img src=\"../Contents/img/admin/markerbtn2.png\" alt=\"\">";

                                        if (!string.IsNullOrEmpty(items["time_zone"].ToString()))
                                        {
                                            jquery += items["time_zone"];
                                        }
                                        else
                                        {
                                            jquery += "Not Specific";
                                        }
                                        jquery += "</a></li>";

                                        if (string.IsNullOrEmpty(items["url"].ToString()))
                                        {
                                            jquery += "<li><a href=\"#\"><img src=\"../Contents/img/admin/url.png\" alt=\"\">";
                                            jquery += "Not Specific";
                                        }
                                        else
                                        {
                                            jquery += "<li><a target=\"_blank\" href=\"" + items["url"] + "\"><img src=\"../Contents/img/admin/url.png\" alt=\"\">";
                                            jquery += items["url"];
                                        }
                                        jquery += "</a></li></ul>" +
                                        "<ul class=\"no-margin\" style=\"margin-top:20px\">" +
                                            "<li><a href=\"#\"><img src=\"../Contents/img/admin/twittericon-white.png\" alt=\"\">Followers <big><b>" + items["followers_count"] + "</b></big></a></li>" +
                                            "<li><a href=\"#\"><img src=\"../Contents/img/admin/twitter-white.png\" alt=\"\">Following <big><b>" + items["friends_count"] + "</b></big></a></li>" +
                                            "</ul>" +
                                    "</div>" +
                                "</li>";

                                        #region old
                                        //            jquery += "<div class=\"wentbg\">" +
                                        //                          "<div class=\"over\">" +
                                        //                            "<div class=\"topicon\">" +
                                        //                //"<a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/manplus.png\"></a>" +
                                        //                //"<a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/replay.png\"></a>" +
                                        //                //"<a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/setting.png\"></a>" +
                                        //                            "</div>" +
                                        //                                  "<div class=\"botombtn\">" +
                                        //                              "<div class=\"clickbtn\"><a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/full_profile.png\" onclick=\"detailsprofile('" + items["id_str"] + "')\"></a></div>" +
                                        //                            "</div>" +
                                        //                            "</div>" +
                                        //                                   "<div class=\"wentbgf\"><img alt=\"\" src=\"" + items["profile_image_url"] + "\"></div>" +

                                        //                                            "<div class=\"wentbgtext\">" +
                                        //"<span class=\"heading\">\"" + items["name"] + "\"</span> <span>@\"" + items["screen_name"] + "\"</span>" +
                                        //"<div class=\"viegil\">\"" + items["status"]["text"] + "\"</div>" +

                                        //            "<div class=\"avenue\">" +
                                        //             "<img alt=\"\" src=\"../Contents/img/avenue.png\">" +
                                        //             "<div class=\"avenuetext\">\"" + items["time_zone"] + "\"</div>" +
                                        //              "<img class=\"link\" alt=\"\" src=\"../Contents/img/url.png\">" +
                                        //             "<div class=\"nourl\">No URL</div>" +
                                        //         "</div>";

                                        //            jquery += "<div class=\"followerbg\">" +
                                        //                     "<div class=\"follower\">Followers <span>\"" + items["followers_count"] + "\"</span></div>" +
                                        //                     "<div class=\"following\">Friends <span>\"" + items["friends_count"] + "\"</span></div>" +
                                        //                  "</div>" +
                                        //              "</div>" +
                                        //          "</div>";
                                        #endregion
                                    }
                                    catch (Exception ex)
                                    {
                                        logger.Error(ex.Message);
                                        Console.WriteLine(ex.Message);
                                    }
                                }
                            }
                        }
                        else
                        {
                            jquery += "None of the User Is Following";
                        }

                    }

                    Response.Write(jquery);
                }
                else if (Request.QueryString["op"] == "deletedrafts")
                {
                    Guid id = Guid.Parse(Request.QueryString["id"]);
                    DraftsRepository draftsRepo = new DraftsRepository();
                    draftsRepo.DeleteDrafts(id);

                }
                else if (Request.QueryString["op"] == "usersearchresults")
                {
                    ArrayList alstallusers = null;
                    if (Session["AllUserList"] == null)
                    {
                        User user = (User)Session["LoggedUser"];
                        alstallusers = new ArrayList();

                        /*facebook*/
                        try
                        {
                            FacebookAccountRepository faceaccount = new FacebookAccountRepository();
                            ArrayList lstfacebookaccount = faceaccount.getAllFacebookAccountsOfUser(user.Id);
                            foreach (FacebookAccount item in lstfacebookaccount)
                            {
                                alstallusers.Add(item.FbUserName + "_fb_" + item.FbUserId);
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }

                        /*twitter*/
                        try
                        {
                            TwitterAccountRepository twtAccountrepo = new TwitterAccountRepository();
                            ArrayList lsttwitteraccount = twtAccountrepo.getAllTwitterAccountsOfUser(user.Id);

                            foreach (TwitterAccount item in lsttwitteraccount)
                            {
                                alstallusers.Add(item.TwitterScreenName + "_twt_" + item.TwitterUserId);
                            }

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

                        /*linkedin*/
                        try
                        {
                            LinkedInAccountRepository linkedinaccountrepo = new LinkedInAccountRepository();
                            ArrayList lstaccount = linkedinaccountrepo.getAllLinkedinAccountsOfUser(user.Id);

                            foreach (LinkedInAccount item in lstaccount)
                            {
                                alstallusers.Add(item.LinkedinUserName + "_lin_" + item.LinkedinUserId);
                            }

                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }
                        /*instagram*/
                        try
                        {
                            InstagramAccountRepository instaaccrepo = new InstagramAccountRepository();
                            ArrayList lstinstagramaccount = instaaccrepo.getAllInstagramAccountsOfUser(user.Id);
                            foreach (InstagramAccount item in lstinstagramaccount)
                            {
                                alstallusers.Add(item.InsUserName + "_ins_" + item.InstagramId);
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }

                        ///*googleplus*/
                        try
                        {
                            GooglePlusAccountRepository gpaccountrepo = new GooglePlusAccountRepository();
                            ArrayList lstgpaccount = gpaccountrepo.getAllGooglePlusAccountsOfUser(user.Id);
                            foreach (GooglePlusAccount item in lstgpaccount)
                            {
                                alstallusers.Add(item.GpUserName + "_gp_" + item.GpUserId);
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }

                        Session["AllUserList"] = alstallusers;
                    }
                    else
                    {
                        alstallusers = (ArrayList)Session["AllUserList"];
                    }

                }
                else if (Request.QueryString["op"] == "searchingresults")
                {
                    string txtvalue = Request.QueryString["txtvalue"];
                    string message = string.Empty;
                    if (!string.IsNullOrEmpty(txtvalue))
                    {
                        ArrayList alstall = (ArrayList)Session["AllUserList"];

                        if (alstall.Count != 0)
                        {
                            foreach (string item in alstall)
                            {
                                if (item.ToLower().StartsWith(txtvalue))
                                {
                                    string[] nametype = item.Split('_');

                                    if (nametype[1] == "fb")
                                    {
                                        message += "<div  class=\"btn srcbtn\">" +
                                                        "<img width=\"15\" src=\"../Contents/img/facebook.png\" alt=\"\">" +
                                                  "<span onclick=\"getFacebookProfiles('" + nametype[2] + "')\">" + nametype[0] + "</span>" +
                                                   "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                   "</div>";
                                    }
                                    else if (nametype[1] == "twt" || item.Contains("_twt_"))
                                    {
                                        if (nametype.Count() < 4)
                                        {
                                            message += "<div class=\"btn srcbtn\">" +
                                                          "<img width=\"15\" src=\"../Contents/img/twticon.png\" alt=\"\">" +
                                                            " <span onclick=\"detailsprofile('" + nametype[0] + "');\">" + nametype[0] + "</span>" +
                                                     "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                             "</div>";
                                        }
                                        else
                                        {
                                            string[] containstwitter = item.Split(new string[] { "_twt_" }, StringSplitOptions.None);

                                            message += "<div  class=\"btn srcbtn\">" +
                                                             "<img width=\"15\" src=\"../Contents/img/twticon.png\" alt=\"\">" +
                                                                "<span onclick=\"detailsprofile('" + containstwitter[0] + "');\"> " + containstwitter[0] + "</span>" +
                                                        "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                                "</div>";

                                        }
                                    }
                                    else if (nametype[1] == "ins")
                                    {
                                        message += "<div class=\"btn srcbtn\">" +
                                                      "<img width=\"15\" src=\"../Contents/img/instagram_24X24.png\" alt=\"\">" +
                                                 nametype[0] +
                                                 "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                 "</div>";
                                    }
                                    else if (nametype[1] == "lin")
                                    {
                                        message += "<div class=\"btn srcbtn\">" +
                                                      "<img width=\"15\" src=\"../Contents/img/link_icon.png\" alt=\"\">" +
                                                 nametype[0] +
                                                 "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                 "</div>";
                                    }
                                    else if (nametype[1] == "gp")
                                    {
                                        message += "<div class=\"btn srcbtn\">" +
                                                          "<img width=\"15\" src=\"../Contents/img/google_plus.png\" alt=\"\">" +
                                                     nametype[0] +
                                                     "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                     "</div>";

                                    }
                                }

                            }
                        }
                        else
                        {
                            message += "<div class=\"btn srcbtn\">" +
                                                  "<img width=\"15\" src=\"../Contents/img/norecord.png\" alt=\"\">" +
                                             "No Records Found" +
                                             "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                             "</div>";

                        }

                        message += "<div class=\"socailtile\">Twitter</div>";

                        /*twitter contact search */

                        #region twitter contact search
                        try
                        {
                            User user = (User)Session["LoggedUser"];
                            Users twtUser = new Users();
                            oAuthTwitter oAuthTwt = new oAuthTwitter();
                            if (Session["oAuthUserSearch"] == null)
                            {
                                oAuthTwitter oauth = new oAuthTwitter();
                                oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"].ToString();
                                oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"].ToString();
                                oauth.CallBackUrl = ConfigurationManager.AppSettings["callbackurl"].ToString();
                                TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                                ArrayList alst = twtAccRepo.getAllTwitterAccountsOfUser(user.Id);
                                foreach (TwitterAccount item in alst)
                                {
                                    oauth.AccessToken = item.OAuthToken;
                                    oauth.AccessTokenSecret = item.OAuthSecret;
                                    oauth.TwitterUserId = item.TwitterUserId;
                                    oauth.TwitterScreenName = item.TwitterScreenName;
                                    break;
                                }
                                Session["oAuthUserSearch"] = oauth;
                                oAuthTwt = oauth;
                            }
                            else
                            {
                                oAuthTwitter oauth = (oAuthTwitter)Session["oAuthUserSearch"];
                                oAuthTwt = oauth;
                            }

                            JArray twtuserjson = twtUser.Get_Users_Search(oAuthTwt, txtvalue, "5");

                            foreach (var item in twtuserjson)
                            {
                                message += "<div class=\"btn srcbtn\">" +
                                                         "<img width=\"15\" src=\"../Contents/img/twticon.png\" alt=\"\">" +
                                                           " <span> " + item["screen_name"].ToString().TrimStart('"').TrimEnd('"') + "</span>" +
                                                    "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                            "</div>";
                            }

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

                        #endregion

                        message += "<div class=\"socailtile\">Facebook</div>";

                        #region Facebook Contact search
                        try
                        {
                            string accesstoken = string.Empty;
                            FacebookAccountRepository facebookaccrepo = new FacebookAccountRepository();
                            ArrayList alstfacbookusers = facebookaccrepo.getAllFacebookAccounts();

                            foreach (FacebookAccount item in alstfacbookusers)
                            {
                                accesstoken = item.AccessToken;
                                break;
                            }

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

                            JArray facebookSearchResult = JArray.Parse(outputface);

                            foreach (var item in facebookSearchResult)
                            {
                                var data = item["data"];
                                foreach (var chlid in data)
                                {
                                    message += "<div  class=\"btn srcbtn\">" +
                                                        "<img width=\"15\" src=\"../Contents/img/facebook.png\" alt=\"\">" +
                                                  "<span >" + chlid["name"] + "</span>" +
                                                   "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" +
                                                   "</div>";
                                }

                            }

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

                        Response.Write(message);
                    }
                }
                else if (Request.QueryString["op"] == "getTwitterUserDetails")
                {
                    User user = (User)Session["LoggedUser"];
                    string userid = Request.QueryString["profileid"];
                    TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository();
                    ArrayList alst = twtAccountRepo.getAllTwitterAccountsOfUser(user.Id);
                    oAuthTwitter oauth = new oAuthTwitter();
                    foreach (TwitterAccount childnoe in alst)
                    {
                        oauth.AccessToken = childnoe.OAuthToken;
                        oauth.AccessTokenSecret = childnoe.OAuthSecret;
                        oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
                        oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
                        oauth.TwitterUserId = childnoe.TwitterUserId;
                        oauth.TwitterScreenName = childnoe.TwitterScreenName;
                        break;
                    }

                    Users userinfo = new Users();
                    //JArray foll = userinfo.Get_Followers_ById(oauth, userid);
                    JArray userlookup = userinfo.Get_Users_LookUp(oauth, userid);
                    string jstring = string.Empty;
                    foreach (var item in userlookup)
                    {
                        jstring += "<div class=\"modal-small draggable\">";
                        jstring += "<div class=\"modal-content\">";
                        jstring += "<button class=\"modal-btn button b-close\" type=\"button\">";
                        jstring += "<span class=\"icon close-medium\"><span class=\"visuallyhidden\">X</span></span></button>";
                        jstring += "<div class=\"modal-header\"><h3 class=\"modal-title\">Profile summary</h3></div>";
                        jstring += "<div class=\"modal-body profile-modal\">";
                        jstring += "<div class=\"module profile-card component profile-header\">";
                        jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('" + item["profile_banner_url"] + "');\">";
                        jstring += "<div class=\"profile-header-inner-overlay\"></div>";
                        jstring += "<a class=\"profile-picture media-thumbnail js-nav\" href=\"#\"><img class=\"avatar size73\" alt=\"" + item["name"] + "\" src=\"" + item["profile_image_url"] + "\" /></a>";
                        jstring += "<div class=\"profile-card-inner\">";
                        jstring += "<h1 class=\"fullname editable-group\">";
                        jstring += "<a href=\"#\" class=\"js-nav\">" + item["name"] + "</a>";
                        jstring += "<a class=\"verified-link js-tooltip\" href=\"#\"><span class=\"icon verified verified-large-border\"><span class=\"visuallyhidden\"></span> </span></a>";
                        jstring += "</h1>";
                        jstring += "<h2 class=\"username\"><a href=\"#\" class=\"pretty-link js-nav\"><span class=\"screen-name\"><s>@</s>" + item["screen_name"] + "</span> </a></h2>";
                        jstring += "<div class=\"bio-container editable-group\"><p class=\"bio profile-field\">";
                        try
                        {
                            jstring += item["status"]["text"];
                        }
                        catch (Exception ex) { logger.Error(ex.Message); }

                        jstring += "</p></div>";
                        jstring += "<p class=\"location-and-url\">";
                        jstring += "<span class=\"location-container editable-group\"><span class=\"location profile-field\"></span></span>";
                        jstring += "<span class=\"divider hidden\"></span> ";
                        jstring += "<span class=\"url editable-group\">  <span class=\"profile-field\"><a title=\"#\" href=\"" + item["url"] + "\" rel=\"me nofollow\" target=\"_blank\">" + item["url"] + " </a>";
                        jstring += "<div style=\"cursor: pointer; width: 16px; height: 16px; display: inline-block;\">&nbsp;</div>";
                        jstring += "</span></span></p></div></div>";
                        jstring += "<div class=\"clearfix\">";
                        jstring += "<div class=\"default-footer\">";
                        jstring += "<ul class=\"stats js-mini-profile-stats\">" +
                            //"<li><a href=\"#\" class=\"js-nav\"><strong> 6,274</strong> Tweets </a></li>" +
                                          "<li><a href=\"#\" class=\"js-nav\"><strong>" + item["friends_count"] + "</strong> Following </a></li>" +
                                          "<li><a href=\"#\" class=\"js-nav\"><strong>" + item["followers_count"] + "</strong> Followers </a></li>";
                        jstring += "</ul>";
                        jstring += "<div class=\"btn-group\">" +
                                      "<div class=\"follow_button\">";
                        //"<span class=\"button-text follow-text\">Follow</span> " +

                        //foreach (var child in foll)
                        //{
                        //    foreach (var childItem in child["ids"])
                        //    {
                        //        string pl = childItem.ToString();
                        //    }
                        //}

                        //jstring += "<span class=\"button-text follow-text\">Following</span>";
                        //jstring += "<span class=\"button-text unfollow-text\">Unfollow</span>";

                        jstring += "</div>" +
                              "</div>";
                        jstring += "</div></div>";
                        jstring += "<div class=\"profile-social-proof\"><div class=\"follow-bar\"></div></div></div>";
                        jstring += "<ol id=\"twitterUserTweets\" class=\"recent-tweets\">" +

                                  "</ol>" +
                                  "<div class=\"go_to_profile\">" +
                                      "<small><a href=\"https://twitter.com/" + item["screen_name"] + "\" target=\"_blank\" class=\"view_profile\">Go to full profile →</a></small>" +
                                  "</div>" +
                              "</div>" +
                              "<div class=\"loading\">" +
                                  "<span class=\"spinner-bigger\"></span>" +
                              "</div>" +
                          "</div>";
                        jstring += "</div>";
                    }
                    Response.Write(jstring);
                }
                else if (Request.QueryString["op"] == "pauseRssMessage")
                {
                    Guid ID = Guid.Parse(Request.QueryString["id"]);
                    RssFeedsRepository rssRepo = new RssFeedsRepository();
                    rssRepo.updateFeedStatus("pause", ID);
                }
                else if (Request.QueryString["op"] == "deleteRssMessage")
                {
                    Guid ID = Guid.Parse(Request.QueryString["id"]);
                    RssFeedsRepository rssRepo = new RssFeedsRepository();
                    rssRepo.DeleteRssMessage(ID);
                }
                else if (Request.QueryString["op"] == "playRssMessage")
                {
                    Guid ID = Guid.Parse(Request.QueryString["id"]);
                    RssFeedsRepository rssRepo = new RssFeedsRepository();
                    rssRepo.updateFeedStatus("play", ID);
                }
                else if (Request.QueryString["op"] == "facebookProfileDetails")
                {
                    User user = (User)Session["LoggedUser"];
                    string userid = Request.QueryString["profileid"];
                    FacebookAccountRepository fbRepo = new FacebookAccountRepository();
                    ArrayList alst = fbRepo.getAllFacebookAccountsOfUser(user.Id);
                    string accesstoken = string.Empty;

                    foreach (FacebookAccount childnoe in alst)
                    {
                        accesstoken = childnoe.AccessToken;

                        break;
                    }

                    FacebookClient fbclient = new FacebookClient(accesstoken);
                    string jstring = string.Empty;
                    dynamic item = fbclient.Get(userid);

                    jstring += "<div class=\"modal-small draggable\">";
                    jstring += "<div class=\"modal-content\">";
                    jstring += "<button class=\"modal-btn button b-close\" type=\"button\">";
                    jstring += "<span class=\"icon close-medium\"><span class=\"visuallyhidden\">X</span></span></button>";
                    jstring += "<div class=\"modal-header\"><h3 class=\"modal-title\">Profile summary</h3></div>";
                    jstring += "<div class=\"modal-body profile-modal\">";
                    jstring += "<div class=\"module profile-card component profile-header\">";

                    try
                    {
                        jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('" + item["cover"]["source"] + "');\">";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('https://pbs.twimg.com/profile_banners/215936249/1371721359');\">";
                    }
                    jstring += "<div class=\"profile-header-inner-overlay\"></div>";
                    jstring += "<a class=\"profile-picture media-thumbnail js-nav\" href=\"#\"><img class=\"avatar size73\" alt=\"" + item["name"] + "\" src=\"http://graph.facebook.com/" + item["id"] + "/picture?type=small\" /></a>";
                    jstring += "<div class=\"profile-card-inner\">";
                    jstring += "<h1 class=\"fullname editable-group\">";
                    try
                    {
                        jstring += "<a href=\"#\" class=\"js-nav\">" + item["name"] + "</a>";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    jstring += "<a class=\"verified-link js-tooltip\" href=\"#\"><span class=\"icon verified verified-large-border\"><span class=\"visuallyhidden\"></span> </span></a>";
                    jstring += "</h1>";
                    try
                    {
                        jstring += "<h2 class=\"username\"><a href=\"#\" class=\"pretty-link js-nav\"><span class=\"screen-name\"><s>@</s>" + item["username"] + "</span> </a></h2>";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    jstring += "<div class=\"bio-container editable-group\"><p class=\"bio profile-field\">";
                    try
                    {
                        jstring += item["about"];
                    }
                    catch (Exception ex) { logger.Error(ex.Message); }

                    jstring += "</p></div>";
                    jstring += "<p class=\"location-and-url\">";
                    jstring += "<span class=\"location-container editable-group\"><span class=\"location profile-field\"></span></span>";
                    jstring += "<span class=\"divider hidden\"></span> ";
                    jstring += "<span class=\"url editable-group\">  <span class=\"profile-field\"><a title=\"#\" href=\"http://facebook.com/" + item["id"] + "\" rel=\"me nofollow\" target=\"_blank\">" + item["link"] + " </a>";
                    jstring += "<div style=\"cursor: pointer; width: 16px; height: 16px; display: inline-block;\">&nbsp;</div>";
                    jstring += "</span></span></p></div></div>";
                    jstring += "<div class=\"clearfix\">";
                    jstring += "<div class=\"default-footer\">";

                    jstring += "<div class=\"btn-group\">" +
                                  "<div class=\"follow_button\">" +

                                      //"<span class=\"button-text following-text\">Following</span>" +
                                      //"<span class=\"button-text unfollow-text\">Unfollow</span>" +
                                  "</div>" +
                               "</div>";
                    jstring += "</div></div>";
                    jstring += "<div class=\"profile-social-proof\"><div class=\"follow-bar\"></div></div></div>";
                    jstring += "<ol class=\"recent-tweets\">" +
                                  "<li class=\"\">" +
                                      "<div>" +
                                        "<i class=\"dogear\"></i>" +

                                      "</div>" +
                                  "</li>" +
                              "</ol>" +
                              "<div class=\"go_to_profile\">" +
                                  "<small><a href=\"http://facebook.com/" + item["id"] + "\" target=\"_blank\" class=\"view_profile\">Go to full profile →</a></small>" +
                              "</div>" +
                          "</div>" +
                          "<div class=\"loading\">" +
                              "<span class=\"spinner-bigger\"></span>" +
                          "</div>" +
                      "</div>";
                    jstring += "</div>";

                    Response.Write(jstring);

                }
            }
        }
Пример #24
0
    /// <summary>
  /// Sets one or more hex values that control the color scheme of the authenticating user's profile page on twitter.com.
 /// </summary>
 /// <param name="oAuth"></param>
  /// <param name="profile_background_color">Profile background color.</param>
  /// <param name="profile_link_color">Profile link color.</param>
  /// <param name="profile_sidebar_border_color">Profile sidebar's border color.</param>
  /// <param name="profile_sidebar_fill_color">Profile sidebar's background color.</param>
  /// <param name="profile_text_color">Profile text color.</param>
  /// <param name="include_entities">The entities node will not be included when set to false.</param>
 /// <param name="skip_status">When set to either true, t or 1 statuses will not be included in the returned user objects.</param>
 /// <returns></returns>
  public JArray PostAccount_Update_Profile_Colors(oAuthTwitter oAuth, string profile_background_color, string profile_link_color, string profile_sidebar_border_color, string profile_sidebar_fill_color, string profile_text_color, bool include_entities, bool skip_status, bool use)
  {
      Users objUser = new Users();
      JArray jarrUser = new JArray();
      jarrUser = objUser.Post_Account_Update_Profile_Colors(oAuth,profile_background_color,profile_link_color,profile_sidebar_border_color,profile_sidebar_fill_color,profile_text_color,include_entities,skip_status,use);
      return jarrUser;
  }
Пример #25
0
        public void getUserTweets(oAuthTwitter OAuth, string TwitterScreenName, string TwitterUserId, Guid userId, Domain.Socioboard.Domain.TwitterAccount objTwitterAccount)
        {

            try
            {
                Users userinfo = new Users();
                TwitterUser twtuser = new TwitterUser();
                JArray data = twtuser.GetStatuses_User_Timeline(OAuth);
                TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository();
                // TwitterMessage twtmsg = new TwitterMessage();
                Domain.Socioboard.Domain.TwitterMessage ObjTwitterMessage = new Domain.Socioboard.Domain.TwitterMessage();
                foreach (var item in data)
                {
                    ObjTwitterMessage.UserId = userId;
                    ObjTwitterMessage.Type = "twt_usertweets";
                    try
                    {
                        ObjTwitterMessage.TwitterMsg = item["text"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        ObjTwitterMessage.SourceUrl = item["source"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        ObjTwitterMessage.ScreenName = TwitterScreenName;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        ObjTwitterMessage.ProfileId = TwitterUserId;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        ObjTwitterMessage.MessageId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        ObjTwitterMessage.MessageDate = Utility.ParseTwitterTime(item["created_at"].ToString().TrimStart('"').TrimEnd('"'));
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        ObjTwitterMessage.InReplyToStatusUserId = item["in_reply_to_status_id_str"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        ObjTwitterMessage.Id = Guid.NewGuid();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        ObjTwitterMessage.FromProfileUrl = item["user"]["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        ObjTwitterMessage.FromName = item["user"]["name"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        ObjTwitterMessage.FromId = item["user"]["id_str"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    ObjTwitterMessage.EntryDate = DateTime.Now;
                    try
                    {
                        ObjTwitterMessage.FromScreenName = item["user"]["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    if (!twtmsgrepo.checkTwitterMessageExists(ObjTwitterMessage.ProfileId, ObjTwitterMessage.UserId, ObjTwitterMessage.MessageId))
                    {
                        twtmsgrepo.addTwitterMessage(ObjTwitterMessage);
                    }

                    #region Add TwitterFollowerCount
                    TwitterAccountFollowersRepository objTwitterAccountFollowersRepository = new TwitterAccountFollowersRepository();
                    Domain.Socioboard.Domain.TwitterAccountFollowers objTwitterAccountFollowers = new Domain.Socioboard.Domain.TwitterAccountFollowers();
                    objTwitterAccountFollowers.Id = Guid.NewGuid();
                    objTwitterAccountFollowers.UserId = userId;
                    objTwitterAccountFollowers.EntryDate = DateTime.Now;
                    objTwitterAccountFollowers.ProfileId = TwitterUserId;
                    JArray profile = userinfo.Get_Users_LookUp_ByScreenName(OAuth, TwitterScreenName);
                    foreach (var item_followerdata in profile)
                    {

                        try
                        {
                            objTwitterAccountFollowers.FollowingsCount = Convert.ToInt32(item_followerdata["friends_count"].ToString());
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterAccountFollowers.FollowersCount = Convert.ToInt32(item_followerdata["followers_count"].ToString());
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                    objTwitterAccountFollowersRepository.addTwitterAccountFollower(objTwitterAccountFollowers);

                    #endregion
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
Пример #26
0
   /// <summary>
 /// The avatar image for the profile, base64-encoded. Must be a valid GIF, JPG, or PNG image of less than 700 kilobytes in size.
 /// </summary>
 /// <param name="oAuth"></param>
 /// <param name="image"></param>
 /// <param name="include_entities"></param>
 /// <param name="skip_status"></param>
 /// <returns></returns>
  public JArray PostAccount_Update_Profile_Image(oAuthTwitter oAuth, string image, bool include_entities, bool skip_status)
  {
      Users objUser = new Users();
      JArray jarrUser = new JArray();
      jarrUser = objUser.Post_Account_Update_Profile_Image(oAuth, image,include_entities, skip_status);
      return jarrUser;
  }
Пример #27
0
        public bool CheckTwitterTokenByUserId(oAuthTwitter objoAuthTwitter, string userid)
        {
            bool CheckTwitterTokenByUserId = false;
            //oAuthTwitter oAuthTwt = new oAuthTwitter();
            Users twtUser = new Users();
            try
            {
                Users userinfo = new Users();
                JArray userlookup = userinfo.Get_Users_LookUp(objoAuthTwitter, userid);
                CheckTwitterTokenByUserId = true;

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return CheckTwitterTokenByUserId;
        }
Пример #28
0
  /// <summary>
 ///Returns an array of numeric user ids the authenticating user is blocking.
 /// </summary>
 /// <param name="oAuth"></param>
 /// <returns></returns>
 public JArray GetBlocks_Ids(oAuthTwitter oAuth)
 {
     Users objUser = new Users();
     JArray jarrUser = new JArray();
     jarrUser = objUser.Get_Blocks_Ids(oAuth);
     return jarrUser;
 }
Пример #29
0
        public string AddTwitterAccount(string client_id, string client_secret, string redirect_uri, string UserId, string GroupId, string requestToken, string requestSecret, string requestVerifier)
        {
            try
            {
                System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;

                string ret = string.Empty;
                Users userinfo = new Users();
                oAuthTwitter OAuth = new oAuthTwitter(client_id, client_secret, redirect_uri);
                OAuth.AccessToken = requestToken;
                OAuth.AccessTokenSecret = requestVerifier;
                OAuth.AccessTokenGet(requestToken, requestVerifier);
                JArray profile = userinfo.Get_Users_LookUp_ByScreenName(OAuth, OAuth.TwitterScreenName);

                if (profile != null)
                {
                    logger.Error("Twitter.asmx >> AddTwitterAccount >> Twitter profile : " + profile);
                }
                else
                {
                    logger.Error("Twitter.asmx >> AddTwitterAccount >> NULL Twitter profile : " + profile);
                }

                objTwitterAccount = new Domain.Socioboard.Domain.TwitterAccount();
                TwitterUser twtuser;
                foreach (var item in profile)
                {
                    #region Add Twitter Account
                    try
                    {
                        objTwitterAccount.FollowingCount = Convert.ToInt32(item["friends_count"].ToString());
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterAccount.FollowersCount = Convert.ToInt32(item["followers_count"].ToString());
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    objTwitterAccount.Id = Guid.NewGuid();
                    objTwitterAccount.IsActive = true;
                    objTwitterAccount.OAuthSecret = OAuth.AccessTokenSecret;
                    objTwitterAccount.OAuthToken = OAuth.AccessToken;
                    try
                    {
                        objTwitterAccount.ProfileImageUrl = item["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);

                    }
                    try
                    {
                        objTwitterAccount.ProfileUrl = string.Empty;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterAccount.TwitterUserId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception er)
                    {
                        try
                        {
                            objTwitterAccount.TwitterUserId = item["id"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.StackTrace);
                        }
                        Console.WriteLine(er.StackTrace);

                    }

                    try
                    {
                        objTwitterAccount.TwitterScreenName = item["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    objTwitterAccount.UserId = Guid.Parse(UserId);
                    #endregion
                    if (!objTwitterAccountRepository.checkTwitterUserExists(objTwitterAccount.TwitterUserId, Guid.Parse(UserId)))
                    {
                        objTwitterAccountRepository.addTwitterkUser(objTwitterAccount);
                        #region Add TeamMemberProfile
                        Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId));
                        Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile();
                        objTeamMemberProfile.Id = Guid.NewGuid();
                        objTeamMemberProfile.TeamId = objTeam.Id;
                        objTeamMemberProfile.Status = 1;
                        objTeamMemberProfile.ProfileType = "twitter";
                        objTeamMemberProfile.StatusUpdateDate = DateTime.Now;
                        objTeamMemberProfile.ProfileId = objTwitterAccount.TwitterUserId;

                        objTeamMemberProfile.ProfileName = objTwitterAccount.TwitterScreenName;
                        objTeamMemberProfile.ProfilePicUrl = objTwitterAccount.ProfileImageUrl;

                        objTeamMemberProfileRepository.addNewTeamMember(objTeamMemberProfile);
                        #endregion
                        #region SocialProfile
                        Domain.Socioboard.Domain.SocialProfile objSocialProfile = new Domain.Socioboard.Domain.SocialProfile();
                        objSocialProfile.Id = Guid.NewGuid();
                        objSocialProfile.ProfileType = "twitter";
                        objSocialProfile.ProfileId = objTwitterAccount.TwitterUserId;
                        objSocialProfile.UserId = Guid.Parse(UserId);
                        objSocialProfile.ProfileDate = DateTime.Now;
                        objSocialProfile.ProfileStatus = 1;
                        #endregion
                        #region Add Twitter Stats
                        if (!objSocialProfilesRepository.checkUserProfileExist(objSocialProfile))
                        {
                            objSocialProfilesRepository.addNewProfileForUser(objSocialProfile);
                        }
                        objTwitterStats = new Domain.Socioboard.Domain.TwitterStats();
                        Random rNum = new Random();
                        objTwitterStats.Id = Guid.NewGuid();
                        objTwitterStats.TwitterId = objTwitterAccount.TwitterUserId;
                        objTwitterStats.UserId = Guid.Parse(UserId);
                        objTwitterStats.FollowingCount = objTwitterAccount.FollowingCount;
                        objTwitterStats.FollowerCount = objTwitterAccount.FollowersCount;
                        objTwitterStats.Age1820 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.Age2124 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.Age2534 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.Age3544 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.Age4554 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.Age5564 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.Age65 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.EntryDate = DateTime.Now;
                        if (!objTwtstats.checkTwitterStatsExists(objTwitterAccount.TwitterUserId, Guid.Parse(UserId)))
                        {
                            objTwtstats.addTwitterStats(objTwitterStats);
                        }
                        #endregion

                        #region AddTwitterFollowerCount
                        Domain.Socioboard.Domain.TwitterAccountFollowers objTwitterAccountFollowers = new Domain.Socioboard.Domain.TwitterAccountFollowers();
                        TwitterAccountFollowersRepository objTwitterAccountFollowersRepository = new TwitterAccountFollowersRepository();
                        objTwitterAccountFollowers.Id = Guid.NewGuid();
                        objTwitterAccountFollowers.UserId = Guid.Parse(UserId);
                        objTwitterAccountFollowers.EntryDate = DateTime.Now;
                        objTwitterAccountFollowers.FollowingsCount = Convert.ToInt32(item["friends_count"].ToString());
                        objTwitterAccountFollowers.FollowersCount = Convert.ToInt32(item["followers_count"].ToString());
                        try
                        {
                            objTwitterAccountFollowers.ProfileId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception er)
                        {
                            try
                            {
                                objTwitterAccountFollowers.ProfileId = item["id"].ToString().TrimStart('"').TrimEnd('"');
                            }
                            catch (Exception ex)
                            {
                                logger.Error(ex.StackTrace);
                            }
                            Console.WriteLine(er.StackTrace);

                        }
                        objTwitterAccountFollowersRepository.addTwitterAccountFollower(objTwitterAccountFollowers);
                        #endregion

                        ret = "Account Added Successfully";
                    }
                    else
                    {
                        ret = "Account already Exist !";
                    }
                }
                getTwitterMessages(UserId, OAuth);

                getUserRetweets(UserId, OAuth);


                //edited by avinash[24-03-15]

                getTwitterEngagement(UserId, OAuth);

                getUserTweets(UserId, OAuth);

                getTwitterFeeds(UserId, OAuth);

                getTwitterDirectMessageSent(UserId, OAuth);
                getTwittwrDirectMessageRecieved(OAuth,UserId);
                getUserMentions(OAuth, objTwitterAccount.TwitterUserId, Guid.Parse(UserId));
                getUserFollowers(OAuth, objTwitterAccount.TwitterScreenName, objTwitterAccount.TwitterUserId, Guid.Parse(UserId));
                getUserRetweet(OAuth, objTwitterAccount.TwitterUserId, Guid.Parse(UserId));

                //return ret;
                return new JavaScriptSerializer().Serialize(objTwitterAccount);
            }
            catch (Exception ex)
            {
                logger.Error(ex.StackTrace);
                return "";
            }
        }
Пример #30
0
        public void AddTwitteruserFollower(oAuthTwitter OAuth, Guid userId, string TwitterUserId, string TwitterScreenName)
        {
            #region Add TwitterFollowerCount
            Users userinfo = new Users();
            TwitterAccountFollowersRepository objTwitterAccountFollowersRepository = new TwitterAccountFollowersRepository();
            Domain.Socioboard.Domain.TwitterAccountFollowers objTwitterAccountFollowers = new Domain.Socioboard.Domain.TwitterAccountFollowers();
            objTwitterAccountFollowers.Id = Guid.NewGuid();
            objTwitterAccountFollowers.UserId = userId;
            objTwitterAccountFollowers.EntryDate = DateTime.Now;
            objTwitterAccountFollowers.ProfileId = TwitterUserId;
            try
            {
                JArray profile = userinfo.Get_Users_LookUp_ByScreenName(OAuth, TwitterScreenName);
                foreach (var item_followerdata in profile)
                {

                    try
                    {
                        objTwitterAccountFollowers.FollowingsCount = Convert.ToInt32(item_followerdata["friends_count"].ToString());
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterAccountFollowers.FollowersCount = Convert.ToInt32(item_followerdata["followers_count"].ToString());
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }

                DateTime t1 = DateTime.Now.Date;
                DateTime t2 = DateTime.Now.Date.AddHours(12);
                DateTime t3 = DateTime.Now.AddDays(1).Date.AddSeconds(-1);
                if (DateTime.Now.TimeOfDay >= t1.TimeOfDay && DateTime.Now.TimeOfDay < t2.TimeOfDay)
                {
                    if (objTwitterAccountFollowersRepository.IsTwitterAccountExistsFirst(userId, TwitterUserId))
                    {
                        objTwitterAccountFollowersRepository.UpdateTwitterAccountFollowerFirst(objTwitterAccountFollowers);
                    }
                    else
                    {
                        objTwitterAccountFollowersRepository.addTwitterAccountFollower(objTwitterAccountFollowers);
                    }
                }
                if (DateTime.Now.TimeOfDay >= t2.TimeOfDay && DateTime.Now.TimeOfDay < t3.TimeOfDay)
                {
                    if (objTwitterAccountFollowersRepository.IsTwitterAccountExistsSecond(userId, TwitterUserId))
                    {
                        objTwitterAccountFollowersRepository.UpdateTwitterAccountFollowerSecond(objTwitterAccountFollowers);
                    }
                    else
                    {
                        objTwitterAccountFollowersRepository.addTwitterAccountFollower(objTwitterAccountFollowers);
                    }
                }

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

            #endregion
        }