Пример #1
0
        public void bttLogIn_Click(object sender, EventArgs e)
        {
            string userName = "******", passWord = "******";
            string userNV = "nhanvien", passNV = "nhanvien";

            if (CompareTwoString(userName, txtUsername.Text) && CompareTwoString(passWord, txtPassword.Text))
            {
                MessageBox.Show("Log In successfuly.");
                this.Hide();
                Frm_Connection connect = new Frm_Connection();
                connect.Show();
            }
            else if (CompareTwoString(userNV, txtUsername.Text) && CompareTwoString(passNV, txtPassword.Text))
            {
                string err = string.Empty;
                MessageBox.Show("Log In successfully.");
                this.Hide();
                DialogResult res     = MessageBox.Show(new Cl_Database().KiemTraKetNoi(ref err) ? "Connected" : "Fail\n" + err);
                Frm_Main     frmMain = new Frm_Main();
                frmMain.Show();
            }
            else
            {
                MessageBox.Show("Incorrect username or password.");
                txtUsername.Text = txtPassword.Text = "";
                txtUsername.Focus();
            }
        }
Пример #2
0
        public void bttLogIn_Click(object sender, EventArgs e)
        {
            string userName = "******", passWord = "******";

            if (CompareTwoString(userName, txtUsername.Text) && CompareTwoString(passWord, txtPassword.Text))
            {
                MessageBox.Show("Log In successfuly!!!");
                this.Hide();
                Frm_Main main = new Frm_Main();
                main.Show();
            }
            else
            {
                MessageBox.Show("Incorrect username or password!!!");
                txtUsername.Text = txtPassword.Text = "";
                txtUsername.Focus();
            }
        }
Пример #3
0
 private void bttConnect_Click(object sender, EventArgs e)
 {
     if (cbbDatabaseName.SelectedIndex == -1)
     {
         MessageBox.Show("Please choose any database in your server.");
         return;
     }
     if (string.Compare(cbbDatabaseName.SelectedItem.ToString(), "Notary_Contract") == 0)
     {
         this.Hide();
         DialogResult res = MessageBox.Show(db.KiemTraKetNoi(ref err) ? "Connected" : "Fail\n" + err);
         if (res == DialogResult.OK)
         {
             Frm_Main main = new Frm_Main();
             main.Show();
         }
     }
     else
     {
         MessageBox.Show("You need to choose a compatible database for your project.");
     }
 }