public DbParameterCollection ExecuteByStoredProcedureNonQuery(string nameStore, IEnumerable <DbParameter> parameters = null, enuTypeDataBase typeDataBase = enuTypeDataBase.OracleCanalP, enuTypeExecute typeExecute = enuTypeExecute.ExecuteNonQuery ) { DbConnection DataConnection = ConnectionGet(typeDataBase); DbCommand cmdCommand = DataConnection.CreateCommand(); cmdCommand.CommandText = nameStore; cmdCommand.CommandType = CommandType.StoredProcedure; if (parameters != null) { foreach (DbParameter parameter in parameters) { cmdCommand.Parameters.Add(parameter); } } DataConnection.Open(); DbParameterCollection myReader = null; if (typeExecute == enuTypeExecute.ExecuteNonQuery) { cmdCommand.ExecuteNonQuery(); myReader = cmdCommand.Parameters; cmdCommand.Connection.Close(); } return(myReader); }
public DbConnection ConnectionGet(enuTypeDataBase typeDataBase = enuTypeDataBase.SqlServer) { DbConnection DataConnection = null; switch (typeDataBase) { //case enuTypeDataBase.OracleCanalP: // DataConnection = DataConnectionOracle; // break; //case enuTypeDataBase.OracleVTime: // DataConnection = DataConnectionOracleTIME; // break; case enuTypeDataBase.SqlServer: DataConnection = DataConnectionSQLServer; break; default: break; } return(DataConnection); }
public DbConnection ConnectionGet(enuTypeDataBase typeDataBase = enuTypeDataBase.OracleCanalP) { DbConnection DataConnection = null; switch (typeDataBase) { case enuTypeDataBase.OracleCanalP: DataConnection = DataConnectionOracle; break; case enuTypeDataBase.OracleVTime: DataConnection = DataConnectionOracleTIME; break; case enuTypeDataBase.OracleConciliacion: DataConnection = DataConnectionOracleConciliacion; break; default: break; } return(DataConnection); }
public DbDataReader ExecuteByStoredProcedure(string nameStore, IEnumerable <DbParameter> parameters = null, enuTypeDataBase typeDataBase = enuTypeDataBase.OracleCanalP, enuTypeExecute typeExecute = enuTypeExecute.ExecuteReader ) { DbConnection DataConnection = ConnectionGet(typeDataBase); DbCommand cmdCommand = DataConnection.CreateCommand(); cmdCommand.CommandText = nameStore; cmdCommand.CommandType = CommandType.StoredProcedure; if (parameters != null) { foreach (DbParameter parameter in parameters) { cmdCommand.Parameters.Add(parameter); } } DataConnection.Open(); DbDataReader myReader; if (typeDataBase == enuTypeDataBase.SqlServer && typeExecute == enuTypeExecute.ExecuteReader) { myReader = cmdCommand.ExecuteReader(CommandBehavior.CloseConnection); } else { cmdCommand.ExecuteNonQuery(); ParamsCollectionResult = cmdCommand.Parameters; cmdCommand.Connection.Close(); myReader = null; } return(myReader); }
public DbDataReader ExecuteByStoredProcedureCupon(string nameStore, IEnumerable <DbParameter> parameters = null, enuTypeDataBase typeDataBase = enuTypeDataBase.OracleCanalP, enuTypeExecute typeExecute = enuTypeExecute.ExecuteReader ) { DbConnection DataConnection = ConnectionGet(typeDataBase); DbCommand cmdCommand = DataConnection.CreateCommand(); cmdCommand.CommandText = nameStore; cmdCommand.CommandType = CommandType.StoredProcedure; if (parameters != null) { foreach (DbParameter parameter in parameters) { cmdCommand.Parameters.Add(parameter); } } DataConnection.Open(); DbDataReader myReader; if (((cmdCommand.Parameters.Contains("CUR_TOUT") || cmdCommand.Parameters.Contains("CUR_COUPONS") || cmdCommand.Parameters.Contains("CUR_CUPONERA") || cmdCommand.Parameters.Contains("CUR_TREPORTOUT") || cmdCommand.Parameters.Contains("RC1") || IsOracleReader(cmdCommand))) && typeExecute == enuTypeExecute.ExecuteReader) { myReader = cmdCommand.ExecuteReader(CommandBehavior.CloseConnection); } else { cmdCommand.ExecuteNonQuery(); ParamsCollectionResult = cmdCommand.Parameters; //z = ParamsCollectionResult; cmdCommand.Connection.Close(); myReader = null; } return(myReader); }