Пример #1
0
        /// <summary>
        /// 记录用户名密码 到 记住用户表
        /// </summary>
        private void WriteUserTo_CoreLoginUserPwd()
        {
            _CoreLoginUserPwd.ExecuteCommand("delete from LoginUserPwd", null);
            LoginUserPwd _LoginUserPwd = new LoginUserPwd();

            if (this.checkEdit1.Checked)
            {
                _LoginUserPwd.Login_UserName = this.textBox1.Text.Trim();
                _LoginUserPwd.Login_Pwd      = SecurityUnitity.AES_Encrypt(this.textBox2.Text.Trim(), ConstKeyUnitity.AESKEY);
                _LoginUserPwd.Login_Time     = new CoreGetTime().GetNow();

                _CoreLoginUserPwd.AddEntity(_LoginUserPwd);
            }
        }
Пример #2
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            User_MST _User_MST = new User_MST();

            if (string.IsNullOrEmpty(this.textBox1.Text.Trim()))
            {
                MsgBox.Warning("用户ID不可为空!!!");
                return;
            }
            if (string.IsNullOrEmpty(this.textBox2.Text.Trim()))
            {
                MsgBox.Warning("用户姓名不可为空!!!");
                return;
            }
            if (string.IsNullOrEmpty(this.textBox3.Text.Trim()))
            {
                MsgBox.Warning("用户密码不可为空!!!");
                return;
            }
            _User_MST.User_Id    = this.textBox1.Text.Trim();
            _User_MST.User_Name  = this.textBox2.Text.Trim();
            _User_MST.User_Pwd   = SecurityUnitity.GetMD5_32(this.textBox3.Text.Trim());
            _User_MST.User_Email = this.textBox4.Text.Trim();
            if (0 == this.radioGroup1.SelectedIndex)
            {
                _User_MST.User_Gener = "M";//男M 女F
            }
            if (1 == this.radioGroup1.SelectedIndex)
            {
                _User_MST.User_Gener = "F";//男M 女F
            }
            _User_MST.User_RegTime = new CoreGetTime().GetNow();
            _User_MST.User_Status  = 1;

            CoreUser_MST _CoreUser_MST = new CoreUser_MST();

            try
            {
                _CoreUser_MST.AddEntity(_User_MST);
                MsgBox.Infor("用户注册成功!!!");
            }
            catch (Exception ex)
            {
                MsgBox.Warning("用户注册失败:" + ex.Message);
            }
        }
Пример #3
0
        private void LoadLoginUserPwd()
        {
            var _mlist = _CoreLoginUserPwd.LoadEntities(null).ToList();

            if (_mlist.Count > 0)//已经存在用户名密码
            {
                this.textBox1.Text      = _mlist[0].Login_UserName;
                this.textBox2.Text      = SecurityUnitity.AES_Decrypt(_mlist[0].Login_Pwd, ConstKeyUnitity.AESKEY);
                this.checkEdit1.Checked = true;
            }
            else
            {
                this.textBox1.Text      = string.Empty;
                this.textBox2.Text      = string.Empty;
                this.checkEdit1.Checked = false;
            }
        }
Пример #4
0
        /// <summary>
        /// 验证用户 如果正确就直接登录,并更新登录时间 登录IP
        /// </summary>
        /// <returns></returns>
        private User_MST CheckUserIdPWD()
        {
            string _UserId   = this.textBox1.Text.Trim();
            string _PassWord = SecurityUnitity.GetMD5_32(this.textBox2.Text.Trim());
            var    _list     = _CoreUser_MST.LoadEntities(t => t.User_Id == _UserId && t.User_Pwd == _PassWord).ToList();

            if (_list.Count == 1)
            {
                DateTime _now = new CoreGetTime().GetNow();
                _list[0].User_LogTime = _now;
                _list[0].User_LogIp   = NetUnitity.GetLannIP();

                int retVal = _CoreUser_MST.UpdateEntityBySomeColums(_list[0], t => new { t.User_LogIp, t.User_LogTime });

                return(_list[0]);
            }
            else
            {
                return(null);
            }
        }