Creating Custom Schedule Jobs in eCatalog


Automating Tasks with Customized Scheduling:

eCatalog allows programmers to define and register custom schedule jobs that automate various tasks according to specific operational needs. This feature is crucial for maintaining efficiency and ensuring that repetitive or time-dependent processes are handled automatically.


Steps to Create Custom Schedule Jobs:


Define Available Schedule Jobs:


Enumeration of Jobs: 
Programmers start by defining a list of available custom schedule jobs using enumerations. This helps in organizing and referencing the jobs throughout the system.


Example Enumeration:


 public enum enumScheduleJobs

    {

        [eCatalogDisplayName("Nominal Roll"), Description("Archive Nominal Roll")]

        SCHEDULEJOB_NOMINALROLL,

        [eCatalogDisplayName("Clinician Summary"), Description("To summarise all clinicians")]

        SCHEDULEJOB_CLINICIANSUMMARY,

        [eCatalogDisplayName("Clinician Gap Summary"), Description("Perform Summary - Gap & Long Process")]

        SCHEDULEJOB_CLINICIANSUMMARY_GAP,

       ...and so on.



Create the Schedule Job Class:


  • Inheritance from Generic Job Listener: 
    The custom schedule job should be a class that inherits from Glenosoft.eCatalog.GenericJobListener. This setup allows the job to integrate smoothly with the eCatalog scheduling system.
  • Implementing the Job Logic:
    • Constructor: Define the constructor to set up the job context and specific parameters.
    • Process Method: 
      • Implement the Process method where the actual job logic is executed.
      • Scheduling and Recurrence: 
        Define the getDefault_RecurrenceList method to specify how frequently the job should run.


public class CLIP_ScheduleTaskListener_ClinicianSummary_Gap : Glenosoft.eCatalog.GenericJobListener

    {

        private static object lockObject = new object();

        public CLIP_ScheduleTaskListener_ClinicianSummary_Gap(eCatalogContext Context, string AccountID)

            : base(Context, AccountID, Module_CLIP.Context.MODULE_NAME, enumScheduleJobs.SCHEDULEJOB_CLINICIANSUMMARY_GAP.toDisplayName())

        {


        }

        private void performClinicianSummaryGap(GenericJobArg oArg)

        {

            /// do action here

        }

        public override void Process(GenericJobArg oArg)

        {

            Exec_Process(

                oArg,

                () =>

                {

                    performClinicianSummaryGap(oArg);

                }

            );

        }

        public override List<eCatalogRecurrence> getDefault_RecurrenceList()

        {

            List<eCatalogRecurrence> result = new List<eCatalogRecurrence>();


            eCatalogRecurrenceDaily schedule = new eCatalogRecurrenceDaily(1,

                new eCatalogRecurrenceRange()

                {

                    StartDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 22, 0, 0)

                });


            result.Add(schedule);


            return result;

        }

    }