示例#1
0
        /// <summary>
        /// ExecuteSelect
        /// </summary>
        /// <param name="pInformacaoTransacao"></param>
        /// <param name="pSqlConnection"></param>
        /// <returns></returns>
        internal ResultadoTransacao ExecuteSelect(InformacaoTransacao pInformacaoTransacao, SqlConnection pSqlConnection)
        {
            ResultadoTransacao resultadoTransacao = new ResultadoTransacao("Select");
            SqlCommand         sqlCommand         = pInformacaoTransacao.ObterSqlCommand();

            this.sqlDataAdapter = new SqlDataAdapter(sqlCommand);
            DataSet dataSet = new DataSet();

            sqlCommand.Connection             = pSqlConnection;
            sqlCommand.CommandTimeout         = 3000;
            this.sqlDataAdapter.SelectCommand = sqlCommand;

            resultadoTransacao.MarcarRegistrosAfetados(this.sqlDataAdapter.Fill(dataSet));
            resultadoTransacao.MarcarDataSet(dataSet);
            resultadoTransacao.MarcarParametrosSaida(pInformacaoTransacao.ObterParametrosSaida(this.sqlDataAdapter.SelectCommand));

            return(resultadoTransacao);
        }
示例#2
0
        /// <summary>
        /// ExecuteProcedure
        /// </summary>
        /// <param name="pInformacaoTransacao"></param>
        /// <param name="pSqlConnection"></param>
        /// <returns></returns>
        internal ResultadoTransacao ExecuteProcedure(InformacaoTransacao pInformacaoTransacao, SqlConnection pSqlConnection, SqlTransaction pSqlTransaction)
        {
            ResultadoTransacao resultadoTransacao = new ResultadoTransacao("Procedure");
            SqlCommand         sqlCommand         = pInformacaoTransacao.ObterSqlCommand();

            sqlCommand.Transaction = pSqlTransaction;
            this.sqlDataAdapter    = new SqlDataAdapter(sqlCommand);
            DataSet dataSet = new DataSet();

            sqlCommand.Connection     = pSqlConnection;
            sqlCommand.CommandTimeout = 3000;
            //
            int registrosAfetados = sqlCommand.ExecuteNonQuery();

            //
            resultadoTransacao.MarcarRegistrosAfetados(registrosAfetados);
            resultadoTransacao.MarcarParametrosSaida(pInformacaoTransacao.ObterParametrosSaida(sqlCommand));
            //
            return(resultadoTransacao);
        }