public void Persist( OAuthTokenResponse me, string oauth_token, string oauth_verifier) { if (_clientInfo == null) GetUser(); using (Database db = new MySqlDatabase()) { ClientInfo ci = db.GetClientInfo(Util.UserId); db.UpdateSocialCredential(ci.ClientId, SocialConnector.Twitter, "twitterid", Convert.ToString(me.UserId)); db.UpdateSocialCredential(ci.ClientId, SocialConnector.Twitter, "oauthtoken", oauth_token); db.UpdateSocialCredential(ci.ClientId, SocialConnector.Twitter, "oauthverifier", oauth_verifier); _clientInfo.TwitterId = me.ScreenName; db.RegisterClientInfo( _clientInfo.LastName, _clientInfo.FirstName, _clientInfo.AddressLine1, _clientInfo.AddressLine2, _clientInfo.ZipCode, _clientInfo.State, _clientInfo.City, _clientInfo.Country, _clientInfo.Language, _clientInfo.Telephone, _clientInfo.Cellular, _clientInfo.CompanyName, _clientInfo.UserId, _clientInfo.AccountOwner, _clientInfo.BumaCode, _clientInfo.SenaCode, _clientInfo.IsrcCode, _clientInfo.TwitterId, _clientInfo.FacebookId, _clientInfo.SoundCloudId, _clientInfo.SoniallId, _clientInfo.OwnerKind, _clientInfo.CreditCardNr, _clientInfo.CreditCardCvv, _clientInfo.EmailReceipt, _clientInfo.Referer, _clientInfo.Gender, _clientInfo.Birthdate, _clientInfo.stagename); } }
protected void Page_Load(object sender, EventArgs e) { string scope = Request.QueryString["scope"]; string access_token = Request.QueryString["access_token"]; if (!string.IsNullOrEmpty(access_token)) { using (Database db = new MySqlDatabase()) { UserInfo ui = db.GetUser(Util.UserId); ClientInfo ci = db.GetClientInfo(ui.UserId); db.UpdateSocialCredential(ci.ClientId, SocialConnector.SoundCloud, "access_token", access_token); db.UpdateSocialCredential(ci.ClientId, SocialConnector.SoundCloud, "scope", scope); db.UpdateSoundCloudId(ci.ClientId, GetUserData(access_token)); } } }
protected void Page_Load(object sender, EventArgs e) { string retUrl = Request.Params["url"].Trim('#'); string accessToken = string.Empty; using (Database db = new MySqlDatabase()) { ClientInfo ci = db.GetClientInfo(Util.UserId); string[] kvps = retUrl.Split('&'); foreach (string kvp in kvps) { string[] parts = kvp.Split('='); if (parts.Length == 2) { string key = parts[0]; string val = parts[1]; if (val.EndsWith(",/social/soundcloud.aspx")) val = val.Substring(0, val.Length - ",/social/soundcloud.aspx".Length); if (string.Compare(key, "access_token", true) == 0) accessToken = val; db.UpdateSocialCredential(ci.ClientId, SocialConnector.SoundCloud, key, val); } } } if (!string.IsNullOrEmpty(accessToken)) { string userName = GetUserData(accessToken); using (Database db = new MySqlDatabase()) { UserInfo ui = db.GetUser(Util.UserId); ClientInfo ci = db.GetClientInfo(ui.UserId); db.UpdateSoundCloudId(ci.ClientId, userName); } } }
/// <summary> /// Save Facebook data to the database /// </summary> /// <param name="me">Me info</param> /// <param name="accessToken">Access token</param> /// <param name="expires">Experiation of the access token</param> public void Persist(Me me, string accessToken, DateTime expires) { if (_clientInfo == null) GetUser(); using (Database db = new MySqlDatabase()) { db.UpdateSocialCredential(_clientInfo.ClientId, SocialConnector.Facebook, "facebookid", me.Id); db.UpdateSocialCredential(_clientInfo.ClientId, SocialConnector.Facebook, "accesstoken", accessToken); db.UpdateSocialCredential(_clientInfo.ClientId, SocialConnector.Facebook, "accesstokenexpires", expires.ToString("o")); string facebookId = me.Name; _clientInfo.FacebookId = facebookId; db.RegisterClientInfo( _clientInfo.LastName, _clientInfo.FirstName, _clientInfo.AddressLine1, _clientInfo.AddressLine2, _clientInfo.ZipCode, _clientInfo.State, _clientInfo.City, _clientInfo.Country, _clientInfo.Language, _clientInfo.Telephone, _clientInfo.Cellular, _clientInfo.CompanyName, _clientInfo.UserId, _clientInfo.AccountOwner, _clientInfo.BumaCode, _clientInfo.SenaCode, _clientInfo.IsrcCode, _clientInfo.TwitterId, _clientInfo.FacebookId, _clientInfo.SoundCloudId, _clientInfo.SoniallId, _clientInfo.OwnerKind, _clientInfo.CreditCardNr, _clientInfo.CreditCardCvv, _clientInfo.EmailReceipt, _clientInfo.Referer, _clientInfo.Gender, _clientInfo.Birthdate, _clientInfo.stagename); } }