为了账号安全,请及时绑定邮箱和手机立即绑定

silverlight登录界面中如何实现记住用户和密码以及自动登录功能,数据库为本地数据库perst

silverlight登录界面中如何实现记住用户和密码以及自动登录功能,数据库为本地数据库perst

POPMUISE 2018-12-06 14:14:38
各位高手,小弟是Silverlight新手,现在遇到一个问题,请各位高手帮忙,小弟不胜感激!!! silverlight登录界面中如何实现记住用户和密码以及自动登录功能,数据库为本地数据库perst: 具体要求是,第一次访问从服务器端获取数据保存到本地perst数据库,以后每次访问从本地数据库perst获取用户信息进行验证,点击“记住用户名和密码”和自动登录,能够自动完成登录,基本功能都完成了,可是点击自动登录和记住用户名和密码都不管用,不知道怎么回事,还请各位高手帮小弟一把,谢谢 /// <summary>        /// 记住用户名和密码        /// </summary>        private void remCheckBox_Click(object sender, RoutedEventArgs e)        {            this.EventRemember();        }        /// <summary>        /// 自动登录        /// </summary>        private void autoLogin_Click(object sender, RoutedEventArgs e)        {            this.EventAuto();        }        /// <summary>        /// 单击登录按钮        /// </summary>        private void btnLogin_Click(object sender, RoutedEventArgs e)        {            this.EventLogin();        }                #endregion         #region Methods         /// <summary>        /// 记住用户名和密码        /// </summary>        private void EventRemember()        {            if (DatabaseHelper.ExistsTable<T_UserInfo>(database))            {                //判断是否有记录                IEnumerable<T_UserInfo> rem = null;                rem = (from log in database.GetRecords<T_UserInfo>()                       where log.UserLoginName == Model.Frame.SystemRunInfo.Instance.LoginUserName &&                       log.UserPassword == Model.Frame.SystemRunInfo.Instance.LoginPassword                       select log);                if (rem != null && rem.ToList<T_UserInfo>().Count > 0)                {                    //取出该条记录的“记住账户和密码”项                    T_UserInfo obj = rem.ToList<T_UserInfo>()[0];                    //修改“记住账户和密码”项                    if (this.remCheckBox.IsChecked.Equals(true))                    {                        obj.IsRemPw = 1;                    }                    else if (this.remCheckBox.IsChecked.Equals(false))                    {                        obj.IsRemPw = 0;                    }                    database.AddRecord(obj);                }            }        }        /// <summary>        /// 自动登录        /// </summary>        private void EventAuto()        {            //判断是否有记录            IEnumerable<T_UserInfo> auto = null;            auto = (from log in database.GetRecords<T_UserInfo>()                    where log.UserLoginName ==                    Model.Frame.SystemRunInfo.Instance.LoginUserName && log.UserPassword == Model.Frame.SystemRunInfo.Instance.LoginPassword                    select log);            if (auto != null && auto.ToList<T_UserInfo>().Count > 0)            {                //取出该条记录的“自动登录”项                T_UserInfo obj = auto.ToList<T_UserInfo>()[0];                //修改“自动登录”项                if (this.autoLogin.IsChecked.Equals(true))                {                    obj.IsAutoLogin = 1;                }                else if (this.autoLogin.IsChecked.Equals(false))                {                    obj.IsAutoLogin = 0;                }                database.AddRecord(obj);            }        }
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 424 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信