コード例 #1
0
        /// Update execution
        public static bool UpdateExecution(int iSchedulerExecutionId, DateTime?dExecutionTimeStamp, int iStatus)
        {
            OracleDbAccess    dbAccess = new OracleDbAccess();
            OracleConnection  oracleConnection;
            OracleDataAdapter dataAdapter = new OracleDataAdapter();
            OracleCommand     command     = new OracleCommand();

            try
            {
                // Get the connection
                oracleConnection = dbAccess.GetConnection();

                // Set the procedure name
                command             = new OracleCommand("CPIO.SP_PIO_UpdateExecution", oracleConnection);
                command.CommandType = CommandType.StoredProcedure;

                // Add parameters and assign them to values
                command.Parameters.Add("iSchedulerExecutionId", OracleDbType.Int32).Value = iSchedulerExecutionId;
                command.Parameters.Add("dExecutionTimeStamp", OracleDbType.Date).Value    = dExecutionTimeStamp;
                command.Parameters.Add("iStatus", OracleDbType.Int32).Value = iStatus;

                // Open the connection
                dbAccess.OpenConnection(oracleConnection);

                // Execute procedure
                command.ExecuteNonQuery();

                return(true);
            }
            catch (Exception ex)
            {
                Logger.Log(Logger.GetCurrentMethod(), ex.Message, ex.StackTrace);
                return(false);
            }
        }
コード例 #2
0
        /// Disable scheduler settings
        public static bool SetSchedulerSettingState(int schedulerSettingsId, bool enabled)
        {
            OracleDbAccess   dbAccess = new OracleDbAccess();
            OracleConnection oracleConnection;
            OracleCommand    command = new OracleCommand();

            try
            {
                // Get the connection
                oracleConnection = dbAccess.GetConnection();

                // Set the procedure name
                command             = new OracleCommand("CPIO.SP_PIO_SetSchdlrStgsState", oracleConnection);
                command.CommandType = CommandType.StoredProcedure;

                // Add parameters and assign them to values
                command.Parameters.Add("iSchedulerSettingsId", OracleDbType.Int32).Value = schedulerSettingsId;
                command.Parameters.Add("bEnabled", OracleDbType.Int32).Value             = enabled;

                // Open the connection
                dbAccess.OpenConnection(oracleConnection);

                // Execute procedure
                command.ExecuteNonQuery();

                return(true);
            }
            catch (Exception ex)
            {
                Logger.Log(Logger.GetCurrentMethod(), ex.Message, ex.StackTrace);
                return(false);
            }
        }
コード例 #3
0
        public static DataSet GetJobScheduler(int iSchedulerId)
        {
            OracleDbAccess    dbAccess = new OracleDbAccess();
            OracleConnection  oracleConnection;
            OracleDataAdapter dataAdapter = new OracleDataAdapter();
            OracleCommand     command     = new OracleCommand();
            DataSet           dsScheduler = null;

            try
            {
                // Get the connection
                oracleConnection = dbAccess.GetConnection();

                // Set the procedure name
                command             = new OracleCommand("CPIO.SP_PIO_GetJobScheduler", oracleConnection);
                command.CommandType = CommandType.StoredProcedure;

                // Add parameters and assign them to values
                command.Parameters.Add("iSchedulerId", OracleDbType.Int32).Value = iSchedulerId;

                // Cursor returned
                command.Parameters.Add("oRefCursor", OracleDbType.RefCursor, ParameterDirection.InputOutput);

                // Open the connection
                dbAccess.OpenConnection(oracleConnection);

                // Execute procedure
                command.ExecuteNonQuery();

                // Fill dataset
                dataAdapter = new OracleDataAdapter(command);
                dsScheduler = new DataSet();
                dataAdapter.Fill(dsScheduler);
            }
            catch (Exception ex)
            {
                Logger.Log(Logger.GetCurrentMethod(), ex.Message, ex.StackTrace);
                dsScheduler = null;
            }
            return(dsScheduler);
        }
コード例 #4
0
        /// Create a new execution record
        public static int AddExecution(ISchedulerExecution schedulerExecution)
        {
            OracleDbAccess    dbAccess = new OracleDbAccess();
            OracleConnection  oracleConnection;
            OracleDataAdapter dataAdapter = new OracleDataAdapter();
            OracleCommand     command     = new OracleCommand();

            try
            {
                // Get the connection
                oracleConnection = dbAccess.GetConnection();

                // Set the procedure name
                command             = new OracleCommand("CPIO.SP_PIO_AddExecution", oracleConnection);
                command.CommandType = CommandType.StoredProcedure;

                // Add parameters and assign them to values
                command.Parameters.Add("iSchedulerSettingsId", OracleDbType.Int32).Value = schedulerExecution.SchedulerSettingsId;
                command.Parameters.Add("dExecutionTimestamp", OracleDbType.Date).Value   = schedulerExecution.ExecutionTimeStamp;
                command.Parameters.Add("iStatus", OracleDbType.Int32).Value = schedulerExecution.Status;

                // object returned
                command.Parameters.Add("iSchedulerExecutionId", OracleDbType.Int32, ParameterDirection.Output);
                int.TryParse(command.Parameters["iSchedulerExecutionId"].Value.ToString(), out int iSchedulerExecutionId);

                // Open the connection
                dbAccess.OpenConnection(oracleConnection);

                // Execute procedure
                command.ExecuteNonQuery();

                return(iSchedulerExecutionId);
            }
            catch (Exception ex)
            {
                Logger.Log(Logger.GetCurrentMethod(), ex.Message, ex.StackTrace);
                throw;
            }
        }