static void Main(string[] args)
        {
            JTXOverdueNotification prog = new JTXOverdueNotification();

            if (prog.CheckoutLicense())
            {
                try
                {
                    // Arguments list
                    // /NotifType:<Notification type to send>
                    // example: JTXOverdueNotification.exe /NotifType:OverdueJob

                    object[] pArgObjects = args as object[];

                    // Get some variables ready
                    string sNotificationTypeName = "";

                    StepUtilities.GetArgument(ref pArgObjects, "NotifType", true, out sNotificationTypeName);
                    if (sNotificationTypeName == "")
                    {
                        Console.WriteLine("A notification type must be entered.");
                        return;
                    }

                    IJTXDatabaseManager jtxDBMan   = new JTXDatabaseManagerClass();
                    IJTXDatabase        pJTXDB     = jtxDBMan.GetActiveDatabase(false);
                    IJTXConfiguration   pJTXConfig = pJTXDB.ConfigurationManager;

                    // Create a simple query to find jobs that were due before today
                    IQueryFilter pQF = new QueryFilterClass();

                    // NOTE #1: Verify the date format matches your selected RDBMS
                    // NOTE #2: Verify the status id for 'Closed' with the JTX Administrator
                    pQF.WhereClause = "DUE_DATE < '" + DateTime.Today.ToString() + "'" + " AND STATUS <> 9";
                    Console.WriteLine(pQF.WhereClause);

                    // Get the notification type for the notification that will be sent
                    IJTXNotificationConfiguration pNotificationConfig = pJTXConfig as IJTXNotificationConfiguration;
                    IJTXNotificationType          pNotificationType   = pNotificationConfig.GetNotificationType(sNotificationTypeName);
                    if (pNotificationType == null)
                    {
                        Console.WriteLine("Please enter a valid notification type.");
                        return;
                    }

                    // Get the job manager to execute the query and find the jobs in question
                    IJTXJobManager pJobManager = pJTXDB.JobManager;
                    IJTXJobSet     pJobs       = pJobManager.GetJobsByQuery(pQF);

                    pJobs.Reset();
                    for (int a = 0; a < pJobs.Count; a++)
                    {
                        IJTXJob pJob = pJobs.Next();
                        Console.WriteLine(pJob.Name);

                        // Send it!
                        JTXUtilities.SendNotification(sNotificationTypeName, pJTXDB, pJob, null);
                    }
                }
                catch (Exception except)
                {
                    Console.WriteLine("An error occurred: " + except.Message);
                }
                prog.CheckinLicense();
                Console.WriteLine("Completed.");
            }
        }
        static void Main(string[] args)
        {
            JTXOverdueNotification prog = new JTXOverdueNotification();
            if (prog.CheckoutLicense())
            {
                try
                {
                    // Arguments list
                    // /NotifType:<Notification type to send>
                    // example: JTXOverdueNotification.exe /NotifType:OverdueJob

                    object[] pArgObjects = args as object[];

                    // Get some variables ready
                    string sNotificationTypeName = "";

                    StepUtilities.GetArgument(ref pArgObjects, "NotifType", true, out sNotificationTypeName);
                    if (sNotificationTypeName == "")
                    {
                        Console.WriteLine("A notification type must be entered.");
                        return;
                    }

                    IJTXDatabaseManager jtxDBMan = new JTXDatabaseManagerClass();
                    IJTXDatabase pJTXDB = jtxDBMan.GetActiveDatabase(false);
                    IJTXConfiguration pJTXConfig = pJTXDB.ConfigurationManager;

                    // Create a simple query to find jobs that were due before today
                    IQueryFilter pQF = new QueryFilterClass();

                    // NOTE #1: Verify the date format matches your selected RDBMS
                    // NOTE #2: Verify the status id for 'Closed' with the JTX Administrator
                    pQF.WhereClause = "DUE_DATE < '" + DateTime.Today.ToString() + "'" + " AND STATUS <> 9";
                    Console.WriteLine(pQF.WhereClause);

                    // Get the notification type for the notification that will be sent
                    IJTXNotificationConfiguration pNotificationConfig = pJTXConfig as IJTXNotificationConfiguration;
                    IJTXNotificationType pNotificationType = pNotificationConfig.GetNotificationType(sNotificationTypeName);
                    if (pNotificationType == null)
                    {
                        Console.WriteLine("Please enter a valid notification type.");
                        return;
                    }

                    // Get the job manager to execute the query and find the jobs in question
                    IJTXJobManager pJobManager = pJTXDB.JobManager;
                    IJTXJobSet pJobs = pJobManager.GetJobsByQuery(pQF);

                    pJobs.Reset();
                    for (int a = 0; a < pJobs.Count; a++)
                    {
                        IJTXJob pJob = pJobs.Next();
                        Console.WriteLine(pJob.Name);

                        // Send it!
                        JTXUtilities.SendNotification(sNotificationTypeName, pJTXDB, pJob, null);
                    }
                }
                catch (Exception except)
                {
                    Console.WriteLine("An error occurred: " + except.Message);
                }
                prog.CheckinLicense();
                Console.WriteLine("Completed.");
            }
        }