Пример #1
0
        void Button2Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Realmente quieres cerrar sesión?", "AVISO",MessageBoxButtons.YesNo,MessageBoxIcon.Question) == DialogResult.Yes) {

                MainForm frm1 = new MainForm();
                this.Hide();
                frm1.Show();
            }
            else{
                Admin frm = new Admin(this.usuario);
                this.Hide();
                frm.Show();
            }
        }
Пример #2
0
        void ValidacionUsuario()
        {
            string query = "";
            string usuario = textBox1.Text.Trim();
            string password = textBox2.Text.Trim();
            string tipo = comboBox1.Text;
            Hash hash = new Hash();
            password = hash.GetMd5Hash(password);
            LoginMySql consulta = new LoginMySql();
            query = consulta.queryUsuario(usuario, password, tipo);
            if(query.Length == 0)
            {
                MessageBox.Show("Datos incorrectos", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                textBox1.Focus();
            }
            if(query.Length > 0 && tipo == "Administrador")
            {
                Admin frm3 = new Admin(query);
                frm3.Show();
                this.Hide();
            }
            if(query.Length > 0 && tipo == "Cajero"){
                Cajero frm = new Cajero(query);
                frm.Show();
                this.Hide();
            }
            if(query.Length > 0 && tipo == "Soporte tecnico") {
                SuperUsuario frm2 = new SuperUsuario(query);
                frm2.Show();
                this.Hide();

            }
        }