Beispiel #1
0
        public override object ExecuteScalar(ref DAABRequest Request)
        {
            string connectionString = Request.ConnectionString;

            if ((connectionString == null || connectionString.Length == 0))
            {
                throw new ArgumentNullException("connectionString");
            }
            if ((Request.Command == null || Request.Command.Length == 0))
            {
                throw new ArgumentNullException("No ha ingresado el commando a ejecutar.");
            }
            try
            {
                ArrayList lista = Request.Parameters;
                estableceConexion(Request.Transactional, connectionString);
                SqlParameter[] aparam = DevuelveParametros(Request.CommandType, ref lista);
                if (Request.Transactional)
                {
                    return(ExecuteScalares(m_TranSQL, Request.CommandType, Request.Command, aparam));
                }
                else
                {
                    return(ExecuteScalares(m_conecSQL, Request.CommandType, Request.Command, aparam));
                }
            }
            finally
            {
                if (!(Request.Transactional) & !(m_conecSQL == null))
                {
                    m_conecSQL.Dispose();
                }
            }
        }
        public override void FillDataset(ref DAABRequest Request)
        {
            string connectionString = Request.ConnectionString;

            if ((connectionString == null || connectionString.Length == 0))
            {
                throw new ArgumentNullException("connectionString");
            }
            if ((Request.Command == null || Request.Command.Length == 0))
            {
                throw new ArgumentNullException("No ha ingresado el commando a ejecutar.");
            }
            if ((Request.RequestDataSet == null))
            {
                throw new ArgumentNullException("RequestDataSet");
            }
            try
            {
                ArrayList lista = Request.Parameters;
                estableceConexion(Request.Transactional, connectionString);
                OracleParameter[] aparam = ConvertToOracleParameter(Request.CommandType, lista);
                if (Request.Transactional)
                {
                    FillDatasets(m_conecSQL, m_TranSQL, Request.CommandType, Request.Command, Request.RequestDataSet, Request.TableNames, aparam);
                }
                else
                {
                    FillDatasets(m_conecSQL, ((OracleTransaction)(null)), Request.CommandType, Request.Command, Request.RequestDataSet, Request.TableNames, aparam);
                }
                AsingValueParameter(aparam, ref lista);
            }
            catch (Exception ex1)
            {
                Request.Exception = ex1;
                throw ex1;
            }
            finally
            {
                if (!(Request.Transactional) & !(m_conecSQL == null))
                {
                    m_conecSQL.Dispose();
                }
            }
        }
Beispiel #3
0
        public override DAABDataReader ExecuteReader(ref DAABRequest Request)
        {
            DAABSQLDataReader oDataReaderSQL;

            string connectionString = Request.ConnectionString;

            if ((connectionString == null || connectionString.Length == 0))
            {
                throw new ArgumentNullException("connectionString");
            }
            try
            {
                ArrayList      lista  = Request.Parameters;
                SqlParameter[] aparam = DevuelveParametros(Request.CommandType, ref lista);
                estableceConexion(false, connectionString);
                SqlDataReader drSQL;

                drSQL          = ExecuteReaders(m_conecSQL, ((SqlTransaction)(null)), Request.CommandType, Request.Command, aparam);
                oDataReaderSQL = new DAABSQLDataReader();
                oDataReaderSQL.ReturnDataReader = drSQL;
                return(oDataReaderSQL);
            }
            catch (SqlException ex1)
            {
                if (!(m_conecSQL == null))
                {
                    m_conecSQL.Dispose();
                }
                Request.Exception = ex1;
                throw ex1;
                //return null;
            }
            catch (Exception ex1)
            {
                Request.Exception = ex1;
                if (!(m_conecSQL == null))
                {
                    m_conecSQL.Dispose();
                }
                throw;
                //return null;
            }
        }
        public override object ExecuteScalar(ref DAABRequest Request)
        {
            string connectionString = Request.ConnectionString;
            Object objObject        = new Object();

            if ((connectionString == null || connectionString.Length == 0))
            {
                throw new ArgumentNullException("connectionString");
            }
            if ((Request.Command == null || Request.Command.Length == 0))
            {
                throw new ArgumentNullException("No ha ingresado el commando a ejecutar.");
            }
            try
            {
                ArrayList lista = Request.Parameters;
                estableceConexion(Request.Transactional, connectionString);
                OracleParameter[] aparam = ConvertToOracleParameter(Request.CommandType, lista);
                if (Request.Transactional)
                {
                    objObject = ExecuteScalares(m_TranSQL, Request.CommandType, Request.Command, aparam);
                }
                else
                {
                    objObject = ExecuteScalares(m_conecSQL, Request.CommandType, Request.Command, aparam);
                }
                AsingValueParameter(aparam, ref lista);
            }
            catch (Exception ex)
            {
                Request.Exception = ex;
                throw ex;
            }
            finally
            {
                if (!(Request.Transactional) & !(m_conecSQL == null))
                {
                    m_conecSQL.Dispose();
                }
            }
            return(objObject);
        }
        public override DataSet ExecuteDataset(ref DAABRequest request)
        {
            string  connectionString = request.ConnectionString;
            DataSet objDataSet       = new DataSet();

            if ((connectionString == null || connectionString.Length == 0))
            {
                throw new ArgumentNullException("connectionString");
            }
            if ((request.Command == null || request.Command.Length == 0))
            {
                throw new ArgumentNullException("No ha ingresado el commando a ejecutar.");
            }
            try
            {
                ArrayList lista = request.Parameters;
                estableceConexion(request.Transactional, connectionString);
                OracleParameter[] aparam = ConvertToOracleParameter(request.CommandType, lista);
                if (request.Transactional)
                {
                    objDataSet = ExecuteDatasets(m_TranSQL, request.CommandType, request.Command, aparam, request.TableNames);
                }
                else
                {
                    objDataSet = ExecuteDatasets(m_conecSQL, request.CommandType, request.Command, aparam, request.TableNames);
                }
                AsingValueParameter(aparam, ref lista);
            }
            catch (Exception ex)
            {
                request.Exception = ex;
                throw ex;
            }
            finally
            {
                if (!(request.Transactional) & !(m_conecSQL == null))
                {
                    m_conecSQL.Dispose();
                }
            }
            return(objDataSet);
        }
        public override DAABDataReader ExecuteReader(ref DAABRequest Request)
        {
            DAABOracleDataReader oDataReaderSQL;
            string connectionString = Request.ConnectionString;

            if ((connectionString == null || connectionString.Length == 0))
            {
                throw new ArgumentNullException("connectionString");
            }
            try
            {
                ArrayList         lista  = Request.Parameters;
                OracleParameter[] aparam = ConvertToOracleParameter(Request.CommandType, lista);
                estableceConexion(false, connectionString);
                OracleDataReader drSQL;
                drSQL          = ExecuteReaders(m_conecSQL, ((OracleTransaction)(null)), Request.CommandType, Request.Command, aparam);
                oDataReaderSQL = new DAABOracleDataReader();
                oDataReaderSQL.ReturnDataReader = drSQL;
                AsingValueParameter(aparam, ref lista);
                return(oDataReaderSQL);
            }
            catch (OracleException ex1)
            {
                if (!(m_conecSQL == null))
                {
                    m_conecSQL.Dispose();
                }
                Request.Exception = ex1;
                throw ex1;
            }
            catch (Exception ex1)
            {
                Request.Exception = ex1;
                if (!(m_conecSQL == null))
                {
                    m_conecSQL.Dispose();
                }
                throw;
            }
        }
        public override int ExecuteNonQuery(ref DAABRequest Request)
        {
            string connectionString = Request.ConnectionString;

            if ((connectionString == null || connectionString.Length == 0))
            {
                throw new ArgumentNullException("connectionString");
            }
            if ((Request.Command == null || Request.Command.Length == 0))
            {
                throw new ArgumentNullException("No ha ingresado el commando a ejecutar.");
            }
            try
            {
                ArrayList         lista  = Request.Parameters;
                OracleParameter[] aparam = ConvertToOracleParameter(Request.CommandType, lista);
                estableceConexion(Request.Transactional, connectionString);
                int iretval;
                if (Request.Transactional)
                {
                    iretval = ExecuteNonQuerys(m_TranSQL, Request.CommandType, Request.Command, aparam);
                }
                else
                {
                    iretval = ExecuteNonQuerys(m_conecSQL, Request.CommandType, Request.Command, aparam);
                }
                AsingValueParameter(aparam, ref lista);
                return(iretval);
            }
            finally
            {
                if (!(Request.Transactional) & !(m_conecSQL == null))
                {
                    m_conecSQL.Dispose();
                }
            }
        }
 public abstract DataSet ExecuteDataset(ref DAABRequest Request);
 public abstract int ExecuteNonQuery(ref DAABRequest Request);
 public abstract object ExecuteScalar(ref DAABRequest Request);
 public abstract DAABDataReader ExecuteReader(ref DAABRequest Repuest);
 public abstract void UpdateDataSet(ref DAABRequest RequestInsert, ref DAABRequest RequestUpdate, ref DAABRequest RequestDelete);
 public abstract void FillDataset(ref DAABRequest Request);
