Ejemplo n.º 1
0
        /// <summary>
        /// Gets the schedule history.
        /// </summary>
        /// <param name="scheduleID">The schedule ID.</param>
        /// <returns></returns>
        public ScheduleHistoryItem GetScheduleHistory(int scheduleId)
        {
            //return CBO.FillCollection(DataProvider.Instance().GetScheduleHistory(ScheduleID), typeof(ScheduleHistoryItem));
            ScheduleHistoryItem scheduleHistoryItem = null;

            try
            {
                scheduleHistoryItem = CBO <ScheduleHistoryItem> .FillObject(
                    DataProvider.Instance().GetScheduleHistory(scheduleId));
            }
            catch (Exception ex)
            {
                if (ExceptionPolicy.HandleException(ex, "Business Logic"))
                {
                    throw;
                }
            }
            return(scheduleHistoryItem);
        }
Ejemplo n.º 2
0
 public abstract int SaveScheduleHistory(ScheduleHistoryItem scheduleHistoryItem);
Ejemplo n.º 3
0
        public void Run(ScheduleHistoryItem objScheduleHistoryItem)
        {
            try
            {
                // ''''''''''''''''''''''''''''''''''''''''''''''''''
                // This is called from RunPooledThread()
                // ''''''''''''''''''''''''''''''''''''''''''''''''''
                ticksElapsed = Environment.TickCount - ticksElapsed;
                // This is what we're running
                SchedulerClient Process = null;
                // Create an instance of our SchedulerClient derived class using Reflection
                Process = GetSchedulerClient(objScheduleHistoryItem.TypeFullName, objScheduleHistoryItem);
                // Store the schedule info/item in the instance
                Process.ScheduleHistoryItem = objScheduleHistoryItem;

                // ''''''''''''''''''''''''''''''''''''''''''''''''''
                // Set up the handlers to the CoreScheduler from our instance
                // ''''''''''''''''''''''''''''''''''''''''''''''''''
                Process.ProcessStarted     += new WorkStarted(Scheduler.CoreScheduler.WorkStarted);
                Process.ProcessProgressing += new WorkProgressing(Scheduler.CoreScheduler.WorkProgressing);
                Process.ProcessCompleted   += new WorkCompleted(Scheduler.CoreScheduler.WorkCompleted);
                Process.ProcessErrored     += new WorkErrored(Scheduler.CoreScheduler.WorkErrored);

                // ''''''''''''''''''''''''''''''''''''''''''''''''''
                // This kicks off the DoWork method of the class
                // type specified in the configuration.
                // ''''''''''''''''''''''''''''''''''''''''''''''''''
                Process.Started();

                // Do the actual work
                try
                {
                    // Do the actual work
                    Process.DoWork();
                }
                catch (Exception exc)
                {
                    // In case the scheduler client
                    // didn't have proper exception handling
                    // make sure we fire the Errored event
                    Process.ScheduleHistoryItem.Succeeded = false;
                    Process.Errored(ref exc);
                }

                if (Process.ScheduleHistoryItem.Succeeded)
                {
                    Process.Completed();
                }

                // ''''''''''''''''''''''''''''''''''''''''''''''''''
                // If all processes in this ProcessGroup have
                // completed, set the ticksElapsed and raise
                // the Completed event.
                // I don't think this is necessary with the
                // other events.  I'll leave it for now and
                // will probably take it out later.
                // ''''''''''''''''''''''''''''''''''''''''''''''''''
                if (processesCompleted == numberOfProcesses)
                {
                    ticksElapsed = (Environment.TickCount - ticksElapsed);
                    if (null != Completed)
                    {
                        Completed();
                    }
                }
            }
            catch (Exception exc)
            {
                //Exceptions.ProcessSchedulerException(exc);
                throw exc;
            }
            finally
            {
                // See if we need to undo impersonation
                //if (null != impersonationContext)
                //{
                //    Globals.UndoImpersonation(impersonationContext);
                //}

                // ''''''''''''''''''''''''''''''''''''''''''''''''''
                // Track how many processes have completed for
                // this instanciation of the ProcessGroup
                // ''''''''''''''''''''''''''''''''''''''''''''''''''
                numberOfProcessesInQueue -= 1;
                processesCompleted++;
            }
        }