Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
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);
            }
        }