TFS_ANTIGUO/SIGPC/AyABL/Usuario/UsuarioRolBL.cs
kledezma 7fdadc4709 KLB
git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C519
2021-01-22 15:05:35 +00:00

130 lines
4.8 KiB
C#

// Decompiled with JetBrains decompiler
// Type: AyABL.Usuario.UsuarioRolBL
// Assembly: AyABL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 0F2FF6EC-B53C-44DB-9E00-2F932BF80762
// Assembly location: C:\Users\EQUIPO\Downloads\Raiz\Raiz\bin\AyABL.dll
using AyADAL;
using AyAEL.USR;
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.Common;
namespace AyABL.Usuario
{
public class UsuarioRolBL : AyABL
{
private DbProviderFactory dpfConector = DbProviderFactories.GetFactory("System.Data.SqlClient");
private DbParameter[] dbpParametros;
public UsuarioRolBL()
{
this.objUsuarioRolEL = new UsuarioRolEL();
this.NombreTabla = Modulos.T_USR_.ToString() + Tablas.USUARIO.ToString();
this.NombreConeccionBD = BASESDEDATOS.ADS.ToString();
this.objUsuarioRolEL.Aplicacion = Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"]);
}
public UsuarioRolEL objUsuarioRolEL { get; set; }
public int insertarUsuarioRol()
{
this.NombreTabla = Modulos.T_USR_.ToString() + Tablas.USUARIOROL.ToString();
try
{
this.CamposTabla = t_ads_usauriorol.FKROL.ToString() + ", " + t_ads_usauriorol.FKUSUARIO.ToString();
this.ValoresCampos = new object[2]
{
(object) this.objUsuarioRolEL.Rol,
(object) this.objUsuarioRolEL.Usuario
};
return this.baseDAL.Insertar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD);
}
catch (Exception ex)
{
throw ex;
}
}
public int actualizarUsuarioRol(UsuarioRolEL p_objUsuarioRolEL)
{
ArrayList p_arlCondiciones = new ArrayList();
this.NombreTabla = Modulos.T_USR_.ToString() + Tablas.USUARIOROL.ToString();
try
{
p_arlCondiciones.Add((object) this.buscarPorPK(this.objUsuarioRolEL.PK, Tablas.USUARIOROL, operadorLogico.AND));
this.CamposTabla = t_ads_usauriorol.FKROL.ToString() + ", " + t_ads_usauriorol.FKUSUARIO.ToString();
this.ValoresCampos = new object[2]
{
(object) this.objUsuarioRolEL.Rol,
(object) this.objUsuarioRolEL.Usuario
};
this.baseDAL.Actualizar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD, p_arlCondiciones);
return 1;
}
catch (Exception ex)
{
throw ex;
}
}
public DataSet listarRolesxAplicacion()
{
try
{
this.NombreTabla = Vistas.v_rolxaplicacion.ToString();
ArrayList p_arlCondiciones = new ArrayList();
if (this.objUsuarioRolEL.Usuario != 0)
p_arlCondiciones.Add((object) this.buscarPorPK(new int?(this.objUsuarioRolEL.Usuario), Tablas.USUARIO, operadorLogico.AND));
if (this.objUsuarioRolEL.Rol != 0)
p_arlCondiciones.Add((object) this.buscarPorPK(new int?(this.objUsuarioRolEL.Rol), Tablas.ROL, operadorLogico.AND));
if (this.objUsuarioRolEL.Aplicacion != 0)
p_arlCondiciones.Add((object) this.buscarPorPK(new int?(this.objUsuarioRolEL.Aplicacion), Tablas.APLICACION, operadorLogico.AND));
return this.baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, p_arlCondiciones, (string) null, FuncionesBLAggDAL.OrderByASC(Constraints.PK.ToString() + Tablas.ROL.ToString()));
}
catch (Exception ex)
{
throw ex;
}
}
public bool usuariosAsociados()
{
bool flag = false;
this.NombreTabla = Modulos.T_USR_.ToString() + Tablas.USUARIOROL.ToString();
try
{
if (this.baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, new ArrayList()
{
(object) this.buscarPorFK(this.objUsuarioRolEL.Rol, Tablas.ROL, operadorLogico.NONE)
}, (string) null, (string) null).Tables[0].Rows.Count > 0)
flag = true;
}
catch (Exception ex)
{
throw;
}
return flag;
}
public void eliminarUsuarioRol()
{
this.NombreTabla = Modulos.T_USR_.ToString() + Tablas.USUARIOROL.ToString();
ArrayList p_arlCondiciones = new ArrayList();
try
{
if (this.objUsuarioRolEL.Usuario != 0)
p_arlCondiciones.Add((object) this.buscarPorFK(this.objUsuarioRolEL.Usuario, Tablas.USUARIO, operadorLogico.AND));
if (this.objUsuarioRolEL.Rol != 0)
p_arlCondiciones.Add((object) this.buscarPorFK(this.objUsuarioRolEL.Rol, Tablas.ROL, operadorLogico.NONE));
this.baseDAL.eliminarFisico(this.NombreTabla, this.NombreConeccionBD, p_arlCondiciones);
}
catch (Exception ex)
{
throw ex;
}
}
}
}