public bool Login(b_User user)
        {
            b_User newUser = dao.LongIn(user);

            if (newUser != null)
            {
                return(true);
            }
            return(false);
        }
Beispiel #2
0
 public b_User LongIn(b_User user)
 {
     using (ERP2008Entities erp2008 = new ERP2008Entities())
     {
         CustomMD5 custom = new CustomMD5();
         string    pwd    = custom.getpwd(user.cPassword);
         b_User    query  = (from u in erp2008.b_User where u.cUser_Id == user.cUser_Id && u.cPassword == pwd select u).SingleOrDefault();
         if (query != null)
         {
             return(query);
         }
         else
         {
             return(null);
         }
     }
 }
Beispiel #3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            LogInCount++;
            if (LogInCount > 5)
            {
                MessageBox.Show("你是在捣乱的把!", messageHead, MessageBoxButtons.OK, MessageBoxIcon.Information);
                Application.Exit();
            }
            if (txtAccount.Text != null && txtAccount.Text.Equals(""))
            {
                MessageBox.Show("用户不能为空!", messageHead, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (txtPwd.Text != null && txtPwd.Text.Equals(""))
            {
                MessageBox.Show("密码不能为空!", messageHead, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            b_User user = new b_User();

            user.cPassword = txtPwd.Text;
            user.cUser_Id  = txtAccount.Text;
            //验证用户和密码在数据库里面有没有才可以登录。
            //MessageBox.Show("登录进来了。", "信息提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Boolean req = bll.Login(user);

            if (bll.Login(user))
            {
                FrmMainBoy boy = new FrmMainBoy();
                boy.showlogin += new Manages.FrmMainBoy.ShowLogin(ShowLonin);
                this.Hide();
                boy.Show();
            }
            else
            {
                MessageBox.Show("账号或密码错误!", messageHead, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }