// Decompiled with JetBrains decompiler // Type: AyABL.Usuario.UsuarioBL // 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 AyABL.AUT.Autenticacion; using AyADAL; using AyAEL.USR; using System; using System.Collections; using System.Collections.Specialized; using System.Configuration; using System.Data; namespace AyABL.Usuario { public class UsuarioBL : AyABL { private static NameValueCollection appSettings = ConfigurationManager.AppSettings; public UsuarioBL() { this.objUsuarioEL = new UsuarioEL(); this.NombreTabla = Modulos.T_USR_.ToString() + Tablas.USUARIO.ToString(); this.NombreConeccionBD = BASESDEDATOS.ADS.ToString(); this.objUsuarioEL.Aplicacion = Convert.ToInt32(ConfigurationManager.AppSettings["pkApp"]); } public UsuarioEL objUsuarioEL { get; set; } public int insertarUsuario() { this.NombreConeccionBD = BASESDEDATOS.ADS.ToString(); this.NombreTabla = Modulos.T_USR_.ToString() + Tablas.USUARIO.ToString(); int num; try { num = this.ObtenerPKxUsuarioxLogin(); if (num == 0) { this.CamposTabla = t_ads_usuario.LOGIN.ToString() + Tablas.USUARIO.ToString() + ", " + t_ads_usuario.ACTIVO.ToString() + Tablas.USUARIO.ToString() + ", " + Constraints.FK.ToString() + Tablas.EMPLEADO.ToString(); this.ValoresCampos = new object[3] { (object) this.objUsuarioEL.Login, (object) this.objUsuarioEL.Activo, (object) this.objUsuarioEL.Empleado }; num = this.baseDAL.Insertar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD); } this.NombreTabla = Modulos.t_seg_.ToString() + Tablas.usuarioxdependencia.ToString(); this.NombreConeccionBD = BASESDEDATOS.SIGDD.ToString(); this.CamposTabla = t_seg_usuarioxdependencia.USUARIO.ToString() + Tablas.usuarioxdependencia.ToString() + ", " + Constraints.FK.ToString() + Tablas.DEPENDENCIA.ToString() + ", " + (object) t_seg_usuarioxdependencia.TELEFONOCUBICULO + Tablas.usuarioxdependencia.ToString() + ", " + (object) t_seg_usuarioxdependencia.DIRECTOR + Tablas.usuarioxdependencia.ToString() + ", " + (object) t_seg_usuarioxdependencia.JEFATURA + Tablas.usuarioxdependencia.ToString() + ", " + (object) t_seg_usuarioxdependencia.OBSERVACIONES + Tablas.usuarioxdependencia.ToString() + ", " + t_seg_usuarioxdependencia.FKTIPOINSPECCION.ToString() + ", " + Auditoria.ASTATE.ToString() + Tablas.usuarioxdependencia.ToString(); this.ValoresCampos = new object[8] { (object) this.objUsuarioEL.Login, (object) this.objUsuarioEL.FKDEPENDENCIA, (object) this.objUsuarioEL.TELEFONOCUBICULO, (object) this.objUsuarioEL.DIRECTOR, (object) this.objUsuarioEL.JEFATURA, (object) this.objUsuarioEL.OBSERVACIONES, (object) this.objUsuarioEL.FKTIPOINSPECCION, (object) true }; this.baseDAL.Insertar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD); } catch (Exception ex) { throw ex; } return num; } public int activarInactivarUsuario() { this.NombreTabla = Modulos.T_USR_.ToString() + Tablas.USUARIO.ToString(); try { ArrayList p_arlCondiciones = new ArrayList(); p_arlCondiciones.Add((object) this.buscarPorLogin(this.objUsuarioEL.Login, operadorLogico.NONE)); this.CamposTabla = t_ads_usuario.LOGIN.ToString() + Tablas.USUARIO.ToString() + ", " + t_ads_usuario.ACTIVO.ToString() + Tablas.USUARIO.ToString() + ", " + Constraints.FK.ToString() + Tablas.EMPLEADO.ToString(); this.ValoresCampos = new object[3] { (object) this.objUsuarioEL.Login, (object) this.objUsuarioEL.Activo, (object) this.objUsuarioEL.Empleado }; return this.baseDAL.Actualizar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD, p_arlCondiciones); } catch (Exception ex) { throw ex; } } public int moidificarUsuario() { this.NombreTabla = Modulos.T_USR_.ToString() + Tablas.USUARIO.ToString(); int num; try { ArrayList p_arlCondiciones1 = new ArrayList(); p_arlCondiciones1.Add((object) this.buscarPorLogin(this.objUsuarioEL.Login, operadorLogico.NONE)); this.CamposTabla = t_ads_usuario.LOGIN.ToString() + Tablas.USUARIO.ToString() + ", " + t_ads_usuario.ACTIVO.ToString() + Tablas.USUARIO.ToString() + ", " + Constraints.FK.ToString() + Tablas.EMPLEADO.ToString(); this.ValoresCampos = new object[3] { (object) this.objUsuarioEL.Login, (object) this.objUsuarioEL.Activo, (object) this.objUsuarioEL.Empleado }; num = this.baseDAL.Actualizar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD, p_arlCondiciones1); this.NombreTabla = Modulos.t_seg_.ToString() + Tablas.usuarioxdependencia.ToString(); this.NombreConeccionBD = BASESDEDATOS.SIGDD.ToString(); ArrayList p_arlCondiciones2 = new ArrayList(); p_arlCondiciones2.Add((object) this.buscarPorUsuarioAcceso(this.objUsuarioEL.Login, operadorLogico.NONE)); this.CamposTabla = Constraints.FK.ToString() + Tablas.DEPENDENCIA.ToString() + ", " + (object) t_seg_usuarioxdependencia.TELEFONOCUBICULO + Tablas.usuarioxdependencia.ToString() + ", " + (object) t_seg_usuarioxdependencia.DIRECTOR + Tablas.usuarioxdependencia.ToString() + ", " + (object) t_seg_usuarioxdependencia.JEFATURA + Tablas.usuarioxdependencia.ToString() + ", " + (object) t_seg_usuarioxdependencia.OBSERVACIONES + Tablas.usuarioxdependencia.ToString() + ", " + t_seg_usuarioxdependencia.FKTIPOINSPECCION.ToString(); this.ValoresCampos = new object[6] { (object) this.objUsuarioEL.FKDEPENDENCIA, (object) this.objUsuarioEL.TELEFONOCUBICULO, (object) this.objUsuarioEL.DIRECTOR, (object) this.objUsuarioEL.JEFATURA, (object) this.objUsuarioEL.OBSERVACIONES, (object) this.objUsuarioEL.FKTIPOINSPECCION }; this.baseDAL.Actualizar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD, p_arlCondiciones2); } catch (Exception ex) { throw ex; } return num; } public bool VerificarUsuarioxLogin() { bool flag = false; try { DataSet dataSet = new DataSet(); if (this.baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, new ArrayList() { (object) this.buscarPorLogin(this.objUsuarioEL.Login, operadorLogico.NONE) }, (string) null, (string) null).Tables[0].Rows.Count > 0) flag = true; } catch (Exception ex) { throw ex; } return flag; } public int ObtenerPKxUsuarioxLogin() { int num = 0; try { DataSet dataSet1 = new DataSet(); DataSet dataSet2 = this.baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, new ArrayList() { (object) this.buscarPorLogin(this.objUsuarioEL.Login, operadorLogico.NONE) }, (string) null, (string) null); if (dataSet2.Tables[0].Rows.Count > 0) num = int.Parse(dataSet2.Tables[0].Rows[0]["PKUSUARIO"].ToString()); } catch (Exception ex) { throw ex; } return num; } public DataSet listarUsuarios( ArrayList arlCondicionesFiltroBusqueda, bool buscarPorASTATE, string p_strPrefijoDependencia) { try { ArrayList arrayList = new ArrayList(); this.cargarCondicionBusqueda(arrayList, arlCondicionesFiltroBusqueda); this.NombreTabla = Vistas.v_obtenerdatosusuario.ToString(); int? pk = this.objUsuarioEL.PK; if ((pk.GetValueOrDefault() != 0 ? 1 : (!pk.HasValue ? 1 : 0)) != 0) arrayList.Add((object) this.buscarPorPK(this.objUsuarioEL.PK, Tablas.USUARIO, operadorLogico.AND)); if (p_strPrefijoDependencia != null) arrayList.Add((object) this.buscarPorPrefijo(p_strPrefijoDependencia, Tablas.DEPENDENCIA, operadorLogico.AND, operadorGeneral.LIKE)); if (buscarPorASTATE) arrayList.Add((object) this.buscarPorEstado(this.objUsuarioEL.ASTATE, Tablas.USUARIO, operadorLogico.NONE)); return this.baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, arrayList, (string) null, "ORDER BY NOMBRECOMPLETOPERSONAL DESC"); } catch (Exception ex) { throw ex; } } public int obtenerPKPersonal() { try { int num = 0; ArrayList p_arlCondiciones = new ArrayList(); this.CamposTabla = Constraints.FK.ToString() + Tablas.PERSONAL.ToString(); int? pk = this.objUsuarioEL.PK; if ((pk.GetValueOrDefault() != 0 ? 1 : (!pk.HasValue ? 1 : 0)) != 0) { p_arlCondiciones.Add((object) this.buscarPorPK(this.objUsuarioEL.PK, Tablas.USUARIO, operadorLogico.NONE)); DataSet dataSet = this.baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, p_arlCondiciones, (string) null, (string) null); if (dataSet.Tables[0].Rows.Count > 0) num = Convert.ToInt32(dataSet.Tables[0].Rows[0]["FKPERSONAL"]); } return num; } catch (Exception ex) { throw ex; } } public DataSet loginUsuario(string p_strLogin, bool p_blnASTATE) { try { this.objUsuarioEL.Login = p_strLogin; this.objUsuarioEL.ASTATE = p_blnASTATE; this.NombreTabla = Vistas.v_validausuario.ToString(); return this.baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, new ArrayList() { (object) this.buscarPorLogin(this.objUsuarioEL.Login, operadorLogico.AND) }, (string) null, (string) null); } catch (Exception ex) { throw ex; } } public bool validarActiveDirectory(string p_strLogin, string p_strContrasena) { AutenticacionBL autenticacionBl = new AutenticacionBL(); string domain1 = ConfigurationManager.AppSettings["ActiveDirectory"].ToString(); bool flag; try { if (autenticacionBl.Autenticar(p_strLogin, p_strContrasena, domain1)) { flag = true; } else { string domain2 = ConfigurationManager.AppSettings["ActiveDirectory2"].ToString(); flag = autenticacionBl.Autenticar(p_strLogin, p_strContrasena, domain2); } } catch (Exception ex) { throw ex; } return flag; } public DataSet dsLogueo(UsuarioEL p_objUsuarioEL) { DataSet dataSet = new DataSet(); ArrayList p_arlCondiciones = new ArrayList(); this.NombreTabla = Vistas.v_validausuario.ToString(); int? pk = this.objUsuarioEL.PK; if ((pk.GetValueOrDefault() != 0 ? 1 : (!pk.HasValue ? 1 : 0)) != 0) p_arlCondiciones.Add((object) this.buscarPorLogin(this.objUsuarioEL.Login, operadorLogico.AND)); p_arlCondiciones.Add((object) this.buscarPorAplicacion(int.Parse(ConfigurationManager.AppSettings["pkApp"].ToString()), operadorLogico.NONE)); return this.baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, p_arlCondiciones, (string) null, (string) null); } private CondicionDAL buscarPorLogin(string p_strLogin, operadorLogico operador) { return new CondicionDAL() { valorIzquierdo = t_ads_usuario.LOGIN.ToString() + Tablas.USUARIO.ToString(), operadorGeneral = operadorGeneral.EQUAL, operadorLogico = operador, valorDerecho = (object) p_strLogin }; } private CondicionDAL buscarPorAplicacion( int p_intAplicacion, operadorLogico operador) { return new CondicionDAL() { valorIzquierdo = Constraints.PK.ToString() + Tablas.APLICACION.ToString(), operadorGeneral = operadorGeneral.EQUAL, operadorLogico = operador, valorDerecho = (object) p_intAplicacion }; } private CondicionDAL buscarPorUsuarioAcceso( string p_strLogin, operadorLogico operador) { return new CondicionDAL() { valorIzquierdo = t_seg_usuarioxdependencia.USUARIO.ToString() + Tablas.usuarioxdependencia.ToString(), operadorGeneral = operadorGeneral.EQUAL, operadorLogico = operador, valorDerecho = (object) p_strLogin }; } private CondicionDAL buscarPorUsuario(string p_strUsuario, operadorLogico operador) { return new CondicionDAL() { valorIzquierdo = t_seg_usuarioxdependencia.USUARIO.ToString() + Tablas.usuarioxdependencia.ToString(), operadorGeneral = operadorGeneral.EQUAL, operadorLogico = operador, valorDerecho = (object) p_strUsuario }; } private CondicionDAL buscarPorTipoInspeccion( int nTipoInspector, operadorLogico operador) { return new CondicionDAL() { valorIzquierdo = t_seg_usuarioxdependencia.FKTIPOINSPECCION.ToString() + Tablas.usuarioxdependencia.ToString(), operadorGeneral = operadorGeneral.EQUAL, operadorLogico = operador, valorDerecho = (object) nTipoInspector }; } public CondicionDAL buscarEnStarH( string p_strValor, operadorLogico operador, string p_valorConsulta) { CondicionDAL condicionDal = new CondicionDAL(); switch (p_valorConsulta) { case "CEDULA": condicionDal.valorIzquierdo = t_aop_personal.CEDULA.ToString(); condicionDal.operadorGeneral = operadorGeneral.LIKE; condicionDal.operadorLogico = operador; condicionDal.valorDerecho = (object) ("%" + p_strValor + "%"); break; case "NO_EMPLEADO": condicionDal = new CondicionDAL(); condicionDal.valorIzquierdo = t_aop_personal.NO_EMPLEADO.ToString(); condicionDal.operadorGeneral = operadorGeneral.LIKE; condicionDal.operadorLogico = operador; condicionDal.valorDerecho = (object) ("%" + p_strValor + "%"); break; case "NOMBRE": condicionDal = new CondicionDAL(); condicionDal.valorIzquierdo = t_aop_personal.NBR_EMPLEADO.ToString() + " + ' ' + " + t_aop_personal.APE_1.ToString() + " + ' ' + " + t_aop_personal.APE_2.ToString(); condicionDal.operadorGeneral = operadorGeneral.LIKE; condicionDal.operadorLogico = operador; condicionDal.valorDerecho = (object) ("%" + p_strValor + "%"); break; case "CORREO": condicionDal = new CondicionDAL(); condicionDal.valorIzquierdo = t_aop_personal.CORREO_E.ToString(); condicionDal.operadorGeneral = operadorGeneral.LIKE; condicionDal.operadorLogico = operador; condicionDal.valorDerecho = (object) ("%" + p_strValor + "%"); break; } return condicionDal; } public DataSet dsListaUsuariosStarH(ArrayList arlCondicionesFiltroBusqueda) { try { ArrayList arrayList = new ArrayList(); this.cargarCondicionBusqueda(arrayList, arlCondicionesFiltroBusqueda); this.NombreTabla = Vistas.v_personal.ToString(); if (this.objUsuarioEL.USUARIO != "" && this.objUsuarioEL.USUARIO != null) { arrayList.Add((object) this.buscarEnStarH(this.objUsuarioEL.USUARIO, operadorLogico.OR, "CEDULA")); arrayList.Add((object) this.buscarEnStarH(this.objUsuarioEL.USUARIO, operadorLogico.OR, "NO_EMPLEADO")); arrayList.Add((object) this.buscarEnStarH(this.objUsuarioEL.USUARIO, operadorLogico.OR, "NOMBRE")); arrayList.Add((object) this.buscarEnStarH(this.objUsuarioEL.USUARIO, operadorLogico.NONE, "CORREO")); } return this.baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, arrayList, (string) null, (string) null); } catch (Exception ex) { throw ex; } } public string strUsuario(UsuarioEL usuarioEL, string p) { throw new NotImplementedException(); } public DataSet dsListaUsuarios(ArrayList arlCondicionesFiltroBusqueda) { try { ArrayList arrayList = new ArrayList(); this.cargarCondicionBusqueda(arrayList, arlCondicionesFiltroBusqueda); this.NombreTabla = Vistas.v_validausuario.ToString(); this.NombreConeccionBD = BASESDEDATOS.ADS.ToString(); int? pk = this.objUsuarioEL.PK; if ((pk.GetValueOrDefault() != 0 ? 1 : (!pk.HasValue ? 1 : 0)) != 0 && this.objUsuarioEL.PK.HasValue) arrayList.Add((object) this.buscarPorPK(this.objUsuarioEL.PK, Tablas.USUARIO, operadorLogico.AND)); arrayList.Add((object) this.buscarPorAplicacion(int.Parse(ConfigurationManager.AppSettings["pkApp"].ToString()), operadorLogico.NONE)); return this.baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, arrayList, (string) null, (string) null); } catch (Exception ex) { throw ex; } } public DataSet dsPersonal() { try { ArrayList p_arlCondiciones = new ArrayList(); this.NombreTabla = Vistas.v_personal.ToString(); this.NombreConeccionBD = BASESDEDATOS.ADS.ToString(); if (this.objUsuarioEL.Empleado != null) p_arlCondiciones.Add((object) this.buscarPorFKEmpleado(this.objUsuarioEL.Empleado, Tablas.EMPLEADO, operadorLogico.NONE)); return this.baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, p_arlCondiciones, (string) null, (string) null); } catch (Exception ex) { throw ex; } } public DataSet dsListaGradoAcademico(ArrayList arlCondicionesFiltroBusqueda) { try { ArrayList arrayList = new ArrayList(); this.cargarCondicionBusqueda(arrayList, arlCondicionesFiltroBusqueda); this.NombreTabla = Modulos.t_adm_.ToString() + Tablas.gradoacademico.ToString(); this.NombreConeccionBD = BASESDEDATOS.SIGDD.ToString(); return this.baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, arrayList, (string) null, (string) null); } catch (Exception ex) { throw ex; } } public DataSet dsListaTipoInspeccion(ArrayList arlCondicionesFiltroBusqueda) { try { ArrayList arrayList = new ArrayList(); this.cargarCondicionBusqueda(arrayList, arlCondicionesFiltroBusqueda); this.NombreTabla = Modulos.t_adm_.ToString() + Tablas.tipoinspeccion.ToString(); this.NombreConeccionBD = BASESDEDATOS.SIGDD.ToString(); return this.baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, arrayList, (string) null, (string) null); } catch (Exception ex) { throw ex; } } public DataSet dsListaTipoDisponibilidad(ArrayList arlCondicionesFiltroBusqueda) { try { ArrayList arrayList = new ArrayList(); this.cargarCondicionBusqueda(arrayList, arlCondicionesFiltroBusqueda); this.NombreTabla = Vistas.v_tipodisponibilidad.ToString(); this.NombreConeccionBD = BASESDEDATOS.SIGDD.ToString(); return this.baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, arrayList, (string) null, (string) null); } catch (Exception ex) { throw ex; } } public DataSet dsValidarUsuario(UsuarioEL usuarioEL) { try { this.NombreTabla = Vistas.v_validausuario.ToString(); ArrayList p_arlCondiciones = new ArrayList(); p_arlCondiciones.Add((object) this.buscarPorPK(usuarioEL.PK, Tablas.USUARIO, operadorLogico.AND)); p_arlCondiciones.Add((object) this.buscarPorActivo(usuarioEL.Activo, Tablas.usuario, operadorLogico.AND)); int? pk = usuarioEL.PK; if ((pk.GetValueOrDefault() != 0 ? 1 : (!pk.HasValue ? 1 : 0)) != 0) p_arlCondiciones.Add((object) this.buscarPorRole(usuarioEL.Aplicacion, operadorLogico.NONE)); return this.baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, p_arlCondiciones, (string) null, (string) null); } catch (Exception ex) { throw ex; } } public DataSet dsAccesoUsuario(UsuarioEL usuarioEL) { try { this.NombreTabla = Vistas.v_ObtenerUsuarioAcceso.ToString(); this.NombreConeccionBD = BASESDEDATOS.SIGDD.ToString(); return this.baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, new ArrayList() { (object) this.buscarPorUsuario(usuarioEL.USUARIO, operadorLogico.AND) }, (string) null, (string) null); } catch (Exception ex) { throw ex; } } public DataSet dsUsuarioInspector(UsuarioEL usuarioEL) { try { this.NombreTabla = Vistas.v_ObtenerUsuarioAcceso.ToString(); this.NombreConeccionBD = BASESDEDATOS.SIGDD.ToString(); ArrayList p_arlCondiciones = new ArrayList(); if (usuarioEL.FKTIPOINSPECCION != 3) p_arlCondiciones.Add((object) this.buscarPorTipoInspeccion(usuarioEL.FKTIPOINSPECCION, operadorLogico.AND)); return this.baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, p_arlCondiciones, (string) null, (string) null); } catch (Exception ex) { throw ex; } } protected CondicionDAL buscarPorFKEmpleado( string p_strFK, Tablas p_nombreTabla, operadorLogico logOp) { return new CondicionDAL() { valorIzquierdo = "CEDULA", operadorGeneral = operadorGeneral.EQUAL, operadorLogico = logOp, valorDerecho = (object) p_strFK }; } } }