public LinkedInAccount getUserInformation(string liuserid) { //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 details of account. List <LinkedInAccount> objlst = session.CreateQuery("from LinkedInAccount where LinkedinUserId = :LinkedinUserId ") .SetParameter("LinkedinUserId", liuserid) .List <LinkedInAccount>().ToList <LinkedInAccount>(); LinkedInAccount result = new LinkedInAccount(); if (objlst.Count > 0) { result = objlst[0]; } return(result); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } } //End Transaction } //End Session }
/// <summary> /// FOR VIDEO. /// </summary> /// <param name="token"></param> /// <param name="account"></param> /// <param name="videoPath"></param> /// <param name="description"></param> /// <returns></returns> public LinkedInAPIResult <bool> SharePost(OAuthv2AccessToken token, LinkedInAccount account, string videoPath, string description) { try { var registerUploadResponse = RegisterVideoUpload(token, LinkedInRegisterUploadRequest.Create(account.UserId, account.PersonalOrOrganization)); if (!registerUploadResponse.IsSuccessful) { return(LinkedInAPIResult <bool> .Fail("An error has occured while trying to register video upload on LinkedIn. Details: " + registerUploadResponse.Message)); } var uploadResponse = UploadVideo(token, videoPath, registerUploadResponse.Entity.Value.UploadMechanism.ComLinkedinDigitalmediaUploadingMediaUploadHttpRequest.UploadUrl); if (!uploadResponse.IsSuccessful) { return(LinkedInAPIResult <bool> .Fail("An error has occured while trying to upload video on LinkedIn. Details: " + uploadResponse.Message)); } var createUgcPostResponse = CreateOrganicUGCPost(token, RequestCreateUGCPost.Create(account, registerUploadResponse.Entity.Value.Asset, description)); if (!createUgcPostResponse.IsSuccessful) { return(LinkedInAPIResult <bool> .Fail("An error has occured while trying to creating organic UGC post with video on LinkedIn. Details: " + createUgcPostResponse.Message)); } return(LinkedInAPIResult <bool> .Success(true)); } catch (Exception ex) { return(LinkedInAPIResult <bool> .Fail("An error has occured while trying publish post with video on LinkedIn. Details: " + ex.Message)); } }
/// <updateLinkedinUser> /// Update Linkedin User account details. /// </summary> /// <param name="liaccount">Set Values in a LinkedInAccount Class Property and Pass the Object of LinkedInAccount Class (SocioBoard.Domain.LinkedInAccount).</param> public void updateLinkedinUser(LinkedInAccount liaccount) { using (NHibernate.ISession session = SessionFactory.GetNewSession()) { using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { session.CreateQuery("Update LinkedInAccount set LinkedinUserName =:LinkedinUserName,OAuthToken =:OAuthToken,OAuthSecret=:OAuthSecret,OAuthVerifier=:OAuthVerifier,EmailId=:EmailId,Connections=:Connections,ProfileUrl =:profileurl,ProfileImageUrl=:profilepicurl where LinkedinUserId = :LinkedinUserId and UserId = :UserId") .SetParameter("LinkedinUserName", liaccount.LinkedinUserName) .SetParameter("OAuthToken", liaccount.OAuthToken) .SetParameter("OAuthSecret", liaccount.OAuthSecret) .SetParameter("OAuthVerifier", liaccount.OAuthVerifier) .SetParameter("EmailId", liaccount.EmailId) .SetParameter("LinkedinUserId", liaccount.LinkedinUserId) .SetParameter("UserId", liaccount.UserId) .SetParameter("profileurl", liaccount.ProfileUrl) .SetParameter("profilepicurl", liaccount.ProfileImageUrl) .SetParameter("Connections", liaccount.Connections) .ExecuteUpdate(); transaction.Commit(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); // return 0; } } } }
public void _Init() { this.DefaultEmptyOnStartEventStore = new InMemoryEventStore(); this.UserJanKowaski = LinkedInAccount.ZeroState(); this.UserBillGates = LinkedInAccount.ZeroState(); }
/// <getUserInformation> /// Get user linkedin account information /// </summary> /// <param name="userid">User id (Guid)</param> /// <param name="liuserid">Linkedin account Id (String)</param> /// <returns>Return object of LinkedInAccount Class with value of each member.(Domain.LinkedInAccount)</returns> public LinkedInAccount getUserInformation(Guid userid, string liuserid) { //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 details of account. NHibernate.IQuery query = session.CreateQuery("from LinkedInAccount where LinkedinUserId = :LinkedinUserId And UserId=:UserId"); query.SetParameter("UserId", userid); query.SetParameter("LinkedinUserId", liuserid); LinkedInAccount result = query.UniqueResult <LinkedInAccount>(); return(result); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } } //End Transaction } //End Session }
public string FollowLinkedinPost(string GpPostid, string LinkedinUserId, string isFollowing, string userid) { int Following = Convert.ToInt32(isFollowing); string FollowStatus = string.Empty; if (Following == 0) { FollowStatus = "true"; } else { FollowStatus = "false"; } string authLink = string.Empty; LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository(); LinkedInAccount linkacc = linkedinAccRepo.getUserInformation(Guid.Parse(userid), LinkedinUserId); oAuthLinkedIn oauthlin = new oAuthLinkedIn(); oauthlin.ConsumerKey = ConfigurationManager.AppSettings["LiApiKey"]; oauthlin.ConsumerSecret = ConfigurationManager.AppSettings["LiSecretKey"]; oauthlin.FirstName = linkacc.LinkedinUserName; oauthlin.Id = linkacc.LinkedinUserId; oauthlin.Token = linkacc.OAuthToken; oauthlin.TokenSecret = linkacc.OAuthSecret; oauthlin.Verifier = linkacc.OAuthVerifier; GlobusLinkedinLib.LinkedIn.Core.SocialStreamMethods.SocialStream l = new GlobusLinkedinLib.LinkedIn.Core.SocialStreamMethods.SocialStream(); string status = l.SetFollowCountUpdate(oauthlin, GpPostid, FollowStatus); return("success"); }
/// <getLinkedinAccountDetailsById> /// Get linkedin account details by id /// </summary> /// <param name="liuserid"></param> /// <returns>Return object of LinkedInAccount Class with value of each member.(Domain.LinkedInAccount)</returns> public LinkedInAccount getLinkedinAccountDetailsById(string liuserid) { //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 details. NHibernate.IQuery query = session.CreateQuery("from LinkedInAccount where LinkedinUserId = :userid"); query.SetParameter("userid", liuserid); LinkedInAccount result = new LinkedInAccount(); foreach (LinkedInAccount item in query.Enumerable <LinkedInAccount>()) { result = item; break; } return(result); } catch (Exception ex) { Console.WriteLine(ex.Message); return(null); } } //End Transaction } //End Session }
public ActionResult scheduler(string network, string profileid) { Dictionary <object, List <ScheduledMessage> > dictscheduler = new Dictionary <object, List <ScheduledMessage> >(); Api.Groups.Groups ApiobjGroups = new Api.Groups.Groups(); Domain.Socioboard.Domain.Groups objGroups = (Domain.Socioboard.Domain.Groups)(new JavaScriptSerializer().Deserialize(ApiobjGroups.GetGroupDetailsByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Groups))); if (network == "facebook") { Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); FacebookAccount objFacebookAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objGroups.UserId.ToString(), profileid.ToString()), typeof(FacebookAccount))); Api.ScheduledMessage.ScheduledMessage ApiobjScheduledMessage = new Api.ScheduledMessage.ScheduledMessage(); List <ScheduledMessage> objScheduledMessage = (List <ScheduledMessage>)(new JavaScriptSerializer().Deserialize(ApiobjScheduledMessage.GetAllUnSentMessagesAccordingToGroup(objGroups.UserId.ToString(), profileid.ToString(), network), typeof(List <ScheduledMessage>))); dictscheduler.Add(objFacebookAccount, objScheduledMessage); } else if (network == "twitter") { Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount(); TwitterAccount objTwitterAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objGroups.UserId.ToString(), profileid.ToString()), typeof(TwitterAccount))); Api.ScheduledMessage.ScheduledMessage ApiobjScheduledMessage = new Api.ScheduledMessage.ScheduledMessage(); List <ScheduledMessage> objScheduledMessage = (List <ScheduledMessage>)(new JavaScriptSerializer().Deserialize(ApiobjScheduledMessage.GetAllUnSentMessagesAccordingToGroup(objGroups.UserId.ToString(), profileid.ToString(), network), typeof(List <ScheduledMessage>))); dictscheduler.Add(objTwitterAccount, objScheduledMessage); } else if (network == "linkedin") { Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount(); LinkedInAccount objLinkedInAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetLinkedinAccountDetailsById(objGroups.UserId.ToString(), profileid.ToString()), typeof(LinkedInAccount))); Api.ScheduledMessage.ScheduledMessage ApiobjScheduledMessage = new Api.ScheduledMessage.ScheduledMessage(); List <ScheduledMessage> objScheduledMessage = (List <ScheduledMessage>)(new JavaScriptSerializer().Deserialize(ApiobjScheduledMessage.GetAllUnSentMessagesAccordingToGroup(objGroups.UserId.ToString(), profileid.ToString(), network), typeof(List <ScheduledMessage>))); dictscheduler.Add(objLinkedInAccount, objScheduledMessage); } return(PartialView("_Panel3Partial", dictscheduler)); }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { if (Session["AdminProfile"] == null) { Response.Redirect("Default.aspx"); } string id = Request.QueryString["id"].ToString(); string type = Request.QueryString["type"].ToString(); string userid = Request.QueryString["userid"].ToString(); if (type == "twt") { TwtAcc = objTwtRepo.getUserInformation(Guid.Parse(userid), id); Session["updateData"] = TwtAcc; txtName.Text = TwtAcc.TwitterScreenName; //ddltatus.SelectedValue = TwtAcc.IsActive.ToString(); } if (type == "fb") { FBAcc = objFbRepo.getFacebookAccountDetailsById(id, Guid.Parse(userid)); Session["updateData"] = FBAcc; txtName.Text = FBAcc.FbUserName; // ddltatus.SelectedValue = FBAcc.IsActive.ToString(); } if (type == "li") { liAcc = objLiRepo.getLinkedinAccountDetailsById(id); Session["updateData"] = liAcc; txtName.Text = liAcc.LinkedinUserName; // ddltatus.SelectedValue = liAcc.IsActive.ToString(); } if (type == "ins") { InsAcc = objInsRepo.getInstagramAccountDetailsById(id, Guid.Parse(userid)); Session["updateData"] = InsAcc; txtName.Text = InsAcc.InsUserName; // ddltatus.SelectedValue = InsAcc.IsActive.ToString(); } if (type == "gp") { GpAcc = objgpRepo.getGooglePlusAccountDetailsById(id, Guid.Parse(userid)); Session["updateData"] = GpAcc; txtName.Text = GpAcc.GpUserName; //ddltatus.SelectedValue = GpAcc.IsActive.ToString(); } } } catch (Exception Err) { logger.Error(Err.Message); } }
public ActionResult EditProfileDetails(string ProfileId, string UserId, string Network) { Dictionary <string, object> objProfileToEdit = new Dictionary <string, object>(); if (Network == "Facebook") { Api.FacebookAccount.FacebookAccount Apiobjfb = new Api.FacebookAccount.FacebookAccount(); FacebookAccount objFbAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(Apiobjfb.getFacebookAccountDetailsById(UserId, ProfileId), typeof(FacebookAccount))); Session["UpdateProfileData"] = objFbAccount; objProfileToEdit.Add("Facebook", objFbAccount); } if (Network == "Twitter") { Api.TwitterAccount.TwitterAccount Apiobjtwt = new Api.TwitterAccount.TwitterAccount(); TwitterAccount objtwtAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(Apiobjtwt.GetTwitterAccountDetailsById(UserId, ProfileId), typeof(TwitterAccount))); Session["UpdateProfileData"] = objtwtAccount; objProfileToEdit.Add("Twitter", objtwtAccount); } if (Network == "Linkedin") { Api.LinkedinAccount.LinkedinAccount Apiobjlin = new Api.LinkedinAccount.LinkedinAccount(); LinkedInAccount objLinAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(Apiobjlin.GetLinkedinAccountDetailsById(UserId, ProfileId), typeof(LinkedInAccount))); Session["UpdateProfileData"] = objLinAccount; objProfileToEdit.Add("Linkedin", objLinAccount); } if (Network == "Instagram") { Api.InstagramAccount.InstagramAccount ApiobjIns = new Api.InstagramAccount.InstagramAccount(); InstagramAccount objInsAccount = (InstagramAccount)(new JavaScriptSerializer().Deserialize(ApiobjIns.UserInformation(UserId, ProfileId), typeof(InstagramAccount))); Session["UpdateProfileData"] = objInsAccount; objProfileToEdit.Add("Instagram", objInsAccount); } if (Network == "Tumblr") { Api.TumblrAccount.TumblrAccount Apiobjtmb = new Api.TumblrAccount.TumblrAccount(); TumblrAccount objTmbAccount = (TumblrAccount)(new JavaScriptSerializer().Deserialize(Apiobjtmb.GetTumblrAccountDetailsById(UserId, ProfileId), typeof(TumblrAccount))); Session["UpdateProfileData"] = objTmbAccount; objProfileToEdit.Add("Tumblr", objTmbAccount); } if (Network == "Youtube") { Api.YoutubeAccount.YoutubeAccount ApiobjYoutb = new Api.YoutubeAccount.YoutubeAccount(); YoutubeAccount objYouTbAccount = (YoutubeAccount)(new JavaScriptSerializer().Deserialize(ApiobjYoutb.GetYoutubeAccountDetailsById(UserId, ProfileId), typeof(YoutubeAccount))); Session["UpdateProfileData"] = objYouTbAccount; objProfileToEdit.Add("Youtube", objYouTbAccount); } if (Network == "GooglePlus") { Api.GooglePlusAccount.GooglePlusAccount Apiobjgplus = new Api.GooglePlusAccount.GooglePlusAccount(); GooglePlusAccount objGPAccount = (GooglePlusAccount)(new JavaScriptSerializer().Deserialize(Apiobjgplus.GetGooglePlusAccountDetailsById(UserId, ProfileId), typeof(GooglePlusAccount))); Session["UpdateProfileData"] = objGPAccount; objProfileToEdit.Add("GooglePlus", objGPAccount); } return(View(objProfileToEdit)); }
/// <addLinkedinUser> /// Add Linked in User /// </summary> /// <param name="linkedInAccount">Set Values in a LinkedInAccount Class Property and Pass the Object of LinkedInAccount Class (SocioBoard.Domain.LinkedInAccount).</param> public void addLinkedinUser(LinkedInAccount linkedInAccount) { //Creates a database connection and opens up a session using (NHibernate.ISession session = SessionFactory.GetNewSession()) { //After Session creation, start Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { //Proceed action, to save data session.Save(linkedInAccount); transaction.Commit(); } //End Transaction } //End Session }
public override void PostScheduleMessage(dynamic data) { try { LinkedInAccountRepository linkedinrepo = new LinkedInAccountRepository(); LinkedInAccount linkedinaccount = linkedinrepo.getLinkedinAccountDetailsById(data.ProfileId); Console.WriteLine("========================================================================="); // IEnumerable<LinkedInAccount> lstlinkedinaccount = linkedinrepo.getLinkedinAccountDetailsById(data.ProfileId); //foreach (LinkedInAccount item in lstlinkedinaccount) //{ // linkedinaccount = item; // break; //} oAuthLinkedIn Linkedin_oauth = new oAuthLinkedIn(); Linkedin_oauth.ConsumerKey = System.Configuration.ConfigurationSettings.AppSettings["LiApiKey"].ToString(); Linkedin_oauth.ConsumerSecret = System.Configuration.ConfigurationSettings.AppSettings["LiSecretKey"].ToString(); Linkedin_oauth.FirstName = linkedinaccount.LinkedinUserName; Linkedin_oauth.Token = linkedinaccount.OAuthToken; Linkedin_oauth.TokenSecret = linkedinaccount.OAuthSecret; Linkedin_oauth.Verifier = linkedinaccount.OAuthVerifier; LinkedInUser linkeduser = new LinkedInUser(); var response = linkeduser.SetStatusUpdate(Linkedin_oauth, data.ShareMessage); Console.WriteLine("Message post on linkedin for Id :" + linkedinaccount.LinkedinUserId + " and Message: " + data.ShareMessage); Console.WriteLine("============================================================="); ScheduledMessageRepository schrepo = new ScheduledMessageRepository(); ScheduledMessage schmsg = new ScheduledMessage(); schmsg.Id = data.Id; schmsg.ProfileId = data.ProfileId; schmsg.ProfileType = "linkedin"; schmsg.Status = true; schmsg.UserId = data.UserId; schmsg.ShareMessage = data.ShareMessage; schmsg.ScheduleTime = data.ScheduleTime; schmsg.ClientTime = data.ClientTime; schmsg.CreateTime = data.CreateTime; schmsg.PicUrl = data.PicUrl; schrepo.updateMessage(data.Id); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } }
public string UserInformation(string UserId, string LinkedinId) { try { Guid Userid = Guid.Parse(UserId); LinkedInAccountRepository linkedinaccrepo = new LinkedInAccountRepository(); LinkedInAccount LinkedAccount = linkedinaccrepo.getUserInformation(Userid, LinkedinId); return(new JavaScriptSerializer().Serialize(LinkedAccount)); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(new JavaScriptSerializer().Serialize("Please Try Again")); } }
public string GetNetworkUpdates(string UserId, string LinkedInId) { try { Guid userid = Guid.Parse(UserId); LinkedInAccountRepository linkedinAccountRepo = new LinkedInAccountRepository(); LinkedInAccount linkedAcc = linkedinAccountRepo.getUserInformation(userid, LinkedInId); LinkedInFeedRepository linkedinfeedrepo = new LinkedInFeedRepository(); List <LinkedInFeed> lstlinkedinfeeds = linkedinfeedrepo.getAllLinkedInFeedsOfProfile(LinkedInId); return(new JavaScriptSerializer().Serialize(lstlinkedinfeeds)); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(new JavaScriptSerializer().Serialize("Please Try Again")); } }
public string PostLinkedInGroupFeeds(string gid, string linkedInUserId, string msg, string title, string userid) { string authLink = string.Empty; LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository(); LinkedInAccount linkacc = linkedinAccRepo.getUserInformation(Guid.Parse(userid), linkedInUserId); oAuthLinkedIn oauthlin = new oAuthLinkedIn(); oauthlin.ConsumerKey = ConfigurationManager.AppSettings["LiApiKey"]; oauthlin.ConsumerSecret = ConfigurationManager.AppSettings["LiSecretKey"]; oauthlin.FirstName = linkacc.LinkedinUserName; oauthlin.Id = linkacc.LinkedinUserId; oauthlin.Token = linkacc.OAuthToken; oauthlin.TokenSecret = linkacc.OAuthSecret; oauthlin.Verifier = linkacc.OAuthVerifier; GlobusLinkedinLib.LinkedIn.Core.SocialStreamMethods.SocialStream l = new GlobusLinkedinLib.LinkedIn.Core.SocialStreamMethods.SocialStream(); string status = l.SetPostUpdate(oauthlin, gid, msg, title); return("success"); }
public string GetLinkedGroupsDataDetail(string userid, string groupid, string linkedinId) { string authLink = string.Empty; LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository(); LinkedInAccount linkacc = linkedinAccRepo.getUserInformation(Guid.Parse(userid), linkedinId); oAuthLinkedIn oauthlin = new oAuthLinkedIn(); oauthlin.ConsumerKey = ConfigurationManager.AppSettings["LiApiKey"]; oauthlin.ConsumerSecret = ConfigurationManager.AppSettings["LiSecretKey"]; oauthlin.FirstName = linkacc.LinkedinUserName; oauthlin.Id = linkacc.LinkedinUserId; oauthlin.Token = linkacc.OAuthToken; oauthlin.TokenSecret = linkacc.OAuthSecret; oauthlin.Verifier = linkacc.OAuthVerifier; GlobusLinkedinLib.App.Core.LinkedInGroup l = new GlobusLinkedinLib.App.Core.LinkedInGroup(); List <Domain.Socioboard.Domain.LinkedInGroup.Group_Updates> lst = l.GetGroupPostData(oauthlin, 20, groupid, linkedinId); return(new JavaScriptSerializer().Serialize(lst)); }
public string GetLinkedUserUpdates(string profileid, string UserId) { string authLink = string.Empty; LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository(); LinkedInAccount linkacc = linkedinAccRepo.getUserInformation(Guid.Parse(UserId), profileid); oAuthLinkedIn oauthlin = new oAuthLinkedIn(); oauthlin.ConsumerKey = ConfigurationManager.AppSettings["LiApiKey"]; oauthlin.ConsumerSecret = ConfigurationManager.AppSettings["LiSecretKey"]; oauthlin.FirstName = linkacc.LinkedinUserName; oauthlin.Id = linkacc.LinkedinUserId; oauthlin.Token = linkacc.OAuthToken; oauthlin.TokenSecret = linkacc.OAuthSecret; oauthlin.Verifier = linkacc.OAuthVerifier; GlobusLinkedinLib.App.Core.LinkedInUser l = new GlobusLinkedinLib.App.Core.LinkedInUser(); List <Domain.Socioboard.Domain.LinkedInUser.User_Updates> lst = l.GetUserUpdate(oauthlin, linkacc.LinkedinUserId, 10); return(new JavaScriptSerializer().Serialize(lst)); }
public void GetLinkedInUserProfile(dynamic data, oAuthLinkedIn _oauth, Guid user, string LinkedinUserId) { LinkedInAccount objLinkedInAccount = new LinkedInAccount(); LinkedInAccountRepository objLiRepo = new LinkedInAccountRepository(); try { objLinkedInAccount.UserId = user; objLinkedInAccount.LinkedinUserId = data.id.ToString(); try { objLinkedInAccount.EmailId = data.email.ToString(); } catch { } objLinkedInAccount.LinkedinUserName = data.first_name.ToString() + data.last_name.ToString(); objLinkedInAccount.OAuthToken = _oauth.Token; objLinkedInAccount.OAuthSecret = _oauth.TokenSecret; objLinkedInAccount.OAuthVerifier = _oauth.Verifier; try { objLinkedInAccount.ProfileImageUrl = data.picture_url.ToString(); } catch { } try { objLinkedInAccount.ProfileUrl = data.profile_url.ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } objLinkedInAccount.Connections = data.connections; objLinkedInAccount.IsActive = true; objLiRepo.updateLinkedinUser(objLinkedInAccount); } catch { } }
public string GetLinkedinAccountDetailsById(string UserId, string LinkedinId) { Domain.Socioboard.Domain.LinkedInAccount LinkedAccount = new LinkedInAccount(); try { Guid Userid = Guid.Parse(UserId); if (objlinkedinaccrepo.checkLinkedinUserExists(LinkedinId, Userid)) { LinkedAccount = objlinkedinaccrepo.getUserInformation(Userid, LinkedinId); } else { LinkedAccount = objlinkedinaccrepo.getUserInformation(LinkedinId); } return(new JavaScriptSerializer().Serialize(LinkedAccount)); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(new JavaScriptSerializer().Serialize("Please Try Again")); } }
public static RequestCreateUGCPost Create(LinkedInAccount account, string asset, string description) { var request = new RequestCreateUGCPost(); request.Author = account.UserId.ToOwnerInfo(account.PersonalOrOrganization); request.LifecycleState = "PUBLISHED"; request.SpecificContent.ComLinkedinUgcShareContent.Media = new List <Medium>(); request.SpecificContent.ComLinkedinUgcShareContent.Media.Add(new Medium() { Media = asset, Status = "READY", Title = new Title() { Text = description } }); request.SpecificContent.ComLinkedinUgcShareContent.ShareCommentary = new ShareCommentary(); request.SpecificContent.ComLinkedinUgcShareContent.ShareCommentary.Text = description; request.SpecificContent.ComLinkedinUgcShareContent.ShareMediaCategory = "VIDEO"; request.Visibility = new Visibility(); request.Visibility.ComLinkedinUgcMemberNetworkVisibility = "PUBLIC"; return(request); }
string GetProfileImage(string ProfileId, string ProfileType) { Domain.Socioboard.Domain.User objuser = (Domain.Socioboard.Domain.User)Session["User"]; string profileImg = "/Themes/@path/Contents/img/anonymousUser.jpg"; string profileName = ""; if (ProfileType.Equals("facebook")) { Socioboard.Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Socioboard.Api.FacebookAccount.FacebookAccount(); FacebookAccount objFacebookAccount = (FacebookAccount)(new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objuser.Id.ToString(), ProfileId), typeof(FacebookAccount))); profileName = objFacebookAccount.FbUserName; profileImg = "http://graph.facebook.com/" + objFacebookAccount.FbUserId + "/picture?type=small"; } else if (ProfileType.Equals("twitter")) { Socioboard.Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Socioboard.Api.TwitterAccount.TwitterAccount(); TwitterAccount objTwitterAccount = (TwitterAccount)(new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objuser.Id.ToString(), ProfileId), typeof(TwitterAccount))); profileName = objTwitterAccount.TwitterScreenName; profileImg = objTwitterAccount.ProfileImageUrl; } else if (ProfileType.Equals("linkedin")) { Socioboard.Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Socioboard.Api.LinkedinAccount.LinkedinAccount(); LinkedInAccount objLinkedInAccount = (LinkedInAccount)(new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetLinkedinAccountDetailsById(objuser.Id.ToString(), ProfileId), typeof(LinkedInAccount))); profileName = objLinkedInAccount.LinkedinUserName; profileImg = objLinkedInAccount.ProfileImageUrl; } else if (ProfileType.Equals("tumblr")) { Socioboard.Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Socioboard.Api.TumblrAccount.TumblrAccount(); TumblrAccount objTumblrAccount = (TumblrAccount)(new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetTumblrAccountDetailsById(objuser.Id.ToString(), ProfileId), typeof(TumblrAccount))); profileName = objTumblrAccount.tblrUserName; profileImg = "http://api.tumblr.com/v2/blog/" + objTumblrAccount.tblrUserName + ".tumblr.com/avatar"; } return(profileImg + "," + profileName); }
public void GetLinkedInUserProfile(dynamic data, oAuthLinkedIn _oauth, Guid user, string LinkedinUserId) { SocialProfile socioprofile = new SocialProfile(); SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository(); LinkedInAccount objLinkedInAccount = new LinkedInAccount(); LinkedInAccountRepository objLiRepo = new LinkedInAccountRepository(); try { objLinkedInAccount.UserId = user; objLinkedInAccount.LinkedinUserId = data.id.ToString(); try { objLinkedInAccount.EmailId = data.email.ToString(); } catch { } objLinkedInAccount.LinkedinUserName = data.first_name.ToString() + data.last_name.ToString(); objLinkedInAccount.OAuthToken = _oauth.Token; objLinkedInAccount.OAuthSecret = _oauth.TokenSecret; objLinkedInAccount.OAuthVerifier = _oauth.Verifier; try { objLinkedInAccount.ProfileImageUrl = data.picture_url.ToString(); } catch { } try { objLinkedInAccount.ProfileUrl = data.profile_url.ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } objLinkedInAccount.Connections = data.connections; objLinkedInAccount.IsActive = true; socioprofile.UserId = user; socioprofile.ProfileType = "linkedin"; socioprofile.ProfileId = LinkedinUserId; socioprofile.ProfileStatus = 1; socioprofile.ProfileDate = DateTime.Now; socioprofile.Id = Guid.NewGuid(); } catch { } try { if (!socioprofilerepo.checkUserProfileExist(socioprofile)) { socioprofilerepo.addNewProfileForUser(socioprofile); GroupRepository objGroupRepository = new GroupRepository(); SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)HttpContext.Current.Session["GroupName"]; Groups lstDetails = objGroupRepository.getGroupName(team.GroupId); if (lstDetails.GroupName == "Socioboard") { TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository(); TeamMemberProfile teammemberprofile = new TeamMemberProfile(); teammemberprofile.Id = Guid.NewGuid(); teammemberprofile.TeamId = team.Id; teammemberprofile.ProfileId = socioprofile.ProfileId; teammemberprofile.ProfileType = "linkedin"; teammemberprofile.StatusUpdateDate = DateTime.Now; objTeamMemberProfileRepository.addNewTeamMember(teammemberprofile); } } else { socioprofile.ProfileId = data.id.ToString(); socioprofilerepo.updateSocialProfile(socioprofile); } if (!objLiRepo.checkLinkedinUserExists(LinkedinUserId, user)) { objLiRepo.addLinkedinUser(objLinkedInAccount); } else { objLinkedInAccount.LinkedinUserId = LinkedinUserId; objLiRepo.updateLinkedinUser(objLinkedInAccount); } // GetLinkedInFeeds(_oauth, data.id, user.Id); } catch { } }
public string ProfilesConnected(string UserId) { try { Guid userid = Guid.Parse(UserId); SocialProfilesRepository socialRepo = new SocialProfilesRepository(); List <SocialProfile> lstsocioprofile = socialRepo.getAllSocialProfilesOfUser(userid); List <profileConnected> lstProfile = new List <profileConnected>(); foreach (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(); 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(); 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(); 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(); 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(); GooglePlusAccount objGpAcc = objGpAccRepo.getUserDetails(sp.ProfileId); pc.ProfileName = objGpAcc.GpUserName; pc.ProfileImgUrl = objGpAcc.GpProfileImage; } 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 static Dictionary <Domain.Socioboard.Domain.TeamMemberProfile, Dictionary <object, List <object> > > GetUserProfilesSnapsAccordingToGroup(List <Domain.Socioboard.Domain.TeamMemberProfile> TeamMemberProfile) { User objUser = (User)System.Web.HttpContext.Current.Session["User"]; Dictionary <Domain.Socioboard.Domain.TeamMemberProfile, Dictionary <object, List <object> > > dic_profilessnap = new Dictionary <Domain.Socioboard.Domain.TeamMemberProfile, Dictionary <object, List <object> > >(); var dicprofilefeeds = new Dictionary <object, List <object> >(); foreach (Domain.Socioboard.Domain.TeamMemberProfile item in TeamMemberProfile) { List <object> feeds = null; if (item.ProfileType == "facebook") { feeds = new List <object>(); Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); FacebookAccount objFacebookAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(FacebookAccount))); Api.FacebookFeed.FacebookFeed ApiobjFacebookFeed = new Api.FacebookFeed.FacebookFeed(); List <FacebookFeed> lstFacebookFeed = (List <FacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List <FacebookFeed>))); foreach (var facebookfeed in lstFacebookFeed) { feeds.Add(facebookfeed); } dicprofilefeeds.Add(objFacebookAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } if (item.ProfileType == "twitter") { 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(); List <TwitterFeed> lstTwitterFeed = (List <TwitterFeed>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.GetAllTwitterFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List <TwitterFeed>))); foreach (var twitterfeed in lstTwitterFeed) { feeds.Add(twitterfeed); } dicprofilefeeds.Add(objTwitterAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } if (item.ProfileType == "linkedin") { feeds = new List <object>(); Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount(); LinkedInAccount objLinkedInAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetLinkedinAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(LinkedInAccount))); Api.LinkedInFeed.LinkedInFeed ApiobjLinkedInFeed = new Api.LinkedInFeed.LinkedInFeed(); List <LinkedInFeed> lstLinkedInFeed = (List <LinkedInFeed>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedInFeed.GetLinkedInFeeds(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List <LinkedInFeed>))); foreach (var LinkedInFeed in lstLinkedInFeed) { feeds.Add(LinkedInFeed); } dicprofilefeeds.Add(objLinkedInAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } if (item.ProfileType == "instagram") { feeds = new List <object>(); Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount(); 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); } if (item.ProfileType == "tumblr") { feeds = new List <object>(); Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount(); 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); } if (item.ProfileType == "youtube") { feeds = new List <object>(); Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount(); YoutubeAccount objYoutubeAccount = (YoutubeAccount)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetYoutubeAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(YoutubeAccount))); Api.YoutubeChannel.YoutubeChannel ApiobjYoutubeChannel = new Api.YoutubeChannel.YoutubeChannel(); YoutubeChannel objYoutubeChannel = (YoutubeChannel)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeChannel.GetAllYoutubeChannelByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(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); } } 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); }
protected void btnRegister_Click(object sender, ImageClickEventArgs e) { User user = new User(); UserRepository userrepo = new UserRepository(); SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml"); try { if (txtPassword.Text == txtConfirmPassword.Text) { user.PaymentStatus = "unpaid"; user.AccountType = Request.QueryString["type"]; if (user.AccountType == string.Empty) { user.AccountType = AccountType.Deluxe.ToString(); } user.CreateDate = DateTime.Now; user.ExpiryDate = DateTime.Now.AddMonths(1); user.Id = Guid.NewGuid(); user.UserName = txtFirstName.Text + " " + txtLastName.Text; user.Password = this.MD5Hash(txtPassword.Text); user.EmailId = txtEmail.Text; user.UserStatus = 1; if (!userrepo.IsUserExist(user.EmailId)) { UserRepository.Add(user); SocioBoard.Helper.MailSender.SendEMail(txtFirstName.Text + " " + txtLastName.Text, txtPassword.Text, txtEmail.Text); TeamRepository teamRepo = new TeamRepository(); Team team = teamRepo.getTeamByEmailId(txtEmail.Text); if (team != null) { Guid teamid = Guid.Parse(Request.QueryString["tid"]); teamRepo.updateTeamStatus(teamid); TeamMemberProfileRepository teamMemRepo = new TeamMemberProfileRepository(); List <TeamMemberProfile> lstteammember = teamMemRepo.getAllTeamMemberProfilesOfTeam(team.Id); foreach (TeamMemberProfile item in lstteammember) { try { SocialProfilesRepository socialRepo = new SocialProfilesRepository(); SocialProfile socioprofile = new SocialProfile(); socioprofile.Id = Guid.NewGuid(); socioprofile.ProfileDate = DateTime.Now; socioprofile.ProfileId = item.ProfileId; socioprofile.ProfileType = item.ProfileType; socioprofile.UserId = user.Id; socialRepo.addNewProfileForUser(socioprofile); if (item.ProfileType == "facebook") { try { FacebookAccount fbAccount = new FacebookAccount(); FacebookAccountRepository fbAccountRepo = new FacebookAccountRepository(); FacebookAccount userAccount = fbAccountRepo.getUserDetails(item.ProfileId); fbAccount.AccessToken = userAccount.AccessToken; fbAccount.EmailId = userAccount.EmailId; fbAccount.FbUserId = item.ProfileId; fbAccount.FbUserName = userAccount.FbUserName; fbAccount.Friends = userAccount.Friends; fbAccount.Id = Guid.NewGuid(); fbAccount.IsActive = true; fbAccount.ProfileUrl = userAccount.ProfileUrl; fbAccount.Type = userAccount.Type; fbAccount.UserId = user.Id; fbAccountRepo.addFacebookUser(fbAccount); } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "twitter") { try { TwitterAccount twtAccount = new TwitterAccount(); TwitterAccountRepository twtAccRepo = new TwitterAccountRepository(); TwitterAccount twtAcc = twtAccRepo.getUserInfo(item.ProfileId); twtAccount.FollowersCount = twtAcc.FollowersCount; twtAccount.FollowingCount = twtAcc.FollowingCount; twtAccount.Id = Guid.NewGuid(); twtAccount.IsActive = true; twtAccount.OAuthSecret = twtAcc.OAuthSecret; twtAccount.OAuthToken = twtAcc.OAuthToken; twtAccount.ProfileImageUrl = twtAcc.ProfileImageUrl; twtAccount.ProfileUrl = twtAcc.ProfileUrl; twtAccount.TwitterName = twtAcc.TwitterName; twtAccount.TwitterScreenName = twtAcc.TwitterScreenName; twtAccount.TwitterUserId = twtAcc.TwitterUserId; twtAccount.UserId = user.Id; twtAccRepo.addTwitterkUser(twtAccount); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); logger.Error(ex.Message); } } else if (item.ProfileType == "instagram") { try { InstagramAccount insAccount = new InstagramAccount(); InstagramAccountRepository insAccRepo = new InstagramAccountRepository(); InstagramAccount InsAcc = insAccRepo.getInstagramAccountById(item.ProfileId); insAccount.AccessToken = InsAcc.AccessToken; insAccount.FollowedBy = InsAcc.FollowedBy; insAccount.Followers = InsAcc.Followers; insAccount.Id = Guid.NewGuid(); insAccount.InstagramId = item.ProfileId; insAccount.InsUserName = InsAcc.InsUserName; insAccount.IsActive = true; insAccount.ProfileUrl = InsAcc.ProfileUrl; insAccount.TotalImages = InsAcc.TotalImages; insAccount.UserId = user.Id; insAccRepo.addInstagramUser(insAccount); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); logger.Error(ex.Message); } } else if (item.ProfileType == "linkedin") { try { LinkedInAccount linkAccount = new LinkedInAccount(); LinkedInAccountRepository linkedAccountRepo = new LinkedInAccountRepository(); LinkedInAccount linkAcc = linkedAccountRepo.getLinkedinAccountDetailsById(item.ProfileId); linkAccount.Id = Guid.NewGuid(); linkAccount.IsActive = true; linkAccount.LinkedinUserId = item.ProfileId; linkAccount.LinkedinUserName = linkAcc.LinkedinUserName; linkAccount.OAuthSecret = linkAcc.OAuthSecret; linkAccount.OAuthToken = linkAcc.OAuthToken; linkAccount.OAuthVerifier = linkAcc.OAuthVerifier; linkAccount.ProfileImageUrl = linkAcc.ProfileImageUrl; linkAccount.ProfileUrl = linkAcc.ProfileUrl; linkAccount.UserId = user.Id; linkedAccountRepo.addLinkedinUser(linkAccount); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); logger.Error(ex.Message); } } } catch (Exception ex) { logger.Error(ex.Message); } } } lblerror.Text = "Registered Successfully !" + "<a href=\"Default.aspx\">Login</a>"; } else { lblerror.Text = "Email Already Exists " + "<a href=\"Default.aspx\">login</a>"; } } } catch (Exception ex) { logger.Error(ex.StackTrace); lblerror.Text = "Please Insert Correct Information"; Console.WriteLine(ex.StackTrace); } }
protected void btnSave_Click(object sender, EventArgs e) { try { bool status = false; string type = Request.QueryString["type"].ToString(); if (Session["updateData"] != null) { if (type == "twt") { TwitterAccount twtAcc = (TwitterAccount)Session["updateData"]; //if (ddltatus.SelectedValue == "1") status = true; twtAcc.TwitterScreenName = txtName.Text; twtAcc.IsActive = status; objTwtRepo.updateTwitterUser(twtAcc); } if (type == "fb") { FacebookAccount fbAcc = (FacebookAccount)Session["updateData"]; // if (ddltatus.SelectedValue == "1") FBAcc.FbUserName = txtName.Text; status = true; fbAcc.IsActive = 1; objFbRepo.updateFacebookUser(fbAcc); } if (type == "ins") { InstagramAccount insAcc = (InstagramAccount)Session["updateData"]; //if (ddltatus.SelectedValue == "1") InsAcc.InsUserName = txtName.Text; status = true; insAcc.IsActive = status; objInsRepo.updateInstagramUser(insAcc); } if (type == "li") { LinkedInAccount liAcc = (LinkedInAccount)Session["updateData"]; // if (ddltatus.SelectedValue == "1") liAcc.LinkedinUserName = txtName.Text; status = true; liAcc.IsActive = status; objLiRepo.updateLinkedinUser(liAcc); } if (type == "gp") { GooglePlusAccount gpAcc = (GooglePlusAccount)Session["updateData"]; // gpAcc.IsActive = int.Parse(ddltatus.SelectedValue); GpAcc.GpUserName = txtName.Text; gpAcc.IsActive = 1; objgpRepo.updateGooglePlusUser(gpAcc); } } } catch (Exception Err) { logger.Error(Err.Message); Response.Write(Err.StackTrace); } }
protected void btnRegister_Click(object sender, ImageClickEventArgs e) { try { User user = new User(); UserRepository userrepo = new UserRepository(); UserActivation objUserActivation = new UserActivation(); Coupon objCoupon = new Coupon(); CouponRepository objCouponRepository = new CouponRepository(); Groups groups = new Groups(); GroupRepository objGroupRepository = new GroupRepository(); Team teams = new Team(); TeamRepository objTeamRepository = new TeamRepository(); SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml"); try { if (DropDownList1.SelectedValue == "Free" || DropDownList1.SelectedValue == "Standard" || DropDownList1.SelectedValue == "Deluxe" || DropDownList1.SelectedValue == "Premium" || DropDownList1.SelectedValue == "SocioBasic" || DropDownList1.SelectedValue == "SocioStandard" || DropDownList1.SelectedValue == "SocioPremium" || DropDownList1.SelectedValue == "SocioDeluxe") { if (TextBox1.Text.Trim() != "") { string resp = SBUtils.GetCouponStatus(TextBox1.Text).ToString(); if (resp != "valid") { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('" + resp + "');", true); return; } } if (txtPassword.Text == txtConfirmPassword.Text) { user.PaymentStatus = "unpaid"; user.AccountType = DropDownList1.SelectedValue.ToString(); if (string.IsNullOrEmpty(user.AccountType)) { user.AccountType = AccountType.Free.ToString(); } user.CreateDate = DateTime.Now; user.ExpiryDate = DateTime.Now.AddDays(30); user.Id = Guid.NewGuid(); user.UserName = txtFirstName.Text + " " + txtLastName.Text; user.Password = this.MD5Hash(txtPassword.Text); user.EmailId = txtEmail.Text; user.UserStatus = 1; user.ActivationStatus = "0"; if (TextBox1.Text.Trim() != "") { user.CouponCode = TextBox1.Text.Trim().ToString(); } if (!userrepo.IsUserExist(user.EmailId)) { logger.Error("Before User reg"); UserRepository.Add(user); try { groups.Id = Guid.NewGuid(); groups.GroupName = ConfigurationManager.AppSettings["DefaultGroupName"]; groups.UserId = user.Id; groups.EntryDate = DateTime.Now; objGroupRepository.AddGroup(groups); teams.Id = Guid.NewGuid(); teams.GroupId = groups.Id; teams.UserId = user.Id; teams.EmailId = user.EmailId; objTeamRepository.addNewTeam(teams); BusinessSettingRepository busnrepo = new BusinessSettingRepository(); SocioBoard.Domain.BusinessSetting objbsnssetting = new SocioBoard.Domain.BusinessSetting(); if (!busnrepo.checkBusinessExists(user.Id, groups.GroupName)) { objbsnssetting.Id = Guid.NewGuid(); objbsnssetting.BusinessName = groups.GroupName; objbsnssetting.GroupId = groups.Id; objbsnssetting.AssigningTasks = false; objbsnssetting.AssigningTasks = false; objbsnssetting.TaskNotification = false; objbsnssetting.TaskNotification = false; objbsnssetting.FbPhotoUpload = 0; objbsnssetting.UserId = user.Id; objbsnssetting.EntryDate = DateTime.Now; busnrepo.AddBusinessSetting(objbsnssetting); } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error("Error : " + ex.Message); logger.Error("Error : " + ex.StackTrace); } try { logger.Error("1 Request.QueryString[refid]"); if (Request.QueryString["refid"] != null) { logger.Error("3 Request.QueryString[refid]"); User UserValid = null; if (IsUserValid(Request.QueryString["refid"].ToString(), ref UserValid)) { logger.Error("Inside IsUserValid"); user.RefereeStatus = "1"; UpdateUserReference(UserValid); AddUserRefreeRelation(user, UserValid); logger.Error("IsUserValid"); } else { user.RefereeStatus = "0"; } } logger.Error("2 Request.QueryString[refid]"); } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error("btnRegister_Click" + ex.Message); logger.Error("btnRegister_Click" + ex.StackTrace); } if (TextBox1.Text.Trim() != "") { objCoupon.CouponCode = TextBox1.Text.Trim(); List <Coupon> lstCoupon = objCouponRepository.GetCouponByCouponCode(objCoupon); objCoupon.Id = lstCoupon[0].Id; objCoupon.EntryCouponDate = lstCoupon[0].EntryCouponDate; objCoupon.ExpCouponDate = lstCoupon[0].ExpCouponDate; objCoupon.Status = "1"; objCouponRepository.SetCouponById(objCoupon); } Session["LoggedUser"] = user; objUserActivation.Id = Guid.NewGuid(); objUserActivation.UserId = user.Id; objUserActivation.ActivationStatus = "0"; UserActivationRepository.Add(objUserActivation); //add package start UserPackageRelation objUserPackageRelation = new UserPackageRelation(); UserPackageRelationRepository objUserPackageRelationRepository = new UserPackageRelationRepository(); PackageRepository objPackageRepository = new PackageRepository(); try { Package objPackage = objPackageRepository.getPackageDetails(user.AccountType); objUserPackageRelation.Id = Guid.NewGuid(); objUserPackageRelation.PackageId = objPackage.Id; objUserPackageRelation.UserId = user.Id; objUserPackageRelation.ModifiedDate = DateTime.Now; objUserPackageRelation.PackageStatus = true; objUserPackageRelationRepository.AddUserPackageRelation(objUserPackageRelation); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } //end package SocioBoard.Helper.MailSender.SendEMail(txtFirstName.Text, txtPassword.Text, txtEmail.Text, user.AccountType.ToString(), user.Id.ToString()); TeamRepository teamRepo = new TeamRepository(); try { Team team = teamRepo.getTeamByEmailId(txtEmail.Text); if (team != null) { Guid teamid = Guid.Parse(Request.QueryString["tid"]); teamRepo.updateTeamStatus(teamid); TeamMemberProfileRepository teamMemRepo = new TeamMemberProfileRepository(); List <TeamMemberProfile> lstteammember = teamMemRepo.getAllTeamMemberProfilesOfTeam(team.Id); foreach (TeamMemberProfile item in lstteammember) { try { SocialProfilesRepository socialRepo = new SocialProfilesRepository(); SocialProfile socioprofile = new SocialProfile(); socioprofile.Id = Guid.NewGuid(); socioprofile.ProfileDate = DateTime.Now; socioprofile.ProfileId = item.ProfileId; socioprofile.ProfileType = item.ProfileType; socioprofile.UserId = user.Id; socialRepo.addNewProfileForUser(socioprofile); if (item.ProfileType == "facebook") { try { FacebookAccount fbAccount = new FacebookAccount(); FacebookAccountRepository fbAccountRepo = new FacebookAccountRepository(); FacebookAccount userAccount = fbAccountRepo.getUserDetails(item.ProfileId); fbAccount.AccessToken = userAccount.AccessToken; fbAccount.EmailId = userAccount.EmailId; fbAccount.FbUserId = item.ProfileId; fbAccount.FbUserName = userAccount.FbUserName; fbAccount.Friends = userAccount.Friends; fbAccount.Id = Guid.NewGuid(); fbAccount.IsActive = 1; fbAccount.ProfileUrl = userAccount.ProfileUrl; fbAccount.Type = userAccount.Type; fbAccount.UserId = user.Id; fbAccountRepo.addFacebookUser(fbAccount); } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "twitter") { try { TwitterAccount twtAccount = new TwitterAccount(); TwitterAccountRepository twtAccRepo = new TwitterAccountRepository(); TwitterAccount twtAcc = twtAccRepo.getUserInfo(item.ProfileId); twtAccount.FollowersCount = twtAcc.FollowersCount; twtAccount.FollowingCount = twtAcc.FollowingCount; twtAccount.Id = Guid.NewGuid(); twtAccount.IsActive = true; twtAccount.OAuthSecret = twtAcc.OAuthSecret; twtAccount.OAuthToken = twtAcc.OAuthToken; twtAccount.ProfileImageUrl = twtAcc.ProfileImageUrl; twtAccount.ProfileUrl = twtAcc.ProfileUrl; twtAccount.TwitterName = twtAcc.TwitterName; twtAccount.TwitterScreenName = twtAcc.TwitterScreenName; twtAccount.TwitterUserId = twtAcc.TwitterUserId; twtAccount.UserId = user.Id; twtAccRepo.addTwitterkUser(twtAccount); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); logger.Error(ex.Message); } } else if (item.ProfileType == "instagram") { try { InstagramAccount insAccount = new InstagramAccount(); InstagramAccountRepository insAccRepo = new InstagramAccountRepository(); InstagramAccount InsAcc = insAccRepo.getInstagramAccountById(item.ProfileId); insAccount.AccessToken = InsAcc.AccessToken; insAccount.FollowedBy = InsAcc.FollowedBy; insAccount.Followers = InsAcc.Followers; insAccount.Id = Guid.NewGuid(); insAccount.InstagramId = item.ProfileId; insAccount.InsUserName = InsAcc.InsUserName; insAccount.IsActive = true; insAccount.ProfileUrl = InsAcc.ProfileUrl; insAccount.TotalImages = InsAcc.TotalImages; insAccount.UserId = user.Id; insAccRepo.addInstagramUser(insAccount); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); logger.Error(ex.Message); } } else if (item.ProfileType == "linkedin") { try { LinkedInAccount linkAccount = new LinkedInAccount(); LinkedInAccountRepository linkedAccountRepo = new LinkedInAccountRepository(); LinkedInAccount linkAcc = linkedAccountRepo.getLinkedinAccountDetailsById(item.ProfileId); linkAccount.Id = Guid.NewGuid(); linkAccount.IsActive = true; linkAccount.LinkedinUserId = item.ProfileId; linkAccount.LinkedinUserName = linkAcc.LinkedinUserName; linkAccount.OAuthSecret = linkAcc.OAuthSecret; linkAccount.OAuthToken = linkAcc.OAuthToken; linkAccount.OAuthVerifier = linkAcc.OAuthVerifier; linkAccount.ProfileImageUrl = linkAcc.ProfileImageUrl; linkAccount.ProfileUrl = linkAcc.ProfileUrl; linkAccount.UserId = user.Id; linkedAccountRepo.addLinkedinUser(linkAccount); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); logger.Error(ex.Message); } } } catch (Exception ex) { logger.Error(ex.Message); } } } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } #region SetInvitationStatusAfterSuccessfulRegistration try { if (Request.QueryString["refid"] != null) { string refid = Request.QueryString["refid"]; int res = SetInvitationStatusAfterSuccessfulRegistration(refid, txtEmail.Text); } } catch (Exception ex) { logger.Error(ex.Message); } #endregion try { lblerror.Text = "Registered Successfully !" + "<a href=\"Default.aspx\">Login</a>"; Response.Redirect("~/Home.aspx"); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else { lblerror.Text = "Email Already Exists " + "<a id=\"loginlink\" href=\"#\">login</a>"; } } } else { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please select Account Type!');", true); } } catch (Exception ex) { logger.Error(ex.StackTrace); lblerror.Text = "Success!"; Console.WriteLine(ex.StackTrace); //Response.Redirect("Home.aspx"); } } catch (Exception ex) { logger.Error(ex.StackTrace); Console.WriteLine(ex.StackTrace); //Response.Redirect("Home.aspx"); } }
//protected void rbAdmin_CheckedChanged(object sender, EventArgs e) //{ // rbAdmin.Checked = true; // rbUser.Checked = false; // if (rbAdmin.Checked == true && rbUser.Checked == false) // { // AccessLevel = "admin"; // } // else // { // AccessLevel = "user"; // } //} //protected void rbUser_CheckedChanged(object sender, EventArgs e) //{ // rbAdmin.Checked = false; // rbUser.Checked = true; // if (rbAdmin.Checked == false && rbUser.Checked == true) // { // AccessLevel = "user"; // } // else // { // AccessLevel = "admin"; // } //} public void BindSocialProfiles() { User user = (User)Session["LoggedUser"]; if (Session["GroupId"] != null) { Guid groupid = (Guid)Session["GroupId"]; GroupProfileRepository groupprofilesrepo = new GroupProfileRepository(); GroupRepository grouprepo = new GroupRepository(); Groups groups = grouprepo.getGroupDetailsbyId(user.Id, groupid); List <GroupProfile> lstgroupprofile = groupprofilesrepo.getAllGroupProfiles(user.Id, groupid); string bindfacebookprofiles = string.Empty; string bindtwitterprofiles = string.Empty; string bindlinkedinprofiles = string.Empty; string bindinstagramprofiles = string.Empty; string bindtumblrprofiles = string.Empty; int i = 0; foreach (GroupProfile item in lstgroupprofile) { if (item.ProfileType == "facebook") { FacebookAccountRepository fbaccountrepo = new FacebookAccountRepository(); FacebookAccount account = fbaccountrepo.getFacebookAccountDetailsById(item.ProfileId, user.Id); if (account != null) { bindfacebookprofiles += "<div class=\"ws_tm_network_one\"><div class=\"ws_tm_user_name\">" + account.FbUserName + "</div>" + "<div class=\"ws_tm_chkbx\"><input type=\"checkbox\" value=\"facebook_" + item.ProfileId + "\" onclick=\"isProfileID('" + item.ProfileId + "')\" id=\"facebookcheck_" + i + "\" name=\"chkbox_" + i + "\"></div></div>"; } } else if (item.ProfileType == "twitter") { TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository(); TwitterAccount twtaccount = twtaccountrepo.getUserInformation(user.Id, item.ProfileId); if (twtaccount != null) { bindtwitterprofiles += "<div class=\"ws_tm_network_one\"><div class=\"ws_tm_user_name\">" + twtaccount.TwitterScreenName + "</div>" + "<div class=\"ws_tm_chkbx\"><input type=\"checkbox\" value=\"twitter_" + item.ProfileId + "\" onclick=\"isProfileID('" + item.ProfileId + "')\" id=\"twittercheck_" + i + "\" name=\"chkbox_" + i + "\"></div></div>"; } } else if (item.ProfileType == "linkedin") { LinkedInAccountRepository linkedaccrepo = new LinkedInAccountRepository(); LinkedInAccount linkedaccount = linkedaccrepo.getUserInformation(user.Id, item.ProfileId); if (linkedaccount != null) { bindlinkedinprofiles += "<div class=\"ws_tm_network_one\"><div class=\"ws_tm_user_name\">" + linkedaccount.LinkedinUserName + "</div>" + "<div class=\"ws_tm_chkbx\"><input type=\"checkbox\" value=\"linkedin_" + item.ProfileId + "\" onclick=\"isProfileID('" + item.ProfileId + "')\" id=\"linkedincheck_" + i + "\" name=\"chkbox_" + i + "\"></div></div>"; } } else if (item.ProfileType == "tumblr") { TumblrAccountRepository tumblraccrepo = new TumblrAccountRepository(); TumblrAccount tumblraccount = tumblraccrepo.getTumblrAccountDetailsById(item.ProfileId, user.Id); if (tumblraccount != null) { bindtumblrprofiles += "<div class=\"ws_tm_network_one\"><div class=\"ws_tm_user_name\">" + tumblraccount.tblrUserName + "</div>" + "<div class=\"ws_tm_chkbx\"><input type=\"checkbox\" value=\"tumblr_" + item.ProfileId + "\" onclick=\"isProfileID('" + item.ProfileId + "')\" id=\"tumblrcheck_" + i + "\" name=\"chkbox_" + i + "\"></div></div>"; } } else if (item.ProfileType == "instagram") { InstagramAccountRepository instagramrepo = new InstagramAccountRepository(); InstagramAccount instaaccount = instagramrepo.getInstagramAccountDetailsById(item.ProfileId, user.Id); if (instaaccount != null) { bindinstagramprofiles += "<div class=\"ws_tm_network_one\"><div class=\"ws_tm_user_name\">" + instaaccount.InsUserName + "</div>" + "<div class=\"ws_tm_chkbx\"><input type=\"checkbox\" value=\"instagram_" + item.ProfileId + "\" onclick=\"isProfileID('" + item.ProfileId + "')\" id=\"instagramcheck_" + i + "\" name=\"chkbox_" + i + "\"></div></div>"; } } i++; } if (!string.IsNullOrEmpty(bindfacebookprofiles)) { FacebookAc.InnerHtml = bindfacebookprofiles; } else { FacebookAc.InnerHtml = "No Facebook Profiles for " + groups.GroupName + " Group"; } if (!string.IsNullOrEmpty(bindtwitterprofiles)) { TwitterAc.InnerHtml = bindtwitterprofiles; } else { TwitterAc.InnerHtml = "No Twitter Profiles for " + groups.GroupName + " Group"; } if (!string.IsNullOrEmpty(bindinstagramprofiles)) { InstagramAc.InnerHtml = bindinstagramprofiles; } else { InstagramAc.InnerHtml = "No Instagram Profiles for " + groups.GroupName + " Group"; } if (!string.IsNullOrEmpty(bindlinkedinprofiles)) { LinkedInAc.InnerHtml = bindlinkedinprofiles; } else { LinkedInAc.InnerHtml = "No LinkedIn Profiles for " + groups.GroupName + " Group"; } if (!string.IsNullOrEmpty(bindtumblrprofiles)) { TumblrAc.InnerHtml = bindtumblrprofiles; } else { TumblrAc.InnerHtml = "No Tumblr Profiles for " + groups.GroupName + " Group"; } totalaccountscheck.InnerHtml = i.ToString(); } }
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); }