Beispiel #1
0
 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");
     }
 }
Beispiel #2
0
        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");
            }
        }
Beispiel #3
0
        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");
            }
        }
Beispiel #4
0
 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 "";
 }
Beispiel #6
0
 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 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 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";
            }
        }
Beispiel #9
0
        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 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 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";
     }
 }
Beispiel #12
0
        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 "";
        }
Beispiel #13
0
        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("");
        }