140 lines
3.8 KiB
C#
140 lines
3.8 KiB
C#
|
|
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
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Inluye los datos del Rol
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Actualiza el dato del Rol
|
|||
|
|
/// </summary>
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Actualiza el estado del Rol
|
|||
|
|
/// </summary>
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Lista los roles
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
|
|||
|
|
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
|
|||
|
|
}
|
|||
|
|
}
|