Example #1
0
        private void button1_Click_2(object sender, EventArgs e)
        {
            if (this.nombreRol.Text == "")
            {
                MessageBox.Show("Nombre de rol no permitido");
                return;
            }

            try
            {
                ConexionBD.Conexion conection = new ConexionBD.Conexion().getInstance();
                conection.executeProcedure(Properties.Settings.Default.Schema + ".cambiarNombreRol",
                                           new List <String>()
                {
                    "@nombreRol", "@nuevoNombre"
                },
                                           new String[] {
                    this.rol, this.nombreRol.Text
                }
                                           );

                MessageBox.Show("Rol '" + this.rol + "' ahora se llama '" + this.nombreRol.Text + "'");
                this.Hide();
                new Editar(this.nombreRol.Text).Show();
            }
            catch (Exception)
            {
                MessageBox.Show("Error al cambiar de nombre de rol '" + this.rol + "'" + " a '" + this.nombreRol.Text + "'. " +
                                "Podría ya existir un rol con ese nombre.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("¿Desea inhabilitar el rol '" + this.rol + "'?",
                                                  "Inhabilitar rol",
                                                  MessageBoxButtons.YesNo,
                                                  MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                try
                {
                    ConexionBD.Conexion conection = new ConexionBD.Conexion().getInstance();
                    conection.executeProcedure(Properties.Settings.Default.Schema + ".inhabilitarRol",
                                               new List <String>()
                    {
                        "@nombreRol"
                    },
                                               new String[] {
                        this.rol
                    }
                                               );

                    MessageBox.Show("Rol '" + this.rol + "' inhabilitado correctamente");
                    this.Hide();
                    new Editar(this.rol).Show();
                }
                catch (Exception)
                {
                    MessageBox.Show("Error al inhabilitar el rol '" + this.rol + "'");
                }
            }
        }
Example #3
0
        private bool agregarFuncionalidad(string func)
        {
            try
            {
                ConexionBD.Conexion conection = new ConexionBD.Conexion().getInstance();
                conection.executeProcedure(Properties.Settings.Default.Schema + ".agregarFuncionalidadARol",
                                           new List <String>()
                {
                    "@nombreRol", "@descripcionFuncionalidad"
                },
                                           new String[2] {
                    this.rol, func
                });

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #4
0
        private void eliminarFuncionalidad(string funcionalidad)
        {
            try
            {
                ConexionBD.Conexion conection = new ConexionBD.Conexion().getInstance();
                conection.executeProcedure(Properties.Settings.Default.Schema + ".eliminarFuncionalidadARol",
                                           new List <String>()
                {
                    "@nombreRol", "@descripcionFuncionalidad"
                },
                                           new String[2] {
                    this.rol, funcionalidad
                });

                MessageBox.Show("Funcionalidad " + funcionalidad + " eliminada correctamente para '" + this.rol + "'");
            }
            catch (Exception)
            {
                MessageBox.Show("Error al eliminar la funcionalidad " + funcionalidad);
            }
        }
Example #5
0
        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                ConexionBD.Conexion conection = new ConexionBD.Conexion().getInstance();
                conection.executeProcedure(Properties.Settings.Default.Schema + ".habilitarRol",
                                           new List <String>()
                {
                    "@nombreRol"
                },
                                           new String[] {
                    this.rol
                }
                                           );

                MessageBox.Show("Rol '" + this.rol + "' habilitado correctamente");
                this.Hide();
                new Editar(this.rol).Show();
            }
            catch (Exception)
            {
                MessageBox.Show("Error al habilitar el rol '" + this.rol + "'", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }