コード例 #1
0
        private void login()
        {
            button1.Enabled = false;
            Account acc = serv.Authenticate(txtUsername.Text, MD5(txtPassword.Text));

            if (acc != null)
            {
                if (!acc.GroupId.Equals("customer"))
                {
                    CurrentUser.Username = acc.Username;
                    QuanLy frm = new QuanLy();
                    frm.Show();
                    frm.FormClosed += frm_FormClosed;
                    this.Hide();
                }
                else if (acc.Status.Value == false)
                {
                    lblError.Text = "Tài khoản của bạn đã bị khoá!";
                }
                else
                {
                    lblError.Text = "Xin lỗi, đây chỉ là tài khoản khách hàng";
                }
            }
            else
            {
                lblError.Text = "Tài khoản hoặc mật khẩu không đúng";
            }
            button1.Enabled = true;
        }
コード例 #2
0
 private void login()
 {
     button1.Enabled = false;
     Account acc = serv.Authenticate(txtUsername.Text, MD5(txtPassword.Text));
     if (acc != null)
     {
         if (!acc.GroupId.Equals("customer"))
         {
             CurrentUser.Username = acc.Username;
             QuanLy frm = new QuanLy();
             frm.Show();
             frm.FormClosed += frm_FormClosed;
             this.Hide();
         }
         else if (acc.Status.Value == false)
         {
             lblError.Text = "Tài khoản của bạn đã bị khoá!";
         }
         else
         {
             lblError.Text = "Xin lỗi, đây chỉ là tài khoản khách hàng";
         }
     }
     else
     {
         lblError.Text = "Tài khoản hoặc mật khẩu không đúng";
     }
     button1.Enabled = true;
 }