public string GetAllTwitterAccountsByUserIdAndGroupId(string userid, string groupid) { try { List <Domain.Socioboard.Domain.TwitterAccount> lstTwitterAccount = new List <Domain.Socioboard.Domain.TwitterAccount>(); Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(groupid)); List <Domain.Socioboard.Domain.TeamMemberProfile> lstTeamMemberProfile = objTeamMemberProfileRepository.GetTeamMemberProfileByTeamIdAndProfileType(objTeam.Id, "twitter"); foreach (var item in lstTeamMemberProfile) { try { lstTwitterAccount.Add(objTwitterAccountRepository.GetUserInformation(Guid.Parse(userid), item.ProfileId)); } catch (Exception) { } } return(new JavaScriptSerializer().Serialize(lstTwitterAccount)); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return("Something Went Wrong"); } }
public string UpdateTeam(string userid, string teamid, string UserName) { try { string[] fnamelname = UserName.Split(' '); string fname = fnamelname[0]; string lname = string.Empty; for (int i = 1; i < fnamelname.Length; i++) { lname += fnamelname[i]; } team = new Domain.Socioboard.Domain.Team(); team.Id = Guid.Parse(teamid); team.UserId = Guid.Parse(userid); team.FirstName = fname; team.LastName = lname; team.StatusUpdateDate = DateTime.Now; team.InviteStatus = 1; teamrepo.updateTeam(team); User objUser = new Services.User(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return("Something Went Wrong"); } return(new JavaScriptSerializer().Serialize(team)); }
public string AddInstagramAccountFromInstaBoard(string UserId, string GroupId, string ProfileId, string AccessToken, string FriendsCount, string Name, string EmailId, string ProfilePicUrl, string TotalImage, string Followers, string Followings) { if (objUserRepository.IsUserExist(Guid.Parse(UserId))) { if (!objInstagramAccountRepository.checkInstagramUserExists(objInstagramAccount.InstagramId, Guid.Parse(UserId))) { objInstagramAccount = new Domain.Socioboard.Domain.InstagramAccount(); objInstagramAccount.Id = Guid.NewGuid(); objInstagramAccount.InstagramId = ProfileId; objInstagramAccount.InsUserName = Name; objInstagramAccount.IsActive = true; objInstagramAccount.ProfileUrl = ProfilePicUrl; objInstagramAccount.TotalImages = Int32.Parse(TotalImage); objInstagramAccount.Followers = Int32.Parse(Followers); objInstagramAccount.FollowedBy = Int32.Parse(Followings); objInstagramAccount.UserId = Guid.Parse(UserId); objInstagramAccountRepository.addInstagramUser(objInstagramAccount); #region Add TeamMemberProfile Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId)); Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile(); if (objTeamMemberProfileRepository.checkTeamMemberProfile(objTeam.Id, ProfileId)) { objTeamMemberProfile.Id = Guid.NewGuid(); objTeamMemberProfile.TeamId = objTeam.Id; objTeamMemberProfile.Status = 1; objTeamMemberProfile.ProfileType = "instagram"; objTeamMemberProfile.StatusUpdateDate = DateTime.Now; objTeamMemberProfile.ProfileId = ProfileId; objTeamMemberProfile.ProfilePicUrl = ProfilePicUrl; objTeamMemberProfile.ProfileName = Name; objTeamMemberProfileRepository.addNewTeamMember(objTeamMemberProfile); } #endregion #region SocialProfile Domain.Socioboard.Domain.SocialProfile objSocialProfile = new Domain.Socioboard.Domain.SocialProfile(); objSocialProfile.Id = Guid.NewGuid(); objSocialProfile.ProfileType = "instagram"; objSocialProfile.ProfileId = ProfileId; objSocialProfile.UserId = Guid.Parse(UserId); objSocialProfile.ProfileDate = DateTime.Now; objSocialProfile.ProfileStatus = 1; #endregion #region Add SocialProfile if (!objSocialProfilesRepository.checkUserProfileExist(objSocialProfile)) { objSocialProfilesRepository.addNewProfileForUser(objSocialProfile); } #endregion return("account added"); } else { return("account already exist"); } } else { return("user not exist"); } }
public string GetAllFacebookAccountsByUserIdAndGroupId(string userid, string groupid) { try { List <Domain.Socioboard.Domain.FacebookAccount> lstFacebookAccount = new List <Domain.Socioboard.Domain.FacebookAccount>(); Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(groupid)); List <Domain.Socioboard.Domain.TeamMemberProfile> lstTeamMemberProfile = objTeamMemberProfileRepository.GetTeamMemberProfileByTeamIdAndProfileType(objTeam.Id, "facebook"); foreach (var item in lstTeamMemberProfile) { try { if (objFacebookAccountRepository.checkFacebookUserExists(item.ProfileId, Guid.Parse(userid))) { lstFacebookAccount.Add(objFacebookAccountRepository.getFacebookAccountDetailsById(item.ProfileId, Guid.Parse(userid))); } else { lstFacebookAccount.Add(objFacebookAccountRepository.getFacebookAccountDetailsById(item.ProfileId)); } } catch (Exception) { } } return(new JavaScriptSerializer().Serialize(lstFacebookAccount)); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return("Something Went Wrong"); } }
public string GetAllBloggerAccountByUserIdAndGroupId(string userid, string groupid) { try { List <Domain.Socioboard.Domain.GooglePlusAccount> lstGooglePlusAccount = new List <Domain.Socioboard.Domain.GooglePlusAccount>(); Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(groupid)); List <Domain.Socioboard.Domain.TeamMemberProfile> lstTeamMemberProfile = objTeamMemberProfileRepository.GetTeamMemberProfileByTeamIdAndProfileType(objTeam.Id, "gplus"); foreach (var item in lstTeamMemberProfile) { try { lstGooglePlusAccount.Add(ObjGooglePlusAccountsRepo.getGooglePlusAccountDetailsById(item.ProfileId, Guid.Parse(userid))); } catch (Exception) { } } return(new JavaScriptSerializer().Serialize(lstGooglePlusAccount)); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return("Something Went Wrong"); } }
public string DeleteProfileFromGroup(string profileid, string groupid, string userid) { objGroupProfileRepository.DeleteGroupProfile(Guid.Parse(userid), profileid, Guid.Parse(groupid)); objTeam = new Domain.Socioboard.Domain.Team(); objTeam = objTeamRepository.GetAllTeam(Guid.Parse(groupid), Guid.Parse(userid)); objTeamMemberProfileRepository.DeleteTeamMemberProfileByTeamIdProfileId(profileid, objTeam.Id); return(""); }
public string DeleteProfileFromGroup(string profileid, string groupid, string userid) { objGroupProfileRepository.DeleteGroupProfile(Guid.Parse(userid), profileid, Guid.Parse(groupid)); objTeam = new Domain.Socioboard.Domain.Team(); objTeam = objTeamRepository.GetAllTeam(Guid.Parse(groupid), Guid.Parse(userid)); objTeamMemberProfileRepository.DeleteTeamMemberProfileByTeamIdProfileId(profileid, objTeam.Id); return ""; }
public string AddFacebookAccountFromTweetBoard(string UserId, string GroupId, string ProfileId, string AccessToken, string FriendsCount, string Name, string EmailId) { if (objUserRepository.IsUserExist(Guid.Parse(UserId))) { if (!objFacebookAccountRepository.checkFacebookUserExists(ProfileId, Guid.Parse(UserId))) { Domain.Socioboard.Domain.FacebookAccount _FacebookAccount = new Domain.Socioboard.Domain.FacebookAccount(); _FacebookAccount.Id = Guid.NewGuid(); _FacebookAccount.ProfileType = "account"; _FacebookAccount.IsActive = 1; _FacebookAccount.AccessToken = AccessToken; _FacebookAccount.EmailId = EmailId; _FacebookAccount.FbUserId = ProfileId; _FacebookAccount.FbUserName = Name; _FacebookAccount.Friends = Int32.Parse(FriendsCount); objFacebookAccountRepository.addFacebookUser(_FacebookAccount); #region Add TeamMemberProfile Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId)); Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile(); if (objTeamMemberProfileRepository.checkTeamMemberProfile(objTeam.Id, ProfileId)) { objTeamMemberProfile.Id = Guid.NewGuid(); objTeamMemberProfile.TeamId = objTeam.Id; objTeamMemberProfile.Status = 1; objTeamMemberProfile.ProfileType = "facebook"; objTeamMemberProfile.StatusUpdateDate = DateTime.Now; objTeamMemberProfile.ProfileId = ProfileId; objTeamMemberProfile.ProfileName = Name; objTeamMemberProfile.ProfilePicUrl = "http://graph.facebook.com/" + objTeamMemberProfile.ProfileId + "/picture?type=small"; objTeamMemberProfileRepository.addNewTeamMember(objTeamMemberProfile); } #endregion #region SocialProfile Domain.Socioboard.Domain.SocialProfile objSocialProfile = new Domain.Socioboard.Domain.SocialProfile(); objSocialProfile.Id = Guid.NewGuid(); objSocialProfile.ProfileType = "facebook"; objSocialProfile.ProfileId = ProfileId; objSocialProfile.UserId = Guid.Parse(UserId); objSocialProfile.ProfileDate = DateTime.Now; objSocialProfile.ProfileStatus = 1; #endregion if (!objSocialProfilesRepository.checkUserProfileExist(objSocialProfile)) { objSocialProfilesRepository.addNewProfileForUser(objSocialProfile); } return("account added"); } else { return("account already exist"); } } else { return("user not exist"); } }
public string AddTwitterAccountFromTweetBoard(string UserId, string GroupId, string OAuthToken, string OAuthSecret, string ProfileId, string ScreenName, string FollowingCount, string FollowerCount, string ProfilePicUrl) { if (objUserRepository.IsUserExist(Guid.Parse(UserId))) { if (objTwitterAccountRepository.checkTwitterUserExists(ProfileId, Guid.Parse(UserId))) { Domain.Socioboard.Domain.TwitterAccount _TwitterAccount = new Domain.Socioboard.Domain.TwitterAccount(); _TwitterAccount.Id = Guid.NewGuid(); _TwitterAccount.IsActive = true; _TwitterAccount.UserId = Guid.Parse(UserId); _TwitterAccount.TwitterUserId = ProfileId; _TwitterAccount.TwitterScreenName = ScreenName; _TwitterAccount.OAuthToken = OAuthToken; _TwitterAccount.OAuthSecret = OAuthSecret; _TwitterAccount.ProfileImageUrl = ProfilePicUrl; objTwitterAccountRepository.addTwitterkUser(_TwitterAccount); Domain.Socioboard.Domain.Team _Team = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId)); Domain.Socioboard.Domain.TeamMemberProfile _TeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile(); if (objTeamMemberProfileRepository.checkTeamMemberProfile(_Team.Id, ProfileId)) { _TeamMemberProfile.Id = Guid.NewGuid(); _TeamMemberProfile.TeamId = _Team.Id; _TeamMemberProfile.ProfileId = ProfileId; _TeamMemberProfile.ProfileName = ScreenName; _TeamMemberProfile.Status = 1; _TeamMemberProfile.ProfileType = "twitter"; _TeamMemberProfile.StatusUpdateDate = DateTime.Now; _TeamMemberProfile.ProfilePicUrl = ProfilePicUrl; objTeamMemberProfileRepository.addNewTeamMember(_TeamMemberProfile); } Domain.Socioboard.Domain.SocialProfile objSocialProfile = new Domain.Socioboard.Domain.SocialProfile(); objSocialProfile.Id = Guid.NewGuid(); objSocialProfile.ProfileType = "twitter"; objSocialProfile.ProfileId = ProfileId; objSocialProfile.UserId = Guid.Parse(UserId); objSocialProfile.ProfileDate = DateTime.Now; objSocialProfile.ProfileStatus = 1; if (!objSocialProfilesRepository.checkUserProfileExist(objSocialProfile)) { objSocialProfilesRepository.addNewProfileForUser(objSocialProfile); } return("account added"); } else { return("account already exist"); } } else { return("user not exist"); } }
public ActionResult loadtask() { Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; Domain.Socioboard.Domain.Team team = SBUtils.GetTeamFromGroupId(); Api.Tasks.Tasks objApiTasks = new Api.Tasks.Tasks(); List <Domain.Socioboard.Domain.Tasks> taskdata = (List <Domain.Socioboard.Domain.Tasks>) new JavaScriptSerializer().Deserialize(objApiTasks.getAllTasksOfUserList(objUser.Id.ToString(), team.GroupId.ToString()), typeof(List <Domain.Socioboard.Domain.Tasks>)); return(PartialView("_TaskPartial", taskdata)); }
public static void AddTeamByGroupIdUserId(Guid userId, string userEmailId, Guid groupId) { Domain.Socioboard.Domain.Team teams = new Domain.Socioboard.Domain.Team(); TeamRepository objTeamRepository = new TeamRepository(); teams.Id = Guid.NewGuid(); teams.GroupId = groupId; teams.UserId = userId; teams.EmailId = userEmailId; objTeamRepository.addNewTeam(teams); }
public PartialViewResult LoadCompleteTask() { Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; Domain.Socioboard.Domain.Team team = SBUtils.GetTeamFromGroupId(); Api.Tasks.Tasks objApiTasks = new Api.Tasks.Tasks(); List <Domain.Socioboard.Domain.Tasks> taskdata = (List <Domain.Socioboard.Domain.Tasks>) new JavaScriptSerializer().Deserialize(objApiTasks.GetAllCompleteTaskofUser(objUser.Id.ToString(), team.GroupId.ToString()), typeof(List <Domain.Socioboard.Domain.Tasks>)); ViewBag.Task = "CompleteTask"; return(PartialView("_TaskPartial", taskdata)); }
public ActionResult accordianprofiles() { Api.Team.Team objApiTeam = new Api.Team.Team(); string groupid = Session["group"].ToString(); Domain.Socioboard.Domain.Team team = (Domain.Socioboard.Domain.Team) new JavaScriptSerializer().Deserialize(objApiTeam.GetTeamByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Team)); Api.TeamMemberProfile.TeamMemberProfile objApiTeamMemberProfile = new Api.TeamMemberProfile.TeamMemberProfile(); List <Domain.Socioboard.Domain.TeamMemberProfile> alstprofiles = (List <Domain.Socioboard.Domain.TeamMemberProfile>) new JavaScriptSerializer().Deserialize(objApiTeamMemberProfile.GetTeamMemberProfilesByTeamId(team.Id.ToString()), typeof(List <Domain.Socioboard.Domain.TeamMemberProfile>)); return(View("_MessagesRightPartial", alstprofiles));//Content(view_MessagesaccordianprofilesPartial); }
public string GetTeamByGroupId(string GroupId) { try { Domain.Socioboard.Domain.Team objTeam = teamrepo.GetTeamByGroupId(Guid.Parse(GroupId)); return(new JavaScriptSerializer().Serialize(objTeam)); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return("Something Went Wrong"); } }
public void DeleteGplusAccount(string UserId, string ProfileId, string GroupId) { try { ObjGooglePlusAccountsRepo.deleteGooglePlusUser(ProfileId, Guid.Parse(UserId)); Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId)); objTeamMemberProfileRepository.DeleteTeamMemberProfileByTeamIdProfileId(ProfileId, objTeam.Id); objSocialProfilesRepository.deleteProfile(Guid.Parse(UserId), ProfileId); } catch (Exception ex) { Console.WriteLine("DeleteGplusAccount => " + ex.Message); } }
public string DeleteGoogelAnalyticsAccount(string UserId, string ProfileId, string GroupId, string profiletype) { try { objGoogleAnalyticsAccountRepository.deleteGoogelAnalyticsUser(ProfileId, Guid.Parse(UserId)); Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId)); objTeamMemberProfileRepository.DeleteTeamMemberProfileByTeamIdProfileId(ProfileId, objTeam.Id); objGroupProfileRepository.DeleteGroupProfile(Guid.Parse(UserId), ProfileId, Guid.Parse(GroupId), profiletype); objSocialProfilesRepository.deleteProfile(Guid.Parse(UserId), ProfileId, profiletype); return(new JavaScriptSerializer().Serialize("")); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return("Something Went Wrong"); } }
public string DeleteTumblrAccount(string UserId, string ProfileId, string GroupId) { try { objTumblrAccountRepository.deleteTumblrUser(ProfileId, Guid.Parse(UserId)); objTumblrFeedRepository.DeleteTumblrDataByUserid(Guid.Parse(UserId), ProfileId); Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId)); GroupProfileRepository objGroupProfileRepository = new GroupProfileRepository(); objGroupProfileRepository.DeleteGroupProfile(Guid.Parse(UserId), ProfileId, Guid.Parse(GroupId)); objTeamMemberProfileRepository.DeleteTeamMemberProfileByTeamIdProfileId(ProfileId, objTeam.Id); objSocialProfilesRepository.deleteProfile(Guid.Parse(UserId), ProfileId); return(new JavaScriptSerializer().Serialize("Success")); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return("Something Went Wrong"); } }
public string DeleteFacebookAccount(string UserId, string ProfileId, string GroupId) { try { objFacebookAccountRepository.deleteFacebookUser(ProfileId, Guid.Parse(UserId)); //objFacebookFeedRepository.deleteAllFeedsOfUser(ProfileId, Guid.Parse(UserId)); //objFacebookMessageRepository.deleteAllMessagesOfUser(ProfileId, Guid.Parse(UserId)); Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId)); objTeamMemberProfileRepository.DeleteTeamMemberProfileByTeamIdProfileId(ProfileId, objTeam.Id); objGroupProfileRepository.DeleteGroupProfile(Guid.Parse(UserId), ProfileId, Guid.Parse(GroupId)); objSocialProfilesRepository.deleteProfile(Guid.Parse(UserId), ProfileId); return(new JavaScriptSerializer().Serialize("")); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return("Something Went Wrong"); } }
public string DeleteTwitterAccount(string UserId, string ProfileId, string GroupId) { try { objTwitterAccountRepository.deleteTwitterUser(Guid.Parse(UserId), ProfileId); //objTwitterFeedRepository.deleteTwitterFeed(ProfileId, Guid.Parse(UserId)); //objTwtstats.deleteTwitterStats(Guid.Parse(UserId), ProfileId); //objTwitterMessageRepository.deleteTwitterMessage(ProfileId, Guid.Parse(UserId)); //objTwitterDirectMessageRepository.deleteDirectMessage(Guid.Parse(UserId), ProfileId); Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId)); objTeamMemberProfileRepository.DeleteTeamMemberProfileByTeamIdProfileId(ProfileId, objTeam.Id); objSocialProfilesRepository.deleteProfile(Guid.Parse(UserId), ProfileId); return(new JavaScriptSerializer().Serialize("")); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return("Something Went Wrong"); } }
public string UpdateTeam(string userid, string teamid, string UserName) { try { string[] fnamelname = UserName.Split(' '); string fname = fnamelname[0]; string lname = string.Empty; for (int i = 1; i < fnamelname.Length; i++) { lname += fnamelname[i]; } team = new Domain.Socioboard.Domain.Team(); team.Id = Guid.Parse(teamid); team.UserId = Guid.Parse(userid); team.FirstName = fname; team.LastName = lname; team.StatusUpdateDate = DateTime.Now; team.InviteStatus = 1; teamrepo.updateTeam(team); Domain.Socioboard.Domain.Team objTeam = teamrepo.getTeamById(Guid.Parse(teamid)); List <Domain.Socioboard.Domain.GroupProfile> lstGroupProfile = objGroupProfileRepository.GetAllGroupProfiles(objTeam.GroupId); foreach (var item in lstGroupProfile) { objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile(); objTeamMemberProfile.Id = Guid.NewGuid(); objTeamMemberProfile.TeamId = Guid.Parse(teamid); objTeamMemberProfile.ProfileId = item.ProfileId; objTeamMemberProfile.ProfileType = item.ProfileType; objTeamMemberProfile.Status = 1; objTeamMemberProfile.StatusUpdateDate = DateTime.Now; objTeamMemberProfileRepository.addNewTeamMember(objTeamMemberProfile); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return("Something Went Wrong"); } return(new JavaScriptSerializer().Serialize(team)); }
public string AddProfileToGroup(string profileid, string network, string groupid, string userid) { objGroupProfile = new Domain.Socioboard.Domain.GroupProfile(); objGroupProfile.Id = Guid.NewGuid(); objGroupProfile.GroupId = Guid.Parse(groupid); objGroupProfile.ProfileId = profileid; objGroupProfile.GroupOwnerId = Guid.Parse(userid); objGroupProfile.ProfileType = network; objGroupProfile.EntryDate = DateTime.Now; objGroupProfileRepository.AddGroupProfile(objGroupProfile); objTeam = new Domain.Socioboard.Domain.Team(); objTeam=objTeamRepository.GetAllTeam(Guid.Parse(groupid), Guid.Parse(userid)); objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile(); objTeamMemberProfile.Id = Guid.NewGuid(); objTeamMemberProfile.TeamId = objTeam.Id; objTeamMemberProfile.ProfileId = profileid; objTeamMemberProfile.ProfileType = network; objTeamMemberProfile.Status = 1; objTeamMemberProfile.StatusUpdateDate = DateTime.Now; objTeamMemberProfileRepository.addNewTeamMember(objTeamMemberProfile); return ""; }
public string AddProfileToGroup(string profileid, string network, string groupid, string userid) { objGroupProfile = new Domain.Socioboard.Domain.GroupProfile(); objGroupProfile.Id = Guid.NewGuid(); objGroupProfile.GroupId = Guid.Parse(groupid); objGroupProfile.ProfileId = profileid; objGroupProfile.GroupOwnerId = Guid.Parse(userid); objGroupProfile.ProfileType = network; objGroupProfile.EntryDate = DateTime.Now; objGroupProfileRepository.AddGroupProfile(objGroupProfile); objTeam = new Domain.Socioboard.Domain.Team(); objTeam = objTeamRepository.GetAllTeam(Guid.Parse(groupid), Guid.Parse(userid)); objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile(); objTeamMemberProfile.Id = Guid.NewGuid(); objTeamMemberProfile.TeamId = objTeam.Id; objTeamMemberProfile.ProfileId = profileid; objTeamMemberProfile.ProfileType = network; objTeamMemberProfile.Status = 1; objTeamMemberProfile.StatusUpdateDate = DateTime.Now; objTeamMemberProfileRepository.addNewTeamMember(objTeamMemberProfile); return(""); }
public string AddWordpressAccount(string code, string UserId, string GroupId) { WordpressAccountRepository objWPAccountRepo = new WordpressAccountRepository(); Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile(); Domain.Socioboard.Domain.WordpressAccount objWordpressAccount = new Domain.Socioboard.Domain.WordpressAccount(); string client_id = ConfigurationManager.AppSettings["WordpessClientID"]; string redirect_uri = ConfigurationManager.AppSettings["WordpessCallBackURL"]; string client_secret = ConfigurationManager.AppSettings["WordpessClientSecret"]; oAuthWordpress _oAuth = new oAuthWordpress(); _oAuth.client_id = client_id; _oAuth.client_secret = client_secret; _oAuth.redirect_uri = redirect_uri; _oAuth.code = code; string postdata = _oAuth.PostDataToGetAccessToken(); try { string _token = _oAuth.APIWebRequest(Globals._TokenUrl, postdata); string access_token = JObject.Parse(_token)["access_token"].ToString(); _oAuth.access_token = access_token; //string postdata1 = _oAuth.PostDataToGetAccessToken(); //string _me = _oAuth.APIWebRequest(Globals._UserInfo, postdata1); string userinfo = _oAuth.APIWebRequestToGetUserInfo(Globals._UserInfo); JObject WP_User = JObject.Parse(userinfo); #region AddWPAccount objWordpressAccount.Id = Guid.NewGuid(); objWordpressAccount.WpUserId = WP_User["ID"].ToString(); objWordpressAccount.WpUserName = WP_User["username"].ToString(); objWordpressAccount.DisplayName = WP_User["display_name"].ToString(); objWordpressAccount.EmailId = WP_User["email"].ToString(); objWordpressAccount.PrimaryBlogId = WP_User["primary_blog"].ToString(); objWordpressAccount.TokenSiteId = WP_User["token_site_id"].ToString(); objWordpressAccount.UserAvtar = WP_User["avatar_URL"].ToString(); objWordpressAccount.ProfileUrl = WP_User["profile_URL"].ToString(); objWordpressAccount.SiteCount = Int32.Parse(WP_User["site_count"].ToString()); objWordpressAccount.UserId = Guid.Parse(UserId); objWordpressAccount.AccessToken = access_token; if (!objWPAccountRepo.IsProfileAllreadyExist(objWordpressAccount.UserId, objWordpressAccount.WpUserId)) { objWPAccountRepo.AddWordpressAccount(objWordpressAccount); } #endregion #region AddTeamMemberProfiles Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId)); objTeamMemberProfile.Id = Guid.NewGuid(); objTeamMemberProfile.ProfileId = WP_User["ID"].ToString(); objTeamMemberProfile.TeamId = objTeam.Id; objTeamMemberProfile.ProfileType = "wordpress"; objTeamMemberProfile.Status = 1; objTeamMemberProfile.StatusUpdateDate = DateTime.Now; if (!objTeamMemberProfileRepo.checkTeamMemberProfile(objTeam.Id, objTeamMemberProfile.ProfileId)) { objTeamMemberProfileRepo.addNewTeamMember(objTeamMemberProfile); } #endregion #region AddSocialProfile Domain.Socioboard.Domain.SocialProfile objSocialProfile = new Domain.Socioboard.Domain.SocialProfile(); objSocialProfile.Id = Guid.NewGuid(); objSocialProfile.UserId = Guid.Parse(UserId); objSocialProfile.ProfileType = "wordpress"; objSocialProfile.ProfileId = WP_User["ID"].ToString(); objSocialProfile.ProfileDate = DateTime.Now; objSocialProfile.ProfileStatus = 1; if (!objSocialProfilesRepository.checkUserProfileExist(objSocialProfile)) { objSocialProfilesRepository.addNewProfileForUser(objSocialProfile); } GetUserSites(UserId, objWordpressAccount.WpUserId); //GetUsersofblog(UserId,objWordpressAccount.WpUserId); #endregion } catch (Exception ex) { } return(""); }
public static void AddTeamByGroupIdUserId(Guid userId, string userEmailId, Guid groupId) { Domain.Socioboard.Domain.Team teams = new Domain.Socioboard.Domain.Team(); TeamRepository objTeamRepository = new TeamRepository(); teams.Id = Guid.NewGuid(); teams.GroupId = groupId; teams.UserId = userId; teams.EmailId = userEmailId; teams.InviteStatus = 1; objTeamRepository.addNewTeam(teams); }
public string AddGPlusAccount(string client_id, string client_secret, string redirect_uri, string UserId, string GroupId, string code) { string ret = string.Empty; string objRefresh = string.Empty; string refreshToken = string.Empty; string access_token = string.Empty; try { oAuthTokenGPlus ObjoAuthTokenGPlus = new oAuthTokenGPlus(); oAuthToken objToken = new oAuthToken(); objToken.ConsumerKey = client_id; objToken.ConsumerSecret = client_secret; try { objRefresh = ObjoAuthTokenGPlus.GetRefreshToken(code, client_id, client_secret, redirect_uri); logger.Error("vikash: ObjoAuthTokenGPlus()"); } catch (Exception ex) { } JObject objaccesstoken = JObject.Parse(objRefresh); try { refreshToken = objaccesstoken["refresh_token"].ToString(); } catch (Exception ex) { access_token = objaccesstoken["access_token"].ToString(); ObjoAuthTokenGPlus.RevokeToken(access_token); Console.WriteLine(ex.StackTrace); ret = "Refresh Token Not Found"; return(ret); } try { access_token = objaccesstoken["access_token"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } JArray userinfo = new JArray(); try { userinfo = objToken.GetUserInfo("self", access_token.ToString()); } catch (Exception ex) { } Domain.Socioboard.Domain.GooglePlusAccount _GooglePlusAccount = new Domain.Socioboard.Domain.GooglePlusAccount(); foreach (var itemuserinfo in userinfo) { try { _GooglePlusAccount.Id = Guid.NewGuid(); _GooglePlusAccount.GpUserId = itemuserinfo["id"].ToString(); _GooglePlusAccount.GpUserName = itemuserinfo["name"].ToString(); _GooglePlusAccount.GpProfileImage = itemuserinfo["picture"].ToString(); _GooglePlusAccount.IsActive = 1; _GooglePlusAccount.ProfileType = "gplus"; _GooglePlusAccount.AccessToken = access_token; _GooglePlusAccount.RefreshToken = refreshToken; _GooglePlusAccount.EmailId = itemuserinfo["email"].ToString(); _GooglePlusAccount.UserId = Guid.Parse(UserId); _GooglePlusAccount.EntryDate = DateTime.Now; } catch (Exception ex) { logger.Error("AddGPlusAccount => GooglePlusAccount =>" + ex.Message); } } #region Get_InYourCircles try { string _InyourCircles = ObjoAuthTokenGPlus.APIWebRequestToGetUserInfo(Globals.strGetPeopleList.Replace("[userId]", _GooglePlusAccount.GpUserId).Replace("[collection]", "visible") + "?key=" + ConfigurationManager.AppSettings["Api_Key"].ToString(), access_token); JObject J_InyourCircles = JObject.Parse(_InyourCircles); _GooglePlusAccount.InYourCircles = Convert.ToInt32(J_InyourCircles["totalItems"].ToString()); } catch (Exception ex) { _GooglePlusAccount.InYourCircles = 0; } #endregion #region Get_HaveYouInCircles try { string _HaveYouInCircles = ObjoAuthTokenGPlus.APIWebRequestToGetUserInfo(Globals.strGetPeopleProfile + _GooglePlusAccount.GpUserId + "?key=" + ConfigurationManager.AppSettings["Api_Key"].ToString(), access_token); JObject J_HaveYouInCircles = JObject.Parse(_HaveYouInCircles); _GooglePlusAccount.HaveYouInCircles = Convert.ToInt32(J_HaveYouInCircles["circledByCount"].ToString()); } catch (Exception ex) { _GooglePlusAccount.HaveYouInCircles = 0; } #endregion #region Add GPlusAccount if (!objGooglePlusAccountRepository.checkGooglePlusUserExists(_GooglePlusAccount.GpUserId, _GooglePlusAccount.UserId)) { objGooglePlusAccountRepository.addGooglePlusUser(_GooglePlusAccount); #region Add TeamMemberProfile Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId)); Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile(); objTeamMemberProfile.Id = Guid.NewGuid(); objTeamMemberProfile.TeamId = objTeam.Id; objTeamMemberProfile.Status = 1; objTeamMemberProfile.ProfileType = "gplus"; objTeamMemberProfile.StatusUpdateDate = DateTime.Now; objTeamMemberProfile.ProfileId = _GooglePlusAccount.GpUserId; objTeamMemberProfile.ProfilePicUrl = _GooglePlusAccount.GpProfileImage; objTeamMemberProfile.ProfileName = _GooglePlusAccount.GpUserName; objTeamMemberProfileRepository.addNewTeamMember(objTeamMemberProfile); #endregion #region SocialProfile Domain.Socioboard.Domain.SocialProfile objSocialProfile = new Domain.Socioboard.Domain.SocialProfile(); objSocialProfile.Id = Guid.NewGuid(); objSocialProfile.ProfileType = "gplus"; objSocialProfile.ProfileId = _GooglePlusAccount.GpUserId; objSocialProfile.UserId = Guid.Parse(UserId); objSocialProfile.ProfileDate = DateTime.Now; objSocialProfile.ProfileStatus = 1; if (!objSocialProfilesRepository.checkUserProfileExist(objSocialProfile)) { objSocialProfilesRepository.addNewProfileForUser(objSocialProfile); } #endregion ret = "Account Added Successfully"; } else { ret = "Account already Exist !"; } #endregion GetUserActivities(UserId, _GooglePlusAccount.GpUserId, access_token); return(new JavaScriptSerializer().Serialize(_GooglePlusAccount)); } catch (Exception ex) { logger.Error(ex.Message); return(""); } }
public string UpdateTeam(string userid, string teamid, string UserName) { try { string[] fnamelname = UserName.Split(' '); string fname = fnamelname[0]; string lname = string.Empty; for (int i = 1; i < fnamelname.Length; i++) { lname += fnamelname[i]; } team = new Domain.Socioboard.Domain.Team(); team.Id = Guid.Parse(teamid); team.UserId = Guid.Parse(userid); team.FirstName = fname; team.LastName = lname; team.StatusUpdateDate = DateTime.Now; team.InviteStatus = 1; teamrepo.updateTeam(team); User objUser=new Services.User (); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return "Something Went Wrong"; } return new JavaScriptSerializer().Serialize(team); }
public string getAllNegativeFeeds() { // string ret =string.Empty; try { Api.SentimentalAnalysis.SentimentalAnalysis Apiobjsentimentalanalysis = new Api.SentimentalAnalysis.SentimentalAnalysis(); Api.Team.Team ApiobjTeam = new Api.Team.Team(); Api.TicketAssigneeStatus.TicketAssigneeStatus ApiobjTicketAssigneeStatus = new Api.TicketAssigneeStatus.TicketAssigneeStatus(); List<Domain.Socioboard.Domain.FeedSentimentalAnalysis> lstNegativeFeed = new List<Domain.Socioboard.Domain.FeedSentimentalAnalysis>(); List<Domain.Socioboard.Domain.Team> lstGroupMember = new List<Domain.Socioboard.Domain.Team>(); List<Domain.Socioboard.Domain.TicketAssigneeStatus> lstAllAssignedMembers = new List<Domain.Socioboard.Domain.TicketAssigneeStatus>(); lstNegativeFeed = (List<Domain.Socioboard.Domain.FeedSentimentalAnalysis>)(new JavaScriptSerializer().Deserialize(Apiobjsentimentalanalysis.getAllNegativeFeedsOfProfile(), typeof(List<Domain.Socioboard.Domain.FeedSentimentalAnalysis>))); int FeedNumber = lstNegativeFeed.Count; if (FeedNumber > 0) { lstGroupMember = (List<Domain.Socioboard.Domain.Team>)(new JavaScriptSerializer().Deserialize(ApiobjTeam.getAllGroupMembersofTeam(), typeof(List<Domain.Socioboard.Domain.Team>))); } foreach (var lstGroupMember_item in lstGroupMember) { ApiobjTicketAssigneeStatus.AddTicketAssigneeStatus(lstGroupMember_item.UserId); } lstAllAssignedMembers = (List<Domain.Socioboard.Domain.TicketAssigneeStatus>)(new JavaScriptSerializer().Deserialize(ApiobjTicketAssigneeStatus.getAllAssignedMembers(), typeof(List<Domain.Socioboard.Domain.TicketAssigneeStatus>))); int Assigneemember = lstAllAssignedMembers.Count; int MemberNumber = lstGroupMember.Count; if (Assigneemember > 0) { Domain.Socioboard.Domain.Team Member = new Domain.Socioboard.Domain.Team(); Domain.Socioboard.Domain.TicketAssigneeStatus objTicketAssigneeStatus = new Domain.Socioboard.Domain.TicketAssigneeStatus(); int j = 0; for (int i = 0; i < FeedNumber; i++) { Domain.Socioboard.Domain.FeedSentimentalAnalysis Feed = lstNegativeFeed[i]; if (j == Assigneemember) { j = 0; } objTicketAssigneeStatus = lstAllAssignedMembers[j]; j++; Guid Id = Feed.Id; Guid ToAssignUserId = objTicketAssigneeStatus.AssigneeUserId; Apiobjsentimentalanalysis.updateAssignedStatus(Id.ToString(), ToAssignUserId.ToString()); Domain.Socioboard.Domain.TicketAssigneeStatus AssigneeDetails =(Domain.Socioboard.Domain.TicketAssigneeStatus)(new JavaScriptSerializer().Deserialize(ApiobjTicketAssigneeStatus.getAssignedMembers(ToAssignUserId.ToString()),typeof(Domain.Socioboard.Domain.TicketAssigneeStatus))); int AssignedCount = AssigneeDetails.AssignedTicketCount; int Count = ++AssignedCount; ApiobjTicketAssigneeStatus.updateAssigneeCount(objTicketAssigneeStatus.AssigneeUserId.ToString(), Count); } } //#region Old Code //if (MemberNumber > 0) //{ // Domain.Socioboard.Domain.Team Member = new Domain.Socioboard.Domain.Team(); // int j = 0; // for (int i = 0; i < FeedNumber; i++) // { // Domain.Socioboard.Domain.FeedSentimentalAnalysis Feed = lstNegativeFeed[i]; // if (j == MemberNumber) // { // j = 0; // } // Member = lstGroupMember[j]; // j++; // Guid Id = Feed.Id; // Guid ToAssignUserId = Member.UserId; // Apiobjsentimentalanalysis.updateAssignedStatus(Id.ToString(), ToAssignUserId.ToString()); // } //} //#endregion return ""; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return "Something Went Wrong"; } }
public string getAllNegativeFeeds() { // string ret =string.Empty; try { Api.SentimentalAnalysis.SentimentalAnalysis Apiobjsentimentalanalysis = new Api.SentimentalAnalysis.SentimentalAnalysis(); Api.Team.Team ApiobjTeam = new Api.Team.Team(); Api.TicketAssigneeStatus.TicketAssigneeStatus ApiobjTicketAssigneeStatus = new Api.TicketAssigneeStatus.TicketAssigneeStatus(); List <Domain.Socioboard.Domain.FeedSentimentalAnalysis> lstNegativeFeed = new List <Domain.Socioboard.Domain.FeedSentimentalAnalysis>(); List <Domain.Socioboard.Domain.Team> lstGroupMember = new List <Domain.Socioboard.Domain.Team>(); List <Domain.Socioboard.Domain.TicketAssigneeStatus> lstAllAssignedMembers = new List <Domain.Socioboard.Domain.TicketAssigneeStatus>(); //Get All Negative Feeds of FeedSentimentalAnalysis lstNegativeFeed = (List <Domain.Socioboard.Domain.FeedSentimentalAnalysis>)(new JavaScriptSerializer().Deserialize(Apiobjsentimentalanalysis.getAllNegativeFeedsOfProfile(), typeof(List <Domain.Socioboard.Domain.FeedSentimentalAnalysis>))); int FeedNumber = lstNegativeFeed.Count; if (FeedNumber > 0) { //get all Teams with profiles having negative feeds lstGroupMember = (List <Domain.Socioboard.Domain.Team>)(new JavaScriptSerializer().Deserialize(ApiobjTeam.getAllGroupMembersofTeam(), typeof(List <Domain.Socioboard.Domain.Team>))); } foreach (var lstGroupMember_item in lstGroupMember) { ApiobjTicketAssigneeStatus.AddTicketAssigneeStatus(lstGroupMember_item.UserId); } lstAllAssignedMembers = (List <Domain.Socioboard.Domain.TicketAssigneeStatus>)(new JavaScriptSerializer().Deserialize(ApiobjTicketAssigneeStatus.getAllAssignedMembers(), typeof(List <Domain.Socioboard.Domain.TicketAssigneeStatus>))); int Assigneemember = lstAllAssignedMembers.Count; int MemberNumber = lstGroupMember.Count; if (Assigneemember > 0) { Domain.Socioboard.Domain.Team Member = new Domain.Socioboard.Domain.Team(); Domain.Socioboard.Domain.TicketAssigneeStatus objTicketAssigneeStatus = new Domain.Socioboard.Domain.TicketAssigneeStatus(); int j = 0; for (int i = 0; i < FeedNumber; i++) { Domain.Socioboard.Domain.FeedSentimentalAnalysis Feed = lstNegativeFeed[i]; if (j == Assigneemember) { j = 0; } objTicketAssigneeStatus = lstAllAssignedMembers[j]; j++; Guid Id = Feed.Id; Guid ToAssignUserId = objTicketAssigneeStatus.AssigneeUserId; Apiobjsentimentalanalysis.updateAssignedStatus(Id.ToString(), ToAssignUserId.ToString()); Domain.Socioboard.Domain.TicketAssigneeStatus AssigneeDetails = (Domain.Socioboard.Domain.TicketAssigneeStatus)(new JavaScriptSerializer().Deserialize(ApiobjTicketAssigneeStatus.getAssignedMembers(ToAssignUserId.ToString()), typeof(Domain.Socioboard.Domain.TicketAssigneeStatus))); int AssignedCount = AssigneeDetails.AssignedTicketCount; int Count = ++AssignedCount; ApiobjTicketAssigneeStatus.updateAssigneeCount(objTicketAssigneeStatus.AssigneeUserId.ToString(), Count); } } return("Successfully Updated"); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return("Something Went Wrong"); } }
public DataSet bindMessages() { DataSet ds = null; DataSet dataset = new DataSet(); clsFeedsAndMessages clsfeedsandmess = new clsFeedsAndMessages(); string[] profid = new string[] { }; Domain.Socioboard.Domain.Team team = SBUtils.GetTeamFromGroupId(); try { string message = string.Empty; try { profid = Request.QueryString["profileid[]"].Split(','); if (Request.QueryString["type"] != null) { Session["countMesageDataTable_" + profid] = null; } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } string facebook = string.Empty; foreach (var item in profid) { if (string.IsNullOrEmpty(item)) { facebook = "emptyprofile"; } else { facebook = "profile"; } } if (string.IsNullOrEmpty(facebook)) { facebook = "emptyprofile"; } //if (facebook == "emptyprofile") { try { //DataSet ds = null; Session["countMesageDataTable_" + profid] = null; if (facebook == "emptyprofile") { ds = clsfeedsandmess.bindMessagesIntoDataTable(team.Id); } else { ds = clsfeedsandmess.bindFeedMessageIntoDataTable(profid); } //FacebookFeedRepository fbFeedRepo = new FacebookFeedRepository(); Session["MessageDataTable"] = ds; ds = (DataSet)Session["MessageDataTable"]; if (Session["countMessageDataTable"] == null) { Session["countMessageDataTable"] = 0; } int noOfDataToSkip = (int)Session["countMessageDataTable"]; DataTable records = ds.Tables[0].Rows.Cast <System.Data.DataRow>().Skip(noOfDataToSkip).Take(noOfDataToSkip + 15).CopyToDataTable(); Session["countMessageDataTable"] = noOfDataToSkip + 15; //message = this.BindData(records); dataset.Tables.Add(records); return(dataset); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } //else //{ // try // { // DataSet ds = null; // Session["countMessageDataTable"] = null; // ds = clsfeedsandmess.bindFeedMessageIntoDataTable(profid); // Session["MessageDataTable"] = ds; // ds = (DataSet)Session["MessageDataTable"]; // if (Session["countMesageDataTable_" + profid] == null) // { // Session["countMesageDataTable_" + profid] = 0; // } // int noOfDataToSkip = (int)Session["countMesageDataTable_" + profid]; // DataTable records = ds.Tables[0].Rows.Cast<System.Data.DataRow>().Skip(noOfDataToSkip).Take(noOfDataToSkip + 15).CopyToDataTable(); // Session["countMesageDataTable_" + profid] = noOfDataToSkip + 15; // } // catch (Exception ex) // { // Console.WriteLine(ex.StackTrace); // } //} //if (string.IsNullOrEmpty(message)) //{ //} //Response.Write(message); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } return(dataset); }
//Commented by SumitGupta [09-02-2015] //public DataSet bindMessages() //{ // Domain.Socioboard.Domain.User _user = (Domain.Socioboard.Domain.User)Session["User"]; // DataSet ds = null; // DataSet dataset = new DataSet(); // clsFeedsAndMessages clsfeedsandmess = new clsFeedsAndMessages(); // //string[] profid = new string[] { }; // string[] profid = (string[])Session["ProfileSelected"]; // Domain.Socioboard.Domain.Team team = SBUtils.GetTeamFromGroupId(); // try // { // string message = string.Empty; // try // { // //if (profid != null) // //{ // //profid = Request.QueryString["profileid[]"].Split(','); // //if (Request.QueryString["type"] != null) // //{ // Session["countMesageDataTable_" + profid] = null; // //} // //} // } // catch (Exception ex) // { // Console.WriteLine(ex.StackTrace); // } // string facebook = string.Empty; // foreach (var item in profid) // { // if (string.IsNullOrEmpty(item)) // { // facebook = "emptyprofile"; // } // else // { // facebook = "profile"; // } // } // if (string.IsNullOrEmpty(facebook)) // { // facebook = "emptyprofile"; // } // //if (facebook == "emptyprofile") // { // try // { // //DataSet ds = null; // Session["countMesageDataTable_" + profid] = null; // if (facebook == "emptyprofile") // { // ds = clsfeedsandmess.bindMessagesIntoDataTable(team.Id); // } // else // { // ds = clsfeedsandmess.bindFeedMessageIntoDataTable(profid); // } // //FacebookFeedRepository fbFeedRepo = new FacebookFeedRepository(); // Session["MessageDataTable"] = ds; // ds = (DataSet)Session["MessageDataTable"]; // if (Session["countMessageDataTable"] == null) // { // Session["countMessageDataTable"] = 0; // } // int noOfDataToSkip = (int)Session["countMessageDataTable"]; // //DataTable records = ds.Tables[0].Rows.Cast<System.Data.DataRow>().Skip(noOfDataToSkip).Take(noOfDataToSkip + 15).CopyToDataTable(); // DataTable records = ds.Tables[0].Rows.Cast<System.Data.DataRow>().Skip(noOfDataToSkip).Take(15).CopyToDataTable(); // Session["countMessageDataTable"] = noOfDataToSkip + 15; // //message = this.BindData(records); // dataset.Tables.Add(records); // return dataset; // } // catch (Exception ex) // { // Console.WriteLine(ex.StackTrace); // } // } // //else // //{ // // try // // { // // DataSet ds = null; // // Session["countMessageDataTable"] = null; // // ds = clsfeedsandmess.bindFeedMessageIntoDataTable(profid); // // Session["MessageDataTable"] = ds; // // ds = (DataSet)Session["MessageDataTable"]; // // if (Session["countMesageDataTable_" + profid] == null) // // { // // Session["countMesageDataTable_" + profid] = 0; // // } // // int noOfDataToSkip = (int)Session["countMesageDataTable_" + profid]; // // DataTable records = ds.Tables[0].Rows.Cast<System.Data.DataRow>().Skip(noOfDataToSkip).Take(noOfDataToSkip + 15).CopyToDataTable(); // // Session["countMesageDataTable_" + profid] = noOfDataToSkip + 15; // // } // // catch (Exception ex) // // { // // Console.WriteLine(ex.StackTrace); // // } // //} // //if (string.IsNullOrEmpty(message)) // //{ // //} // //Response.Write(message); // } // catch (Exception ex) // { // Console.WriteLine(ex.StackTrace); // } // return dataset; //} //Updated by SumitGupta [09-02-2015] public DataSet bindMessages() { Domain.Socioboard.Domain.User _user = (Domain.Socioboard.Domain.User)Session["User"]; DataSet ds = null; DataSet dataset = new DataSet(); clsFeedsAndMessages clsfeedsandmess = new clsFeedsAndMessages(); //string[] profid = new string[] { }; string[] profid = (string[])Session["ProfileSelected"]; Domain.Socioboard.Domain.Team team = SBUtils.GetTeamFromGroupId(); try { //For getting data range Session["MessageDataTable"] = ds; ds = (DataSet)Session["MessageDataTable"]; if (Session["countMessageDataTable"] == null) { Session["countMessageDataTable"] = 0; } int noOfDataToSkip = (int)Session["countMessageDataTable"]; //DataTable records = ds.Tables[0].Rows.Cast<System.Data.DataRow>().Skip(noOfDataToSkip).Take(15).CopyToDataTable(); Session["countMessageDataTable"] = noOfDataToSkip + 15; string message = string.Empty; try { //if (profid != null) //{ //profid = Request.QueryString["profileid[]"].Split(','); //if (Request.QueryString["type"] != null) //{ Session["countMesageDataTable_" + profid] = null; //} //} } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } string facebook = string.Empty; foreach (var item in profid) { if (string.IsNullOrEmpty(item)) { facebook = "emptyprofile"; } else { facebook = "profile"; } } if (string.IsNullOrEmpty(facebook)) { facebook = "emptyprofile"; } //if (facebook == "emptyprofile") { try { //DataSet ds = null; Session["countMesageDataTable_" + profid] = null; if (facebook == "emptyprofile") { //Updated by SumitGupta [09-02-2015] //ds = clsfeedsandmess.bindMessagesIntoDataTable(team.Id); ds = clsfeedsandmess.bindMessagesIntoDataTable(team.Id, noOfDataToSkip, _user.Id); } else { //Updated by SumitGupta [09-02-2015] //ds = clsfeedsandmess.bindFeedMessageIntoDataTable(profid); ds = clsfeedsandmess.bindFeedMessageIntoDataTable(profid, noOfDataToSkip, _user.Id); } Session["MessageDataTable"] = ds; ds = (DataSet)Session["MessageDataTable"]; if (Session["countMessageDataTable"] == null) { Session["countMessageDataTable"] = 0; } //Updated by Sumit Gupta [09-02-2015] //dataset.Tables.Add(records); //return dataset; return(ds); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } //else //{ // try // { // DataSet ds = null; // Session["countMessageDataTable"] = null; // ds = clsfeedsandmess.bindFeedMessageIntoDataTable(profid); // Session["MessageDataTable"] = ds; // ds = (DataSet)Session["MessageDataTable"]; // if (Session["countMesageDataTable_" + profid] == null) // { // Session["countMesageDataTable_" + profid] = 0; // } // int noOfDataToSkip = (int)Session["countMesageDataTable_" + profid]; // DataTable records = ds.Tables[0].Rows.Cast<System.Data.DataRow>().Skip(noOfDataToSkip).Take(noOfDataToSkip + 15).CopyToDataTable(); // Session["countMesageDataTable_" + profid] = noOfDataToSkip + 15; // } // catch (Exception ex) // { // Console.WriteLine(ex.StackTrace); // } //} //if (string.IsNullOrEmpty(message)) //{ //} //Response.Write(message); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } return(dataset); }
public string AddAnalyticsProfiles(string GAProfiles, string UserId, string GroupId) { try { Analytics _Analytics = new Analytics(); List <Domain.Socioboard.Helper.GoogleAnalyticsProfiles> lstGoogleAnalyticsProfiles = (List <Domain.Socioboard.Helper.GoogleAnalyticsProfiles>) new JavaScriptSerializer().Deserialize(GAProfiles, typeof(List <Domain.Socioboard.Helper.GoogleAnalyticsProfiles>)); Domain.Socioboard.Domain.GoogleAnalyticsAccount _GoogleAnalyticsAccount; foreach (var item in lstGoogleAnalyticsProfiles) { try { _GoogleAnalyticsAccount = new Domain.Socioboard.Domain.GoogleAnalyticsAccount(); _GoogleAnalyticsAccount.UserId = Guid.Parse(UserId); _GoogleAnalyticsAccount.EmailId = item.EmailId; _GoogleAnalyticsAccount.GaAccountId = item.AccountId; _GoogleAnalyticsAccount.GaAccountName = item.AccountName; _GoogleAnalyticsAccount.GaWebPropertyId = item.WebPropertyId; _GoogleAnalyticsAccount.GaProfileId = item.ProfileId; _GoogleAnalyticsAccount.GaProfileName = item.ProfileName; _GoogleAnalyticsAccount.AccessToken = item.AccessToken; _GoogleAnalyticsAccount.RefreshToken = item.RefreshToken; _GoogleAnalyticsAccount.WebsiteUrl = item.WebsiteUrl; string visits = string.Empty; string pageviews = string.Empty; try { string analytics = _Analytics.getAnalyticsData(item.ProfileId, "ga:visits,ga:pageviews", DateTime.UtcNow.AddDays(-7).ToString("yyyy-MM-dd"), DateTime.UtcNow.ToString("yyyy-MM-dd"), item.AccessToken); JObject JData = JObject.Parse(analytics); visits = JData["totalsForAllResults"]["ga:visits"].ToString(); pageviews = JData["totalsForAllResults"]["ga:pageviews"].ToString(); } catch (Exception ex) { visits = "0"; pageviews = "0"; } _GoogleAnalyticsAccount.Views = Double.Parse(pageviews); _GoogleAnalyticsAccount.Visits = Double.Parse(visits); _GoogleAnalyticsAccount.ProfilePicUrl = ConfigurationManager.AppSettings["DomainName"] + "/Themes/" + ConfigurationManager.AppSettings["DefaultGroupName"] + "/Contents/img/analytics_img.png"; _GoogleAnalyticsAccount.IsActive = true; _GoogleAnalyticsAccount.EntryDate = DateTime.UtcNow; if (!_GoogleAnalyticsAccountRepository.checkGoogelAnalyticsUserExists(item.ProfileId, item.AccountId, Guid.Parse(UserId))) { _GoogleAnalyticsAccountRepository.Add(_GoogleAnalyticsAccount); } #region TeamMemberProfile Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId)); if (!grpProfileRepo.checkProfileExistsingroup(Guid.Parse(GroupId), item.ProfileId)) { //Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile(); //objTeamMemberProfile.ProfileId = item.ProfileId; //objTeamMemberProfile.ProfileName = item.ProfileName; //objTeamMemberProfile.ProfilePicUrl = ConfigurationManager.AppSettings["DomainName"] + "/Themes/Socioboard/Contents/img/analytics_img.png"; //objTeamMemberProfile.ProfileType = "googleanalytics"; //objTeamMemberProfile.Status = 1; //objTeamMemberProfile.StatusUpdateDate = DateTime.Now; //objTeamMemberProfile.TeamId = objTeam.Id; //objTeamMemberProfileRepository.addNewTeamMember(objTeamMemberProfile); Domain.Socioboard.Domain.GroupProfile grpProfile = new Domain.Socioboard.Domain.GroupProfile(); grpProfile.Id = Guid.NewGuid(); grpProfile.EntryDate = DateTime.UtcNow; grpProfile.GroupId = Guid.Parse(GroupId); grpProfile.GroupOwnerId = Guid.Parse(UserId); grpProfile.ProfileId = item.ProfileId; grpProfile.ProfileType = "googleanalytics"; grpProfile.ProfileName = item.ProfileName; grpProfile.ProfilePic = ConfigurationManager.AppSettings["DomainName"] + "/Themes/" + ConfigurationManager.AppSettings["DefaultGroupName"] + "/Contents/img/analytics_img.png"; grpProfileRepo.AddGroupProfile(grpProfile); } #endregion #region SocialProfile Domain.Socioboard.Domain.SocialProfile objSocialProfile = new Domain.Socioboard.Domain.SocialProfile(); objSocialProfile.ProfileType = "googleanalytics"; objSocialProfile.ProfileId = item.ProfileId; objSocialProfile.UserId = Guid.Parse(UserId); objSocialProfile.ProfileDate = DateTime.Now; objSocialProfile.ProfileStatus = 1; if (!objSocialProfilesRepository.checkUserProfileExist(objSocialProfile)) { objSocialProfilesRepository.addNewProfileForUser(objSocialProfile); } #endregion } catch (Exception ex) { logger.Error("AddAnalyticsProfiles = > " + ex.Message); } } } catch (Exception ex) { logger.Error("AddAnalyticsProfiles = > " + ex.Message); } return("added successfully"); }