Пример #1
0
        private void buttonGuardar_Click(object sender, EventArgs e)
        {
            int    resultado;
            string query = "";

            if (idRol == 0)
            {
                query = "INSERT INTO Roles(Nombre,Estado) VALUES('" + textNombre.Text + "','" + (checkEstado.Checked ? "1" : "0") + "')";
            }
            else
            {
                query = "UPDATE Roles SET Nombre = '" + textNombre.Text + "' ,Estado = " + (checkEstado.Checked ? "1" : "0") + " WHERE ID_Rol= " + idRol;
            }
            resultado = SqlConexion.ejecutarQuery(query);
            if (resultado == 1)
            {
                this.Hide();
                MessageBox.Show("Rol Guardado", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information);
                new AbmRol.ListadoRol().Show();
            }
            else
            {
                MessageBox.Show("Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        private void buttonBorrar_Click(object sender, EventArgs e)
        {
            int resultado = SqlConexion.ejecutarQuery("DELETE from Roles where ID_Rol = " + idRol);

            if (resultado == 1)
            {
                this.Hide();
                new AbmRol.ListadoRol().Show();
            }
            else
            {
                MessageBox.Show("Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #3
0
        private void UpdateIntentos(string username, bool fallo)
        {
            string query = "update Usuarios set Intentos_login = "******"Intentos_login + 1";
            }
            else
            {
                query += "0";
            }
            query += " where Username like '" + username + "'";
            SqlConexion.ejecutarQuery(query);
        }