Created
May 3, 2024 18:29
-
-
Save ChrisMoney/15eb30f0cf2eef04e0aeac821234baca to your computer and use it in GitHub Desktop.
Stored Proc - call stored proc from DAO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public (string, int) FindInsertProc(int upcId, int store, DateTime endDate) | |
{ | |
var globalDB = new GlobalDBUtilities(); | |
var parameters = new List<OracleParameter> | |
{ | |
globalDB.OracleParameterWithValue(":Vupc_id", OracleDbType.Int32, upcId), | |
globalDB.OracleParameterWithValue(":Vstore", OracleDbType.Int32, store), | |
globalDB.OracleParameterWithValue(":Beg_date", OracleDbType.Date, DateTime.Now), | |
globalDB.OracleParameterWithValue(":End_date", OracleDbType.Date, endDate), | |
globalDB.OracleParameterWithValue(":Data_source", OracleDbType.Varchar2, "SHELFMAN"), | |
globalDB.OracleParameterWithValue(":AdType", OracleDbType.Int32, 15), | |
globalDB.OracleParameterWithValue(":Omsg1", OracleDbType.Varchar2, 100, ParameterDirection.Output), | |
globalDB.OracleParameterWithValue(":Omsg2", OracleDbType.Varchar2, 100, ParameterDirection.Output), | |
globalDB.OracleParameterWithValue(":Odatebeg", OracleDbType.Date, 100, ParameterDirection.Output), | |
globalDB.OracleParameterWithValue(":Odateend", OracleDbType.Date, 100, ParameterDirection.Output), | |
}; | |
globalDB.ExecuteParameterizedStoredProc("Improd.price_package.promo_find_insert_procedure", _connection, _transaction, parameters); | |
string omsg1 = parameters[parameters.FindIndex(x => x.ParameterName == ":Omsg1")].Value.ToString().ToUpper(); | |
string omsg2 = parameters[parameters.FindIndex(x => x.ParameterName == ":Omsg2")].Value.ToString().ToUpper(); | |
int retVal = 0; | |
if (!omsg1.Equals("ERROR") && !omsg1.Equals("RECALL")) // check for error messages) | |
{ | |
retVal = 1; | |
} | |
else | |
{ | |
retVal = 0; | |
throw new Exception(omsg2.ToString()); | |
} | |
return (omsg1, retVal); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment