Exemple #1
0
        /// <getUserDetails>
        /// Get the details of account by Google plus Id.
        /// </summary>
        /// <param name="GpUserId">Id of goole plus account(String)</param>
        /// <param name="gpaccount">Set Values in a GooglePlusAccount Class Property and Pass the same Object of GooglePlusAccount Class.(Domain.GooglePlusAccount)</param>
        public Domain.Socioboard.Domain.GooglePlusAccount getUserDetails(string GpUserId)
        {
            //Creates a database connection and opens up a session
            using (NHibernate.ISession session = SessionFactory.GetNewSession())
            {
                //After Session creation, start Transaction.
                using (NHibernate.ITransaction transaction = session.BeginTransaction())
                {
                    try
                    {
                        //Proceed action, to get Account detail by google id.
                        NHibernate.IQuery query = session.CreateQuery("from GooglePlusAccount where GpUserId = :gpuserid");

                        query.SetParameter("gpuserid", GpUserId);
                        List <Domain.Socioboard.Domain.GooglePlusAccount> lst = new List <Domain.Socioboard.Domain.GooglePlusAccount>();

                        foreach (Domain.Socioboard.Domain.GooglePlusAccount item in query.Enumerable())
                        {
                            lst.Add(item);
                            break;
                        }
                        Domain.Socioboard.Domain.GooglePlusAccount fbacc = lst[0];
                        return(fbacc);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        return(null);
                    }
                } //End Transaction
            }     //End Session
        }
Exemple #2
0
 /// <updateGooglePlusUser>
 /// Update google pluse user account details.
 /// </summary>
 /// <param name="gpaccount">Set Values in a GooglePlusAccount Class Property and Pass the same Object of GooglePlusAccount Class.(Domain.GooglePlusAccount)</param>
 public void updateGooglePlusUser(Domain.Socioboard.Domain.GooglePlusAccount gpaccount)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 //Proceed action, to update google pluse account details
                 session.CreateQuery("Update GooglePlusAccount set GpUserName =:gpusername,AccessToken =:access,RefreshToken=:refreshtoken,GpProfileImage =:gpprofileimage,RefreshToken=:refreshtoken,EmailId=:emailid where GpUserId = :gpuserid and UserId = :userid")
                 .SetParameter("gpusername", gpaccount.GpUserName)
                 .SetParameter("access", gpaccount.AccessToken)
                 .SetParameter("refreshtoken", gpaccount.RefreshToken)
                 .SetParameter("gpprofileimage", gpaccount.GpProfileImage)
                 .SetParameter("emailid", gpaccount.EmailId)
                 .SetParameter("fbuserid", gpaccount.GpUserId)
                 .SetParameter("userid", gpaccount.UserId)
                 .ExecuteUpdate();
                 transaction.Commit();
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 // return 0;
             }
         } //End Transaction
     }     //End Session
 }
Exemple #3
0
 /// <addGooglePlusUser>
 /// Add google account of user
 /// </summary>
 /// <param name="gpaccount">Set Values in a GooglePlusAccount Class Property and Pass the same Object of GooglePlusAccount Class.(Domain.GooglePlusAccount)</param>
 public void addGooglePlusUser(Domain.Socioboard.Domain.GooglePlusAccount gpaccount)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             //Proceed action to Save new data .
             session.Save(gpaccount);
             transaction.Commit();
         } //End Transaction
     }     //End Session
 }
Exemple #4
0
 /// <getGooglePlusAccountDetailsById>
 /// Get the details of Google account By Id.
 /// </summary>
 /// <param name="gpuserid">Google Plus user id(string).</param>
 /// <param name="userId">User id(Guid)</param>
 /// <returns>Return the object of group where we get all values from object.(Domain.GooglePlusAccount)</returns>
 public Domain.Socioboard.Domain.GooglePlusAccount getGooglePlusAccountDetailsById(string gpuserid, Guid userId)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             //Proceed action, to get Details of account by user id and Google plus id.
             NHibernate.IQuery query = session.CreateQuery("from GooglePlusAccount where GpUserId = :gpuserid and UserId=:userId");
             query.SetParameter("gpuserid", gpuserid);
             query.SetParameter("userId", userId);
             Domain.Socioboard.Domain.GooglePlusAccount result = (Domain.Socioboard.Domain.GooglePlusAccount)query.UniqueResult();
             return(result);
         } //End Transaction
     }     //End Session
 }
Exemple #5
0
 public int UpdateGooglePlusAccount(Domain.Socioboard.Domain.GooglePlusAccount _GooglePlusAccount)
 {
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 int i = session.CreateQuery("Update GooglePlusAccount set InYourCircles =: InYourCircles, HaveYouInCircles =: HaveYouInCircles where UserId =: UserId and GpUserId =: GpUserId")
                         .SetParameter("InYourCircles", _GooglePlusAccount.InYourCircles)
                         .SetParameter("HaveYouInCircles", _GooglePlusAccount.HaveYouInCircles)
                         .SetParameter("UserId", _GooglePlusAccount.UserId)
                         .SetParameter("GpUserId", _GooglePlusAccount.GpUserId)
                         .ExecuteUpdate();
                 transaction.Commit();
                 return(i);
             }
             catch (Exception ex) {
                 return(0);
             }
         }
     }
 }
Exemple #6
0
 public string ProfilesConnected(string UserId)
 {
     try
     {
         Guid userid = Guid.Parse(UserId);
         SocialProfilesRepository socialRepo = new SocialProfilesRepository();
         List <Domain.Socioboard.Domain.SocialProfile> lstsocioprofile = socialRepo.getAllSocialProfilesOfUser(userid);
         List <profileConnected> lstProfile = new List <profileConnected>();
         foreach (Domain.Socioboard.Domain.SocialProfile sp in lstsocioprofile)
         {
             profileConnected pc = new profileConnected();
             pc.Id            = sp.Id;
             pc.ProfileDate   = sp.ProfileDate;
             pc.ProfileId     = sp.ProfileId;
             pc.ProfileStatus = sp.ProfileStatus;
             pc.ProfileType   = sp.ProfileType;
             pc.UserId        = sp.UserId;
             if (sp.ProfileType == "facebook")
             {
                 try
                 {
                     FacebookAccountRepository objFbAccRepo            = new FacebookAccountRepository();
                     Domain.Socioboard.Domain.FacebookAccount objFbAcc = objFbAccRepo.getUserDetails(sp.ProfileId);
                     pc.ProfileName   = objFbAcc.FbUserName;
                     pc.ProfileImgUrl = "http://graph.facebook.com/" + sp.ProfileId + "/picture?type=small";
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "twitter")
             {
                 try
                 {
                     TwitterAccountRepository objTwtAccRepo            = new TwitterAccountRepository();
                     Domain.Socioboard.Domain.TwitterAccount objTwtAcc = objTwtAccRepo.getUserInfo(sp.ProfileId);
                     pc.ProfileName   = objTwtAcc.TwitterScreenName;
                     pc.ProfileImgUrl = objTwtAcc.ProfileImageUrl;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "instagram")
             {
                 try
                 {
                     InstagramAccountRepository objInsAccRepo            = new InstagramAccountRepository();
                     Domain.Socioboard.Domain.InstagramAccount objInsAcc = objInsAccRepo.getInstagramAccountById(sp.ProfileId);
                     pc.ProfileName   = objInsAcc.InsUserName;
                     pc.ProfileImgUrl = objInsAcc.ProfileUrl;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "linkedin")
             {
                 try
                 {
                     LinkedInAccountRepository objLiAccRepo            = new LinkedInAccountRepository();
                     Domain.Socioboard.Domain.LinkedInAccount objLiAcc = objLiAccRepo.getLinkedinAccountDetailsById(sp.ProfileId);
                     pc.ProfileName   = objLiAcc.LinkedinUserName;
                     pc.ProfileImgUrl = objLiAcc.ProfileImageUrl;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "googleplus")
             {
                 try
                 {
                     GooglePlusAccountRepository objGpAccRepo            = new GooglePlusAccountRepository();
                     Domain.Socioboard.Domain.GooglePlusAccount objGpAcc = objGpAccRepo.getUserDetails(sp.ProfileId);
                     pc.ProfileName   = objGpAcc.GpUserName;
                     pc.ProfileImgUrl = objGpAcc.GpProfileImage;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "tumblr")
             {
                 try
                 {
                     TumblrAccountRepository objTumblrAccountRepository      = new TumblrAccountRepository();
                     Domain.Socioboard.Domain.TumblrAccount objTumblrAccount = objTumblrAccountRepository.getTumblrAccountDetailsById(sp.ProfileId);
                     pc.ProfileName   = objTumblrAccount.tblrUserName;
                     pc.ProfileImgUrl = objTumblrAccount.tblrProfilePicUrl;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "youtube")
             {
                 try
                 {
                     YoutubeAccountRepository objYoutubeAccountRepository      = new YoutubeAccountRepository();
                     Domain.Socioboard.Domain.YoutubeAccount objYoutubeAccount = objYoutubeAccountRepository.getYoutubeAccountDetailsById(sp.ProfileId);
                     pc.ProfileName   = objYoutubeAccount.Ytusername;
                     pc.ProfileImgUrl = objYoutubeAccount.Ytprofileimage;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             lstProfile.Add(pc);
         }
         return(new JavaScriptSerializer().Serialize(lstProfile));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
         return(new JavaScriptSerializer().Serialize("Please Try Again"));
     }
 }
        public ActionResult UpdateProfileDetails(string Network, string ProfileName)
        {
            if (Session["User"] != null)
            {
                Domain.Socioboard.Domain.User _User = (Domain.Socioboard.Domain.User)Session["User"];
                if (_User.UserType != "SuperAdmin")
                {
                    return(RedirectToAction("Index", "Index"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "Index"));
            }
            string ReturnMessage = string.Empty;
            bool   Status        = false;

            if (Network == "Facebook")
            {
                Domain.Socioboard.Domain.FacebookAccount objfb = (FacebookAccount)Session["UpdateProfileData"];
                objfb.IsActive   = 1;
                objfb.FbUserName = ProfileName;
                string objFacebook             = new JavaScriptSerializer().Serialize(objfb);
                Api.Facebook.Facebook ApiObjfb = new Api.Facebook.Facebook();
                string FbMessage = (string)(new JavaScriptSerializer().Deserialize(ApiObjfb.UpdateFacebookAccountByAdmin(objFacebook), typeof(string)));
                ReturnMessage = FbMessage;
            }
            if (Network == "Twitter")
            {
                Status = true;
                Domain.Socioboard.Domain.TwitterAccount objfb = (TwitterAccount)Session["UpdateProfileData"];
                objfb.IsActive          = Status;
                objfb.TwitterScreenName = ProfileName;
                string objFacebook           = new JavaScriptSerializer().Serialize(objfb);
                Api.Twitter.Twitter ApiObjfb = new Api.Twitter.Twitter();
                string FbMessage             = (string)(new JavaScriptSerializer().Deserialize(ApiObjfb.UpdateTwitterAccountByAdmin(objFacebook), typeof(string)));
                ReturnMessage = FbMessage;
            }
            if (Network == "Linkedin")
            {
                Status = true;
                Domain.Socioboard.Domain.LinkedInAccount objfb = (LinkedInAccount)Session["UpdateProfileData"];
                objfb.IsActive         = Status;
                objfb.LinkedinUserName = ProfileName;
                string objFacebook           = new JavaScriptSerializer().Serialize(objfb);
                Api.Twitter.Twitter ApiObjfb = new Api.Twitter.Twitter();
                string FbMessage             = (string)(new JavaScriptSerializer().Deserialize(ApiObjfb.UpdateTwitterAccountByAdmin(objFacebook), typeof(string)));
                ReturnMessage = FbMessage;
            }
            if (Network == "Instagram")
            {
                Status = true;
                Domain.Socioboard.Domain.InstagramAccount objfb = (InstagramAccount)Session["UpdateProfileData"];
                objfb.IsActive    = Status;
                objfb.InsUserName = ProfileName;
                string objFacebook = new JavaScriptSerializer().Serialize(objfb);
                Api.Instagram.Instagram ApiObjfb = new Api.Instagram.Instagram();
                string FbMessage = (string)(new JavaScriptSerializer().Deserialize(ApiObjfb.UpdateInstagramAccountByAdmin(objFacebook), typeof(string)));
                ReturnMessage = FbMessage;
            }
            //if (Network == "Tumblr")
            //{
            //    Status = true;
            //    Domain.Socioboard.Domain.TwitterAccount objfb = (TwitterAccount)Session["UpdateProfileData"];
            //    objfb.IsActive = Status;
            //    objfb.TwitterScreenName = ProfileName;
            //    string objFacebook = new JavaScriptSerializer().Serialize(objfb);
            //    Api.Twitter.Twitter ApiObjfb = new Api.Twitter.Twitter();
            //    string FbMessage = (string)(new JavaScriptSerializer().Deserialize(ApiObjfb.UpdateTwitterAccountByAdmin(objFacebook), typeof(string)));
            //    ReturnMessage = FbMessage;
            //}
            if (Network == "Youtube")
            {
                Status = true;
                Domain.Socioboard.Domain.YoutubeAccount objfb = (YoutubeAccount)Session["UpdateProfileData"];
                objfb.Isactive   = 1;
                objfb.Ytusername = ProfileName;
                string objFacebook           = new JavaScriptSerializer().Serialize(objfb);
                Api.Youtube.Youtube ApiObjfb = new Api.Youtube.Youtube();
                string FbMessage             = (string)(new JavaScriptSerializer().Deserialize(ApiObjfb.UpdateYouTubeAccountByAdmin(objFacebook), typeof(string)));
                ReturnMessage = FbMessage;
            }
            if (Network == "GooglePlus")
            {
                Status = true;
                Domain.Socioboard.Domain.GooglePlusAccount objfb = (GooglePlusAccount)Session["UpdateProfileData"];
                objfb.IsActive   = 1;
                objfb.GpUserName = ProfileName;
                string objFacebook           = new JavaScriptSerializer().Serialize(objfb);
                Api.Twitter.Twitter ApiObjfb = new Api.Twitter.Twitter();
                string FbMessage             = (string)(new JavaScriptSerializer().Deserialize(ApiObjfb.UpdateTwitterAccountByAdmin(objFacebook), typeof(string)));
                ReturnMessage = FbMessage;
            }
            return(Content(ReturnMessage));
        }
Exemple #8
0
        public static Dictionary <Domain.Socioboard.Domain.GroupProfile, Dictionary <object, List <object> > > GetUserProfilesSnapsAccordingToGroup(List <Domain.Socioboard.Domain.GroupProfile> groupProfile, User objUser, int CountProfileSnapshot = 0)
        {
            // User objUser = (User)System.Web.HttpContext.Current.Session["User"];
            Dictionary <Domain.Socioboard.Domain.GroupProfile, Dictionary <object, List <object> > > dic_profilessnap = new Dictionary <Domain.Socioboard.Domain.GroupProfile, Dictionary <object, List <object> > >();
            var dicprofilefeeds            = new Dictionary <object, List <object> >();
            List <GroupProfile> lstprofile = groupProfile.Where(t => t.ProfileType != "linkedin").ToList();
            int tempCount = 0;

            foreach (Domain.Socioboard.Domain.GroupProfile item in lstprofile)
            {
                tempCount++;
                if (tempCount <= CountProfileSnapshot)
                {
                    continue;
                }

                //to load only 3 profiles on home page load to speed up page loading
                if (dic_profilessnap.Count >= 3)
                {
                    break;
                }

                List <object> feeds = null;
                if (item.ProfileType == "facebook" || item.ProfileType == "facebook_page")
                {
                    try
                    {
                        feeds = new List <object>();
                        Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
                        ApiobjFacebookAccount.Timeout = 300000;
                        FacebookAccount objFacebookAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(FacebookAccount)));
                        Api.FacebookFeed.FacebookFeed ApiobjFacebookFeed = new Api.FacebookFeed.FacebookFeed();
                        ApiobjFacebookFeed.Timeout = 300000;
                        //List<FacebookFeed> lstFacebookFeed = (List<FacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<FacebookFeed>)));
                        List <MongoFacebookFeed> lstFacebookFeed = (List <MongoFacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(), "0", "10"), typeof(List <MongoFacebookFeed>)));

                        foreach (var facebookfeed in lstFacebookFeed)
                        {
                            feeds.Add(facebookfeed);
                        }
                        dicprofilefeeds.Add(objFacebookAccount, feeds);
                        dic_profilessnap.Add(item, dicprofilefeeds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }

                if (item.ProfileType == "twitter")
                {
                    try
                    {
                        feeds = new List <object>();
                        Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount();
                        TwitterAccount objTwitterAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(TwitterAccount)));
                        Api.TwitterFeed.TwitterFeed ApiobjTwitterFeed = new Api.TwitterFeed.TwitterFeed();
                        ApiobjTwitterFeed.Timeout = 300000;
                        //List<TwitterFeed> lstTwitterFeed = (List<TwitterFeed>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.GetAllTwitterFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<TwitterFeed>)));
                        List <Domain.Socioboard.MongoDomain.TwitterFeed> lstTwitterFeed = (List <Domain.Socioboard.MongoDomain.TwitterFeed>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.getAllFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(), "0", "10"), typeof(List <Domain.Socioboard.MongoDomain.TwitterFeed>)));
                        foreach (var twitterfeed in lstTwitterFeed)
                        {
                            feeds.Add(twitterfeed);
                        }
                        dicprofilefeeds.Add(objTwitterAccount, feeds);
                        dic_profilessnap.Add(item, dicprofilefeeds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }

                if (item.ProfileType == "linkedin")
                {
                    try
                    {
                        feeds = new List <object>();
                        Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount();
                        ApiobjLinkedinAccount.Timeout = 300000;
                        LinkedInAccount objLinkedInAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetLinkedinAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(LinkedInAccount)));
                        Api.LinkedInFeed.LinkedInFeed ApiobjLinkedInFeed = new Api.LinkedInFeed.LinkedInFeed();
                        ApiobjLinkedInFeed.Timeout = 300000;
                        //List<LinkedInFeed> lstLinkedInFeed = (List<LinkedInFeed>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedInFeed.GetLinkedInFeeds(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<LinkedInFeed>)));
                        List <LinkedInFeed> lstLinkedInFeed = (List <LinkedInFeed>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedInFeed.GetLinkedInFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(), "0", "10"), typeof(List <LinkedInFeed>)));

                        foreach (var LinkedInFeed in lstLinkedInFeed)
                        {
                            feeds.Add(LinkedInFeed);
                        }
                        dicprofilefeeds.Add(objLinkedInAccount, feeds);
                        dic_profilessnap.Add(item, dicprofilefeeds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
                if (item.ProfileType == "instagram")
                {
                    try
                    {
                        feeds = new List <object>();
                        Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount();
                        ApiobjInstagramAccount.Timeout = 300000;
                        InstagramAccount objInstagramAccount = (InstagramAccount)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.UserInformation(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(InstagramAccount)));
                        dicprofilefeeds.Add(objInstagramAccount, feeds);
                        dic_profilessnap.Add(item, dicprofilefeeds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }

                if (item.ProfileType == "tumblr")
                {
                    try
                    {
                        feeds = new List <object>();
                        Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount();
                        ApiobjTumblrAccount.Timeout = 300000;
                        TumblrAccount objTumblrAccount = (TumblrAccount)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetTumblrAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(TumblrAccount)));
                        dicprofilefeeds.Add(objTumblrAccount, feeds);
                        dic_profilessnap.Add(item, dicprofilefeeds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }


                if (item.ProfileType == "youtube")
                {
                    try
                    {
                        feeds = new List <object>();
                        Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount();
                        ApiobjYoutubeAccount.Timeout = 300000;
                        YoutubeAccount objYoutubeAccount = (YoutubeAccount)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetYoutubeAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(YoutubeAccount)));
                        Api.YoutubeChannel.YoutubeChannel ApiobjYoutubeChannel = new Api.YoutubeChannel.YoutubeChannel();
                        ApiobjYoutubeChannel.Timeout = 300000;
                        List <YoutubeChannel> lstYoutubeChannel = (List <YoutubeChannel>)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeChannel.GetAllYoutubeChannelByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List <YoutubeChannel>)));
                        //List<YoutubeChannel> lstYoutubeChannel = new List<YoutubeChannel>();
                        //lstYoutubeChannel.Add(objYoutubeChannel);
                        foreach (var youtubechannel in lstYoutubeChannel)
                        {
                            feeds.Add(youtubechannel);
                        }
                        dicprofilefeeds.Add(objYoutubeAccount, feeds);
                        dic_profilessnap.Add(item, dicprofilefeeds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }

                if (item.ProfileType == "linkedincompanypage")
                {
                    try
                    {
                        feeds = new List <object>();
                        Api.LinkedinCompanyPage.LinkedinCompanyPage ApiobjLinkedinCompanyPage = new Api.LinkedinCompanyPage.LinkedinCompanyPage();
                        ApiobjLinkedinCompanyPage.Timeout = 300000;
                        LinkedinCompanyPage objLinkedinCompanypage = (LinkedinCompanyPage)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinCompanyPage.GetLinkedinCompanyPageDetailsByUserIdAndPageId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(LinkedinCompanyPage)));
                        Api.LinkedinCompanyPage.LinkedinCompanyPage ApiobjLinkedinCompanyPagePost = new Api.LinkedinCompanyPage.LinkedinCompanyPage();
                        ApiobjLinkedinCompanyPage.Timeout = 300000;
                        List <LinkedinCompanyPagePosts> lstlipagepost = (List <LinkedinCompanyPagePosts>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinCompanyPagePost.GetAllLinkedinCompanyPagePostsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List <LinkedinCompanyPagePosts>)));
                        foreach (var lipagepost in lstlipagepost)
                        {
                            feeds.Add(lipagepost);
                        }
                        dicprofilefeeds.Add(objLinkedinCompanypage, feeds);
                        dic_profilessnap.Add(item, dicprofilefeeds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
                if (item.ProfileType == "gplus")
                {
                    try
                    {
                        feeds = new List <object>();
                        Api.GooglePlusAccount.GooglePlusAccount ApiobjGooglePlusAccount = new Api.GooglePlusAccount.GooglePlusAccount();
                        ApiobjGooglePlusAccount.Timeout = 300000;
                        Domain.Socioboard.Domain.GooglePlusAccount _GooglePlusAccount = (GooglePlusAccount) new JavaScriptSerializer().Deserialize(ApiobjGooglePlusAccount.GetGooglePlusAccountDetailsById(objUser.Id.ToString(), item.ProfileId), typeof(GooglePlusAccount));
                        dicprofilefeeds.Add(_GooglePlusAccount, feeds);
                        dic_profilessnap.Add(item, dicprofilefeeds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
                if (item.ProfileType == "googleanalytics")
                {
                    try
                    {
                        feeds = new List <object>();
                        Api.GoogleAnalyticsAccount.GoogleAnalyticsAccount ApiobjGoogleAnalyticsAccount = new Api.GoogleAnalyticsAccount.GoogleAnalyticsAccount();
                        ApiobjGoogleAnalyticsAccount.Timeout = 300000;
                        Domain.Socioboard.Domain.GoogleAnalyticsAccount _GoogleAnalyticsAccount = (GoogleAnalyticsAccount) new JavaScriptSerializer().Deserialize(ApiobjGoogleAnalyticsAccount.GetGooglePlusAccountDetailsById(objUser.Id.ToString(), item.ProfileId), typeof(GoogleAnalyticsAccount));
                        dicprofilefeeds.Add(_GoogleAnalyticsAccount, feeds);
                        dic_profilessnap.Add(item, dicprofilefeeds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
            }

            return(dic_profilessnap);
        }
        private static async Task<ISocialSiteAccount> GetSocialAccountFromGroupProfile(Guid objUserid, Domain.Socioboard.Domain.GroupProfile objGroupProfile)
        {
            ISocialSiteAccount objSocialSiteAccount = null;
            string accesstoken = string.Empty;
             try {
                accesstoken = System.Web.HttpContext.Current.Session["access_token"].ToString();
            }
            catch { }

            if (objGroupProfile.ProfileType == "facebook" || objGroupProfile.ProfileType == "facebook_page")
            {
                //using (Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount())
                //{
                //    ApiobjFacebookAccount.Timeout = 300000;
                //    objSocialSiteAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(FacebookAccount)));
                //}
                FacebookAccount fbaccount = new FacebookAccount();
                HttpResponseMessage fbresponse = await WebApiReq.GetReq("api/ApiFacebookAccount/GetFacebookAcoount?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken);
                if (fbresponse.IsSuccessStatusCode)
                {
                    fbaccount = await fbresponse.Content.ReadAsAsync<Domain.Socioboard.Domain.FacebookAccount>();
                    objSocialSiteAccount = fbaccount;
                }
            }
            else if (objGroupProfile.ProfileType == "twitter")
            {
                //using (Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount())
                //{

                //    ApiobjTwitterAccount.Timeout = 300000;
                //    objSocialSiteAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(TwitterAccount)));

                //}
                TwitterAccount twitterAcc = new TwitterAccount();
                HttpResponseMessage twitterresponse = await WebApiReq.GetReq("api/ApiTwitterAccount/GetTwitterAccountDetailsById?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken);
                if (twitterresponse.IsSuccessStatusCode)
                {
                    twitterAcc = await twitterresponse.Content.ReadAsAsync<Domain.Socioboard.Domain.TwitterAccount>();
                    objSocialSiteAccount = twitterAcc;
                }
            }
            else if (objGroupProfile.ProfileType == "linkedin")
            {
                //using (Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount())
                //{

                //    ApiobjLinkedinAccount.Timeout = 300000;
                //    objSocialSiteAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetLinkedinAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(LinkedInAccount)));

                //}
                LinkedInAccount LinkedinAcc = new LinkedInAccount();
                HttpResponseMessage Linkedinresponse = await WebApiReq.GetReq("api/ApiLinkedinAccount/GetLinkedinAccountDetailsById?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken);
                if (Linkedinresponse.IsSuccessStatusCode)
                {
                    LinkedinAcc = await Linkedinresponse.Content.ReadAsAsync<Domain.Socioboard.Domain.LinkedInAccount>();
                    objSocialSiteAccount = LinkedinAcc;
                }

            }
            else if (objGroupProfile.ProfileType == "instagram")
            {
                //using (Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount())
                //{
                //    objSocialSiteAccount = (InstagramAccount)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.UserInformation(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(InstagramAccount)));

                //}
                InstagramAccount instAcc = new InstagramAccount();
                HttpResponseMessage response = await WebApiReq.GetReq("api/ApiInstagramAccount/GetInstagramAccount?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken);
                if (response.IsSuccessStatusCode)
                {
                    instAcc = await response.Content.ReadAsAsync<Domain.Socioboard.Domain.InstagramAccount>();
                    objSocialSiteAccount = instAcc;
                }
            }
            else if (objGroupProfile.ProfileType == "youtube")
            {
                //using (Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount())
                //{

                //    ApiobjYoutubeAccount.Timeout = 300000;
                //    objSocialSiteAccount = (YoutubeAccount)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetYoutubeAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(YoutubeAccount)));

                //}

                YoutubeAccount ytAcc = new YoutubeAccount();
                HttpResponseMessage response = await WebApiReq.GetReq("api/ApiYoutubeAccount/GetYoutubeAccount?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken);
                if (response.IsSuccessStatusCode)
                {
                    ytAcc = await response.Content.ReadAsAsync<Domain.Socioboard.Domain.YoutubeAccount>();
                    objSocialSiteAccount = ytAcc;
                }
            }
            else if (objGroupProfile.ProfileType == "tumblr")
            {
                //using (Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount())
                //{

                //    ApiobjTumblrAccount.Timeout = 300000;
                //    objSocialSiteAccount = (TumblrAccount)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetTumblrAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(TumblrAccount)));

                //}
                TumblrAccount ytAcc = new TumblrAccount();
                HttpResponseMessage response = await WebApiReq.GetReq("api/ApiTumblrAccount/GetTumblrAccountDetailsById?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken);
                if (response.IsSuccessStatusCode)
                {
                    ytAcc = await response.Content.ReadAsAsync<Domain.Socioboard.Domain.TumblrAccount>();
                    objSocialSiteAccount = ytAcc;
                }

            }
            else if (objGroupProfile.ProfileType == "linkedincompanypage")
            {
                //using (Api.LinkedinCompanyPage.LinkedinCompanyPage objLinkedinCompanyPage = new Api.LinkedinCompanyPage.LinkedinCompanyPage())
                //{

                //    objLinkedinCompanyPage.Timeout = 300000;
                //    objSocialSiteAccount = (LinkedinCompanyPage)(new JavaScriptSerializer().Deserialize(objLinkedinCompanyPage.GetLinkedinCompanyPageDetailsByUserIdAndPageId(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(LinkedinCompanyPage)));
                //}

                LinkedinCompanyPage licompanypage = new LinkedinCompanyPage();
                HttpResponseMessage response = await WebApiReq.GetReq("api/ApiLinkedinCompanyPage/GetLinkedinCompanyPageDetailsByUserIdAndPageId?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken);
                if (response.IsSuccessStatusCode)
                {
                    licompanypage = await response.Content.ReadAsAsync<Domain.Socioboard.Domain.LinkedinCompanyPage>();
                    objSocialSiteAccount = licompanypage;
                }


            }
            else if (objGroupProfile.ProfileType == "gplus")
            {
                //using (Api.GooglePlusAccount.GooglePlusAccount ApiobjGooglePlusAccount = new Api.GooglePlusAccount.GooglePlusAccount())
                //{

                //    ApiobjGooglePlusAccount.Timeout = 300000;
                //    objSocialSiteAccount = (GooglePlusAccount)(new JavaScriptSerializer().Deserialize(ApiobjGooglePlusAccount.GetGooglePlusAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId), typeof(GooglePlusAccount)));

                //}
                GooglePlusAccount googlePlusAccount = new GooglePlusAccount();
                HttpResponseMessage response = await WebApiReq.GetReq("api/ApiGooglePlusAccount/GetGooglePlusAccount?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken);
                if (response.IsSuccessStatusCode)
                {
                    googlePlusAccount = await response.Content.ReadAsAsync<Domain.Socioboard.Domain.GooglePlusAccount>();
                    objSocialSiteAccount = googlePlusAccount;
                }
            }
            else if (objGroupProfile.ProfileType == "googleanalytics")
            {
                //using (Api.GoogleAnalyticsAccount.GoogleAnalyticsAccount ApiobjGoogleAnalyticsAccount = new Api.GoogleAnalyticsAccount.GoogleAnalyticsAccount())
                //{

                //    ApiobjGoogleAnalyticsAccount.Timeout = 300000;
                //    objSocialSiteAccount = (GoogleAnalyticsAccount)(new JavaScriptSerializer().Deserialize(ApiobjGoogleAnalyticsAccount.GetGooglePlusAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId), typeof(GoogleAnalyticsAccount)));

                //}
                GoogleAnalyticsAccount googlePlusAccount = new GoogleAnalyticsAccount();
                HttpResponseMessage response = await WebApiReq.GetReq("api/ApiGoogleAnalyticsAccount/GetGooglePlusAccountDetailsById?ProfileId=" + objGroupProfile.ProfileId + "&UserId=" + objUserid.ToString(), "Bearer", accesstoken);
                if (response.IsSuccessStatusCode)
                {
                    googlePlusAccount = await response.Content.ReadAsAsync<Domain.Socioboard.Domain.GoogleAnalyticsAccount>();
                    objSocialSiteAccount = googlePlusAccount;
                }
            }


            return objSocialSiteAccount;
        }