Beispiel #1
0
 protected void DisposeCommand(OracleCommand cmd)
 {
     _conexion.DisposeCommand(cmd);
 }
Beispiel #2
0
        private void AsegurarDatosInicioSesion()
        {
            OracleCommand cmd = _conexion.CrearCommand();

            cmd.CommandText = "INICIOSESSION.InformacionSession";
            cmd.CommandType = CommandType.StoredProcedure;

            OracleParameter p_refcursorAgente       = new OracleParameter();
            OracleParameter p_refcursorRol          = new OracleParameter();
            OracleParameter p_refcursorDatosUsuario = new OracleParameter();
            OracleParameter p_refcursorSession      = new OracleParameter();
            OracleParameter p_refcursorRolEmpresa   = new OracleParameter();

            p_refcursorAgente.OracleDbType       = OracleDbType.RefCursor;
            p_refcursorRol.OracleDbType          = OracleDbType.RefCursor;
            p_refcursorDatosUsuario.OracleDbType = OracleDbType.RefCursor;
            p_refcursorSession.OracleDbType      = OracleDbType.RefCursor;
            p_refcursorRolEmpresa.OracleDbType   = OracleDbType.RefCursor;

            p_refcursorAgente.Direction       = ParameterDirection.Output;
            p_refcursorRol.Direction          = ParameterDirection.Output;
            p_refcursorDatosUsuario.Direction = ParameterDirection.Output;
            p_refcursorSession.Direction      = ParameterDirection.Output;
            p_refcursorRolEmpresa.Direction   = ParameterDirection.Output;

            cmd.Parameters.Add(p_refcursorAgente);
            cmd.Parameters.Add(p_refcursorRol);
            cmd.Parameters.Add(p_refcursorDatosUsuario);
            cmd.Parameters.Add(p_refcursorSession);
            cmd.Parameters.Add(p_refcursorRolEmpresa);

            PistaMgr.Instance.Debug("Sesion", "Previo Sesion");
            PistaMgr.Instance.Debug("Sesion", "Iniciando Sesion");

            DataSet           ds = new DataSet();
            OracleDataAdapter da = null;

            try
            {
                PistaMgr.Instance.Debug("Sesion", "Iniciando TRY");

                da = new OracleDataAdapter(cmd);
                da.Fill(ds);
                PistaMgr.Instance.Debug("Sesion", "Fin TRY");
            }
            catch (Exception excep)
            {
                PistaMgr.Instance.Error("Sesion", excep);
            }
            foreach (DataTable tabla in ds.Tables)
            {
                PistaMgr.Instance.Debug("Sesion", string.Format("TABLA: {0} REGISTROS:{1}", tabla.TableName, tabla.Rows.Count));
            }
            _empresaActual = new Persona(ds.Tables[0].Rows[0]);
            _rolesActuales = readRoles(ds.Tables[1]);
            _usuarioActual = new Usuario(ds.Tables[2].Rows[0]);
            _rolSIN        = ObjetoDeNegocio.GetValor <string>(ds.Tables[4].Rows[0]["NOM_ROL"]);
            ReadValuesSession(ds.Tables[3]);

            _conexion.DisposeCommand(cmd);
            if (da != null)
            {
                da.Dispose();
            }

            _idSesion = GetIdSesionBD();
            PistaMgr.Instance.Debug("Sesion", "Sesion Iniciada IdSesion = " + _idSesion);
        }