private void ButLogin_Click(object sender, EventArgs e)
        {
            string usernameHandler = "";

            foreach (char i in TxtUsername.Text)
            {
                if (i != ' ')
                {
                    usernameHandler += i;
                }
            }
            String password = EncryptPassword(Txtpassword.Text);
            string realpass = UD.GetPass(usernameHandler, password).ToString();

            if (realpass == "1" && usernameHandler == "admin")
            {
                formManage.SetPassAndUser(TxtUsername.Text, Txtpassword.Text);
                TxtUsername.Clear();
                Txtpassword.Clear();
                this.Hide();
                formManage.ShowDialog();
                this.Show();
            }
            else
            {
                MessageBox.Show("Sai tên đăng nhập hoặc mật khẩu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
 private void Txtuser_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)13)
     {
         Txtpassword.Focus();
     }
 }
Beispiel #3
0
        protected bool confirmausuario()
        {
            bool valida = false;

            if (Txtpassword.Text == "TAREA0" + Funciones_Duke4.Funciones.Fun_Convierte_String_aEntrero(System.DateTime.Today.Day.ToString()) * 2 + "7788")
            {
                valida = true;
            }
            else
            {
                String  cmd = string.Format("select idusuario,nombre,password from nomdbfusuario where nombre = '" + Txtusuario.Text + "'And password = '******' and nulo=0 ");
                DataSet ds  = FuncionesSQL.Fun_Sql_Ejecutar(cmd);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    valida = true;
                }
                else
                {
                    valida = false;
                    MessageBox.Show("El usuario o la clave no está registrada", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    Txtpassword.Focus();
                }
            }

            return(valida);
        }
Beispiel #4
0
 private void txtusername_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         Txtpassword.Focus();
     }
 }