Exemplo n.º 1
0
        private void btnIngresar_Click(object sender, EventArgs e)
        {
            //comentario de prueba git Primer intento

            //COMENTARIO EMILIA


            Menu.MenuPrincipal MP = new Menu.MenuPrincipal();
            MP.Visible = true;
        }
Exemplo n.º 2
0
        private void btnIngresar_Click(object sender, EventArgs e)
        {
            string nombreU = txtUsuario.Text;

            password = txtContraseña.Text;
            MD5 md5 = MD5.Create();

            byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(password);
            byte[] hash       = md5.ComputeHash(inputBytes);
            password         = BitConverter.ToString(hash).Replace("-", "");
            contraseñaEncrip = password.ToString();

            SqlConnection  con = new SqlConnection(@"Data Source = EMYLAVENIA\SQLEXPRESS; Initial Catalog = Gestion-V2; Integrated Security = True");
            SqlDataAdapter sda = new SqlDataAdapter("Select * From Usuario Where NombreUsuario='" + nombreU + "' and Contraseña= '" + contraseñaEncrip + "'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                if (nombreU == "Administrador")
                {
                    this.Hide();
                    Menu.MenuPrincipal mp = new Menu.MenuPrincipal();
                    mp.Show();
                }
                else
                {
                    this.Hide();
                    Menu.MenuSecundario ms = new Menu.MenuSecundario();
                    ms.Show();
                }
            }
            else
            {
                MessageBox.Show("DATOS DE USUARIO INCORRECTOS");
            }
        }