当前位置: 首页>>代码示例>>C#>>正文


C# MySqlDatabase.GetSocialCredential方法代码示例

本文整理汇总了C#中MySqlDatabase.GetSocialCredential方法的典型用法代码示例。如果您正苦于以下问题:C# MySqlDatabase.GetSocialCredential方法的具体用法?C# MySqlDatabase.GetSocialCredential怎么用?C# MySqlDatabase.GetSocialCredential使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MySqlDatabase的用法示例。


在下文中一共展示了MySqlDatabase.GetSocialCredential方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FillFacebookInfo

        private bool FillFacebookInfo(ClientInfo ManagedUserInfo)
        {
            if (ManagedUserInfo != null)
                if (!string.IsNullOrEmpty(ManagedUserInfo.FacebookId))
                {
                    using (Database db = new MySqlDatabase())
                    {
                        ClientInfo ci = db.GetClientInfo(Convert.ToInt64(Session["managed.userid"]));

                        Session["FBACC"] = db.GetSocialCredential(ci.ClientId, SocialConnector.Facebook, "accesstoken");

                        string expiresRaw = db.GetSocialCredential(ci.ClientId, SocialConnector.Facebook, "accesstokenexpires");

                        Facebook.AuthenticationService authServices = new Facebook.AuthenticationService();

                        if (authServices.TryAuthenticateAdminFBCred(expiresRaw, Convert.ToString(Session["FBACC"])))
                        {
                            Me me = authServices.GetMe(Convert.ToString(Session["FBACC"]));

                            try
                            {
                                Session["FBID"] = me.Id;
                            }
                            catch { }

                            FillFBFriendList(Convert.ToString(Session["FBACC"]));

                            FillFBPageList(Convert.ToString(Session["FBACC"]));

                            cbxShareToUserWall.Enabled = true;

                            cbxShareToUserWall.Visible = true;

                            divShareToUserWall.Visible = true;

                            return true;
                        }
                        else
                        {
                            Session["FBACC"] = Session["FBID"] = null;

                            db.RemoveSocialCredential(ci.ClientId, SocialConnector.Facebook);

                            db.UpdateFacebookID(ci.ClientId);

                            FillFBFriendList(null);

                            FillFBPageList(null);

                            cbxShareToUserWall.Enabled = false;

                            cbxShareToUserWall.Visible = false;

                            divShareToUserWall.Visible = false;

                            return false;
                        }
                    }
                }

            Session["FBACC"] = Session["FBID"] = null;

            FillFBFriendList(null);

            FillFBPageList(null);

            cbxShareToUserWall.Enabled = false;

            cbxShareToUserWall.Visible = false;

            divShareToUserWall.Visible = false;

            return false;
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:74,代码来源:RegisterDocManaged.aspx.cs

示例2: FillSoundCloudInfo

        private bool FillSoundCloudInfo(ClientInfo ManagedUserInfo)
        {
            if (ManagedUserInfo != null)
                if (!string.IsNullOrEmpty(ManagedUserInfo.SoundCloudId))
                {
                    using (Database db = new MySqlDatabase())
                    {
                        ClientInfo ci = db.GetClientInfo(Convert.ToInt64(Session["managed.userid"]));

                        Session["soundCloudAccessToken"] = db.GetSocialCredential(ci.ClientId, SocialConnector.SoundCloud, "access_token");
                    }

                    cbxSendToSoundCloud.Enabled = true;
                    SoundCloudMsg.Enabled = true;
                    cbxSendToSoundCloud.Visible = true;

                    return true;
                }

            Session["soundCloudAccessToken"] = null;

            cbxSendToSoundCloud.Enabled = false;
            cbxSendToSoundCloud.Visible = false;
            SoundCloudMsg.Enabled = false;

            return false;
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:27,代码来源:RegisterDocManaged.aspx.cs

示例3: FillTwitterInfo

        private void FillTwitterInfo(ClientInfo ManagedUserInfo)
        {
            if (ManagedUserInfo != null)
                if (!string.IsNullOrEmpty(ManagedUserInfo.TwitterId))
                {
                    using (Database db = new MySqlDatabase())
                    {
                        ClientInfo ci = db.GetClientInfo(Convert.ToInt64(Session["managed.userid"]));

                        Session["AccessToken"] = db.GetSocialCredential(ManagedUserInfo.ClientId, SocialConnector.Twitter, "oauthtoken");

                        Session["AccessTokenSecret"] = db.GetSocialCredential(ManagedUserInfo.ClientId, SocialConnector.Twitter, "oauthverifier");
                    }

                    cbxSendToTwitter.Enabled = true;

                    TwitterMsg.Enabled = true;

                    cbxSendToTwitter.Visible = true;

                    return;
                }

            Session["AccessToken"] = Session["AccessTokenSecret"] = null;

            cbxSendToTwitter.Enabled = false;

            TwitterMsg.Enabled = false;

            cbxSendToTwitter.Visible = false;
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:31,代码来源:RegisterDocManaged.aspx.cs

示例4: FillManagedArtistDropDown

        private void FillManagedArtistDropDown()
        {
            ddlManagedArtist.Items.Clear();
            ddlManagedArtist.Items.Add(new ListItem("---", "0"));

            using (Database db = new MySqlDatabase())
            {
                UserInfo[] uis = db.GetManagedUsers(Util.UserId, 1);

                foreach (UserInfo ui in uis)
                {
                    ClientInfo ci = db.GetClientInfo(ui.UserId);
                    ddlManagedArtist.Items.Add(new ListItem(ci.GetFullName(), ui.UserId.ToString()));
                }

                if (!string.IsNullOrEmpty(Request["id"]))
                {
                    Session["managed.userid"] = Convert.ToInt64(Request["id"]);

                    IsrcHandle.Text = GetIsrcCode(Convert.ToInt64(Session["managed.userid"]));

                    ddlManagedArtist.SelectedValue = Request.QueryString["id"].ToString();

                    ClientInfo _ManagedUserInfo = db.GetClientInfo(Convert.ToInt64(Request.QueryString["id"]));

                    string accessToken = db.GetSocialCredential(_ManagedUserInfo.ClientId, SocialConnector.Facebook, "accesstoken");

                    string expiresRaw = db.GetSocialCredential(_ManagedUserInfo.ClientId, SocialConnector.Facebook, "accesstokenexpires");

                    bool isNotExpired = true;

                    Facebook.AuthenticationService authService = new Facebook.AuthenticationService();

                    if (authService.TryAuthenticateAdminFBCred(expiresRaw, accessToken))
                    {
                        isNotExpired = true;
                    }
                    else
                    {
                        db.RemoveSocialCredential(_ManagedUserInfo.ClientId, SocialConnector.Facebook);
                        db.UpdateFacebookID(_ManagedUserInfo.ClientId);

                        isNotExpired = false;
                    }

                }
            }
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:48,代码来源:RegisterDocManaged.aspx.cs

示例5: FillTwitterInfo

        private void FillTwitterInfo()
        {
            if (!string.IsNullOrEmpty(_clientInfo.TwitterId))
            {
                using (Database db = new MySqlDatabase())
                {
                    ClientInfo ci = db.GetClientInfo(Util.UserId);

                    Session["AccessToken"] = db.GetSocialCredential(ci.ClientId, SocialConnector.Twitter, "oauthtoken");

                    Session["AccessTokenSecret"] = db.GetSocialCredential(_clientInfo.ClientId, SocialConnector.Twitter, "oauthverifier");
                }

                cbxSendToTwitter.Enabled = true;

                TwitterMsg.Enabled = true;

                cbxSendToTwitter.Visible = true;

                return;
            }

            cbxSendToTwitter.Enabled = false;

            TwitterMsg.Enabled = false;

            cbxSendToTwitter.Visible = false;
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:28,代码来源:RegisterDocument.aspx.cs

示例6: FillSoundCloudInfo

        private bool FillSoundCloudInfo()
        {
            if (!string.IsNullOrEmpty(_clientInfo.SoundCloudId))
            {
                using (Database db = new MySqlDatabase())
                {
                    ClientInfo ci = db.GetClientInfo(Util.UserId);

                    Session["soundCloudAccessToken"] = db.GetSocialCredential(ci.ClientId, SocialConnector.SoundCloud, "access_token");
                }

                cbxSendToSoundCloud.Enabled = true;

                SoundCloudMsg.Enabled = true;

                cbxSendToSoundCloud.Visible = true;

                return true;
            }

            cbxSendToSoundCloud.Enabled = false;

            SoundCloudMsg.Enabled = false;

            cbxSendToSoundCloud.Visible = false;

            return false;
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:28,代码来源:RegisterDocument.aspx.cs

示例7: TryAuthenticate

        /// <summary>
        /// Authenticate with social credentials from database. Also validates at Facebook.
        /// </summary>
        /// <param name="me">Me info</param>
        /// <param name="accessToken">Access token</param>
        /// <returns>True if authenticated, false if not.</returns>
        public bool TryAuthenticate(out Me me, out string accessToken)
        {
            if (_clientInfo == null) GetUser();

            me = null;
            accessToken = "";
            using (Database db = new MySqlDatabase())
            {
                accessToken = db.GetSocialCredential(_clientInfo.ClientId, SocialConnector.Facebook, "accesstoken");
                if (String.IsNullOrEmpty(accessToken))
                    return false;

                string expiresRaw = db.GetSocialCredential(_clientInfo.ClientId, SocialConnector.Facebook, "accesstokenexpires");
                if (String.IsNullOrEmpty(expiresRaw))
                    return false;

                DateTime expires = DateTime.MinValue;
                if (!DateTime.TryParse(expiresRaw, out expires))
                    return false;
                if (expires < DateTime.Now)
                    return false;

                me = GetMe(accessToken);
                if (me == null)
                    return false;
            }

            return true;
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:35,代码来源:AutenticationService.cs

示例8: TryAuthenticate

        public bool TryAuthenticate(out string oauthtoken, out string oauthverifier)
        {
            if (_clientInfo == null) GetUser();

            oauthtoken = null;
            oauthverifier = null;

            using (Database db = new MySqlDatabase())
            {
                oauthtoken = db.GetSocialCredential(_clientInfo.ClientId, SocialConnector.Twitter, "oauthtoken");
                if (String.IsNullOrEmpty(oauthtoken))
                    return false;

                oauthverifier = db.GetSocialCredential(_clientInfo.ClientId, SocialConnector.Twitter, "oauthverifier");
                if (String.IsNullOrEmpty(oauthverifier))
                    return false;
            }

            if (IsTwitterAccessTokenValid(oauthtoken, oauthverifier) == false)
                return false;

            return true;
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:23,代码来源:AuthenticationService.cs


注:本文中的MySqlDatabase.GetSocialCredential方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。