Beispiel #14
0
        public override void UpdateDataSet(ref DAABRequest RequestInsert, ref DAABRequest RequestUpdate, ref DAABRequest RequestDelete)
        {
            string     connectionString = RequestInsert.ConnectionString;
            SqlCommand cmdCommandInsert;
            SqlCommand cmdCommandUpdate;
            SqlCommand cmdCommandDelete;

            if ((connectionString == null || connectionString.Length == 0))
            {
                throw new ArgumentNullException("connectionString");
            }
            if ((RequestInsert.Command == null || RequestInsert.Command.Length == 0))
            {
                throw new ArgumentNullException("No ha ingresado el commando a ejecutar.RequestInsert");
            }
            if ((RequestUpdate.Command == null || RequestUpdate.Command.Length == 0))
            {
                throw new ArgumentNullException("No ha ingresado el commando a ejecutar.RequestUpdate");
            }
            if ((RequestDelete.Command == null || RequestDelete.Command.Length == 0))
            {
                throw new ArgumentNullException("No ha ingresado el commando a ejecutar.RequestDelete");
            }
            if ((RequestInsert.RequestDataSet == null))
            {
                throw new ArgumentNullException("RequestDataSet:RequestInsert");
            }
            if (RequestInsert.TableNames == null)
            {
                throw new ArgumentNullException("Falta especificar el nombre de la tabla a actualizar");
            }
            try
            {
                bool      cerrarCn = false;
                ArrayList lista    = RequestInsert.Parameters;
                estableceConexion(RequestInsert.Transactional, connectionString);
                cmdCommandInsert = new SqlCommand();
                SqlParameter[] aparamInsert = DevuelveParametros(RequestInsert.CommandType, ref lista);
                PrepareCommand(cmdCommandInsert, m_conecSQL, m_TranSQL, RequestInsert.CommandType, RequestInsert.Command, aparamInsert, ref cerrarCn);
                cmdCommandUpdate = new SqlCommand();
                SqlParameter[] aparamUpdate = DevuelveParametros(RequestUpdate.CommandType, ref lista);
                PrepareCommand(cmdCommandUpdate, m_conecSQL, m_TranSQL, RequestUpdate.CommandType, RequestUpdate.Command, aparamUpdate, ref cerrarCn);
                cmdCommandDelete = new SqlCommand();
                SqlParameter[] aparamDelete = DevuelveParametros(RequestDelete.CommandType, ref lista);
                PrepareCommand(cmdCommandDelete, m_conecSQL, m_TranSQL, RequestDelete.CommandType, RequestDelete.Command, aparamDelete, ref cerrarCn);
                UpdateDatasets(cmdCommandInsert, cmdCommandDelete, cmdCommandUpdate, RequestInsert.RequestDataSet, RequestInsert.TableNames[0]);
            }
            catch (Exception ex1)
            {
                RequestInsert.Exception = ex1;
                RequestDelete.Exception = ex1;
                RequestUpdate.Exception = ex1;
                throw ex1;
            }
            finally
            {
                if (!(RequestInsert.Transactional) & !(m_conecSQL == null))
                {
                    m_conecSQL.Dispose();
                }
            }
        }