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; 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 == "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"; } totalaccountscheck.InnerHtml = i.ToString(); } }