using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Data.Common; using AyABL.AUT; using AyAEL.SEG; using AyADAL; namespace AyABL.SEG { public class RolBL : AyABL { #region Constructores public RolBL() { objRolEL = new RolEL(); this.NombreTabla = Modulos.t_seg_.ToString() + Tablas.rol.ToString(); this.NombreConeccionBD = BASESDEDATOS.FOPI.ToString(); } #endregion #region Atributos public RolEL objRolEL { get; set; } #endregion #region Metodos /// /// Inluye los datos del Rol /// /// public bool insertarRol() { bool blnEjecutado = false; this.CamposTabla = Concepto.NOMBRE.ToString() + Tablas.rol.ToString(); this.ValoresCampos = new object[]{ objRolEL.Nombre }; baseDAL.Insertar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD, null); return blnEjecutado; } /// /// Actualiza el dato del Rol /// public void actualizarRole() { ArrayList arlCondiciones = new ArrayList(); try { if (objRolEL.PK != 0) { arlCondiciones.Add(this.buscarPorPK(objRolEL.PK, Tablas.rol, operadorLogico.AND)); this.CamposTabla = Concepto.NOMBRE.ToString() + Tablas.rol.ToString(); this.ValoresCampos = new object[]{ objRolEL.Nombre }; baseDAL.Actualizar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD, arlCondiciones); } } catch (Exception ex) { throw ex; } } /// /// Actualiza el estado del Rol /// public void actualizaEstadoRol() { ArrayList arlCondiciones = new ArrayList(); try { if (objRolEL.PK != 0) { arlCondiciones.Add(this.buscarPorPK(objRolEL.PK, Tablas.rol, operadorLogico.AND)); this.CamposTabla = Concepto.ACTIVO.ToString() + Tablas.rol.ToString(); this.ValoresCampos = new object[]{ objRolEL.Activo }; baseDAL.Actualizar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD, arlCondiciones); } } catch (Exception ex) { throw ex; } } /// /// Lista los roles /// /// public DataSet listarRoles() { ArrayList arlCondiciones = new ArrayList(); if (this.objRolEL.PK != 0) arlCondiciones.Add(buscarPorPK(objRolEL.PK, Tablas.rol, operadorLogico.AND)); if (objRolEL.Padre == 4 || objRolEL.Padre == 9) arlCondiciones.Add(buscarPorPadre(objRolEL.Padre, Tablas.rol, operadorLogico.AND, operadorGeneral.EQUAL)); arlCondiciones.Add(buscarPorActivo(objRolEL.ASTATE, Tablas.rol, operadorLogico.NONE)); DataSet dsRole = baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, arlCondiciones, null, " ORDER BY PKROL ASC "); return dsRole; } #endregion #region Condiciones de Busqueda #endregion } }