public void GetPageProfile(dynamic data, oAuthLinkedIn _OAuth, string UserId, string CompanyPageId, string GroupId) { Domain.Socioboard.Domain.SocialProfile socioprofile = new Domain.Socioboard.Domain.SocialProfile(); SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository(); Domain.Socioboard.Domain.LinkedinCompanyPage objLinkedincmpnypage = new Domain.Socioboard.Domain.LinkedinCompanyPage(); LinkedinCompanyPageRepository objLinkedCmpnyPgeRepo = new LinkedinCompanyPageRepository(); try { objLinkedincmpnypage.UserId = Guid.Parse(UserId); try { objLinkedincmpnypage.LinkedinPageId = data.Pageid.ToString(); } catch { } objLinkedincmpnypage.Id = Guid.NewGuid(); try { objLinkedincmpnypage.EmailDomains = data.EmailDomains.ToString(); } catch { } objLinkedincmpnypage.LinkedinPageName = data.name.ToString(); objLinkedincmpnypage.OAuthToken = _OAuth.Token; objLinkedincmpnypage.OAuthSecret = _OAuth.TokenSecret; objLinkedincmpnypage.OAuthVerifier = _OAuth.Verifier; try { objLinkedincmpnypage.Description = data.description.ToString(); } catch { } try { objLinkedincmpnypage.FoundedYear = data.founded_year.ToString(); } catch { } try { objLinkedincmpnypage.EndYear = data.end_year.ToString(); } catch { } try { objLinkedincmpnypage.Locations = data.locations.ToString(); } catch { } try { objLinkedincmpnypage.Specialties = data.Specialties.ToString(); } catch { } try { objLinkedincmpnypage.WebsiteUrl = data.website_url.ToString(); } catch { } try { objLinkedincmpnypage.Status = data.status.ToString(); } catch { } try { objLinkedincmpnypage.EmployeeCountRange = data.employee_count_range.ToString(); } catch { } try { objLinkedincmpnypage.Industries = data.industries.ToString(); } catch { } try { string NuberOfFollower = data.num_followers.ToString(); objLinkedincmpnypage.NumFollowers = Convert.ToInt16(NuberOfFollower); } catch { } try { objLinkedincmpnypage.CompanyType = data.company_type.ToString(); } catch { } try { objLinkedincmpnypage.LogoUrl = data.logo_url.ToString(); } catch { } try { objLinkedincmpnypage.SquareLogoUrl = data.square_logo_url.ToString(); } catch { } try { objLinkedincmpnypage.BlogRssUrl = data.blog_rss_url.ToString(); } catch { } try { objLinkedincmpnypage.UniversalName = data.universal_name.ToString(); } catch { } #region SocialProfiles socioprofile.UserId = Guid.Parse(UserId); socioprofile.ProfileType = "linkedincompanypage"; socioprofile.ProfileId = data.Pageid.ToString();; socioprofile.ProfileStatus = 1; socioprofile.ProfileDate = DateTime.Now; socioprofile.Id = Guid.NewGuid(); #endregion #region TeamMemberProfile Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId)); objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile(); objTeamMemberProfile.Id = Guid.NewGuid(); objTeamMemberProfile.TeamId = objTeam.Id; objTeamMemberProfile.Status = 1; objTeamMemberProfile.ProfileType = "linkedincompanypage"; objTeamMemberProfile.StatusUpdateDate = DateTime.Now; objTeamMemberProfile.ProfileId = socioprofile.ProfileId; #endregion } catch { } try { if (!objSocialProfilesRepository.checkUserProfileExist(socioprofile)) { objSocialProfilesRepository.addNewProfileForUser(socioprofile); } if (!objTeamMemberProfileRepository.checkTeamMemberProfile(objTeamMemberProfile.TeamId, objLinkedincmpnypage.LinkedinPageId)) { objTeamMemberProfileRepository.addNewTeamMember(objTeamMemberProfile); } if (!objLinkedCmpnyPgeRepo.checkLinkedinPageExists(CompanyPageId, Guid.Parse(UserId))) { objLinkedCmpnyPgeRepo.addLinkenCompanyPage(objLinkedincmpnypage); } else { objLinkedincmpnypage.LinkedinPageId = CompanyPageId; objLinkedCmpnyPgeRepo.updateLinkedinPage(objLinkedincmpnypage); } } catch { } }
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 void GetPageProfile(dynamic data, oAuthLinkedIn _OAuth, string UserId, string CompanyPageId, string GroupId) { Domain.Socioboard.Domain.SocialProfile socioprofile = new Domain.Socioboard.Domain.SocialProfile(); SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository(); Domain.Socioboard.Domain.LinkedinCompanyPage objLinkedincmpnypage = new Domain.Socioboard.Domain.LinkedinCompanyPage(); LinkedinCompanyPageRepository objLinkedCmpnyPgeRepo = new LinkedinCompanyPageRepository(); Domain.Socioboard.Domain.GroupProfile grpProfile = new Domain.Socioboard.Domain.GroupProfile(); try { objLinkedincmpnypage.UserId = Guid.Parse(UserId); try { objLinkedincmpnypage.LinkedinPageId = data.Pageid.ToString(); } catch { } objLinkedincmpnypage.Id = Guid.NewGuid(); try { objLinkedincmpnypage.EmailDomains = data.EmailDomains.ToString(); } catch { } objLinkedincmpnypage.LinkedinPageName = data.name.ToString(); objLinkedincmpnypage.OAuthToken = _OAuth.Token; objLinkedincmpnypage.OAuthSecret = _OAuth.TokenSecret; objLinkedincmpnypage.OAuthVerifier = _OAuth.Verifier; try { objLinkedincmpnypage.Description = data.description.ToString(); } catch { } try { objLinkedincmpnypage.FoundedYear = data.founded_year.ToString(); } catch { } try { objLinkedincmpnypage.EndYear = data.end_year.ToString(); } catch { } try { objLinkedincmpnypage.Locations = data.locations.ToString(); } catch { } try { objLinkedincmpnypage.Specialties = data.Specialties.ToString(); } catch { } try { objLinkedincmpnypage.WebsiteUrl = data.website_url.ToString(); } catch { } try { objLinkedincmpnypage.Status = data.status.ToString(); } catch { } try { objLinkedincmpnypage.EmployeeCountRange = data.employee_count_range.ToString(); } catch { } try { objLinkedincmpnypage.Industries = data.industries.ToString(); } catch { } try { string NuberOfFollower = data.num_followers.ToString(); objLinkedincmpnypage.NumFollowers = Convert.ToInt16(NuberOfFollower); } catch { } try { objLinkedincmpnypage.CompanyType = data.company_type.ToString(); } catch { } try { objLinkedincmpnypage.LogoUrl = data.logo_url.ToString(); } catch { } try { objLinkedincmpnypage.SquareLogoUrl = data.square_logo_url.ToString(); } catch { } try { objLinkedincmpnypage.BlogRssUrl = data.blog_rss_url.ToString(); } catch { } try { objLinkedincmpnypage.UniversalName = data.universal_name.ToString(); } catch { } #region SocialProfiles socioprofile.UserId = Guid.Parse(UserId); socioprofile.ProfileType = "linkedincompanypage"; socioprofile.ProfileId = data.Pageid.ToString(); ; socioprofile.ProfileStatus = 1; socioprofile.ProfileDate = DateTime.Now; socioprofile.Id = Guid.NewGuid(); #endregion #region TeamMemberProfile //Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId)); //objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile(); //objTeamMemberProfile.Id = Guid.NewGuid(); //objTeamMemberProfile.TeamId = objTeam.Id; //objTeamMemberProfile.Status = 1; //objTeamMemberProfile.ProfileType = "linkedincompanypage"; //objTeamMemberProfile.StatusUpdateDate = DateTime.Now; //objTeamMemberProfile.ProfileId = socioprofile.ProfileId; grpProfile.Id = Guid.NewGuid(); grpProfile.EntryDate = DateTime.UtcNow; grpProfile.GroupId = Guid.Parse(GroupId); grpProfile.GroupOwnerId = Guid.Parse(UserId); grpProfile.ProfileId = socioprofile.ProfileId; grpProfile.ProfileType = "linkedincompanypage"; // grpProfile.ProfilePic #endregion } catch { } try { if (!objSocialProfilesRepository.checkUserProfileExist(socioprofile)) { objSocialProfilesRepository.addNewProfileForUser(socioprofile); } //if (!objTeamMemberProfileRepository.checkTeamMemberProfile(objTeamMemberProfile.TeamId, objLinkedincmpnypage.LinkedinPageId)) //{ // objTeamMemberProfileRepository.addNewTeamMember(objTeamMemberProfile); //} if (!grpProfileRepo.checkProfileExistsingroup(Guid.Parse(GroupId), socioprofile.ProfileId)) { // objTeamMemberProfileRepository.addNewTeamMember(objTeamMemberProfile); grpProfileRepo.AddGroupProfile(grpProfile); } if (!objLinkedCmpnyPgeRepo.checkLinkedinPageExists(CompanyPageId, Guid.Parse(UserId))) { objLinkedCmpnyPgeRepo.addLinkenCompanyPage(objLinkedincmpnypage); } else { objLinkedincmpnypage.LinkedinPageId = CompanyPageId; objLinkedCmpnyPgeRepo.updateLinkedinPage(objLinkedincmpnypage); } } catch { } }
public string ProfilesConnected(string UserId, string access_token) { //if (!User.Identity.IsAuthenticated) //{ // return "Unauthorized access"; //} 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 IHttpActionResult DeleteUserDetails(string user) { GroupsRepository _GroupsRepository=new GroupsRepository(); GroupMembersRepository _GroupMembersRepository = new GroupMembersRepository(); GroupProfileRepository _GroupProfileRepository = new GroupProfileRepository(); TaskRepository _TaskRepository = new TaskRepository(); TaskCommentRepository _TaskCommentRepository = new TaskCommentRepository(); InboxMessagesRepository _InboxMessagesRepository=new InboxMessagesRepository(); FacebookAccountRepository _FacebookAccountRepository=new FacebookAccountRepository(); GoogleAnalyticsAccountRepository _GoogleAnalyticsAccountRepository=new GoogleAnalyticsAccountRepository(); GooglePlusAccountRepository _GooglePlusAccountRepository=new GooglePlusAccountRepository(); InstagramAccountRepository _InstagramAccountRepository=new InstagramAccountRepository(); LinkedInAccountRepository _LinkedInAccountRepository=new LinkedInAccountRepository(); LinkedinCompanyPageRepository _LinkedinCompanyPageRepository=new LinkedinCompanyPageRepository(); ScheduledMessageRepository _ScheduledMessageRepository=new ScheduledMessageRepository(); SocialProfilesRepository _SocialProfilesRepository = new SocialProfilesRepository(); TwitterAccountRepository _TwitterAccountRepository=new TwitterAccountRepository(); TumblrAccountRepository _TumblrAccountRepository = new TumblrAccountRepository(); YoutubeAccountRepository _YoutubeAccountRepository = new YoutubeAccountRepository(); YoutubeChannelRepository _YoutubeChannelRepository = new YoutubeChannelRepository(); try { Domain.Socioboard.Domain.User _User = userrepo.getUserInfoByEmail(user); if (_User != null) { List<Domain.Socioboard.Domain.Groups> lstGroups = _GroupsRepository.getAllGroups(_User.Id); foreach (Domain.Socioboard.Domain.Groups item_group in lstGroups) { int i = _GroupMembersRepository.DeleteGroupMember(item_group.Id.ToString()); int j = _GroupProfileRepository.DeleteAllGroupProfile(item_group.Id); bool rt = _GroupProfileRepository.DeleteGroupReport(item_group.Id); int k = _TaskRepository.DeleteTaskOfGroup(item_group.Id); } int g = _GroupMembersRepository.DeleteGroupMemberByUserId(user); int h = _GroupsRepository.DeleteGroupsByUserid(_User.Id); int l = _TaskCommentRepository.DeleteTaskCommentByUserid(_User.Id); int m = _InboxMessagesRepository.DeleteInboxMessages(_User.Id); int n = _FacebookAccountRepository.DeleteAllFacebookAccount(_User.Id); int o = _GoogleAnalyticsAccountRepository.DeleteGoogleAnalyticsAccountByUserid(_User.Id); int p = _GooglePlusAccountRepository.DeleteGooglePlusAccountByUserid(_User.Id); int q = _InstagramAccountRepository.DeleteInstagramAccountByUserid(_User.Id); int r = _LinkedInAccountRepository.DeleteLinkedInAccountByUserid(_User.Id); int s = _LinkedinCompanyPageRepository.DeleteLinkedinCompanyPage(_User.Id); int t = _ScheduledMessageRepository.DeleteScheduledMessageByUserid(_User.Id); int u = _SocialProfilesRepository.DeleteSocialProfileByUserid(_User.Id); int v = _TwitterAccountRepository.DeleteTwitterAccountByUserid(_User.Id); int w = _TumblrAccountRepository.DeletetumblraccountByUserid(_User.Id); int x = _YoutubeAccountRepository.DeleteYoutubeAccount(_User.Id); int y = _YoutubeChannelRepository.DeleteYoutubeChannelByUserid(_User.Id); int z = userrepo.DeleteUser(_User.Id); } else { return Ok(false); } } catch (Exception ex) { return BadRequest(ex.StackTrace); } return Ok(true); }