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

            if (prog.CheckoutLicense())
            {
                // Arguments list
                // /ReportID:<Report ID to execute>
                // /NotifType:<Notification type to send>
                // example: JTXReportNotification.exe /NotifType:ReportNotification /ReportID:401

                object[] pArgObjects = args as object[];

                // Get some variables ready
                int    iReportID             = 0;
                string sReportID             = "";
                string sNotificationTypeName = "";

                StepUtilities.GetArgument(ref pArgObjects, "ReportID", true, out sReportID);
                if (!int.TryParse(sReportID, out iReportID))
                {
                    Console.WriteLine("Invalid Report ID entered");
                    return;
                }
                StepUtilities.GetArgument(ref pArgObjects, "NotifType", true, out sNotificationTypeName);
                if (sNotificationTypeName == "")
                {
                    Console.WriteLine("A notification type must be entered.");
                }

                IJTXDatabaseManager jtxDBMan  = new JTXDatabaseManagerClass();
                IJTXDatabase        pJTXDB    = jtxDBMan.GetActiveDatabase(false);
                IJTXConfiguration2  jtxConfig = pJTXDB.ConfigurationManager as IJTXConfiguration2;

                string sReportOutput = prog.RunReport(jtxConfig, iReportID);

                // if there's output, send the notification
                if (sReportOutput != "")
                {
                    IJTXNotificationConfiguration pNotificationConfig = (IJTXNotificationConfiguration)jtxConfig;
                    IJTXNotificationType          pNotificationType   = pNotificationConfig.GetNotificationType(sNotificationTypeName);

                    if (pNotificationType == null)
                    {
                        Console.WriteLine("Please enter a valid notification type.");
                        return;
                    }

                    // Update the message
                    string sMessageBefore = pNotificationType.MessageTemplate;
                    pNotificationType.MessageTemplate = sReportOutput;
                    pNotificationType.Store();

                    // Send it!
                    JTXUtilities.SendNotification(sNotificationTypeName, pJTXDB, null, null);

                    // Set the message back.
                    pNotificationType.MessageTemplate = "";
                    pNotificationType.Store();
                }
                else
                {
                    Console.WriteLine("Please enter a valid report ID.");
                }

                prog.CheckinLicense();
            }
        }
        static void Main(string[] args)
        {
            JTXReportNotification prog = new JTXReportNotification();
            if (prog.CheckoutLicense())
            {
                // Arguments list
                // /ReportID:<Report ID to execute>
                // /NotifType:<Notification type to send>
                // example: JTXReportNotification.exe /NotifType:ReportNotification /ReportID:401

                object[] pArgObjects = args as object[];

                // Get some variables ready
                int iReportID = 0;
                string sReportID = "";
                string sNotificationTypeName = "";

                StepUtilities.GetArgument(ref pArgObjects, "ReportID", true, out sReportID);
                if (!int.TryParse(sReportID, out iReportID))
                {
                    Console.WriteLine("Invalid Report ID entered");
                    return;
                }
                StepUtilities.GetArgument(ref pArgObjects, "NotifType", true, out sNotificationTypeName);
                if (sNotificationTypeName == "")
                {
                    Console.WriteLine("A notification type must be entered.");
                }
                
                IJTXDatabaseManager jtxDBMan = new JTXDatabaseManagerClass();
                IJTXDatabase pJTXDB = jtxDBMan.GetActiveDatabase(false);
                IJTXConfiguration2 jtxConfig = pJTXDB.ConfigurationManager as IJTXConfiguration2;

                string sReportOutput = prog.RunReport(jtxConfig, iReportID);

                // if there's output, send the notification
                if (sReportOutput != "")
                {
                    IJTXNotificationConfiguration pNotificationConfig = (IJTXNotificationConfiguration)jtxConfig;
                    IJTXNotificationType pNotificationType = pNotificationConfig.GetNotificationType(sNotificationTypeName);

                    if (pNotificationType == null)
                    {
                        Console.WriteLine("Please enter a valid notification type.");
                        return;
                    }

                    // Update the message
                    string sMessageBefore = pNotificationType.MessageTemplate;
                    pNotificationType.MessageTemplate = sReportOutput;
                    pNotificationType.Store();
                    
                    // Send it!
                    JTXUtilities.SendNotification(sNotificationTypeName, pJTXDB, null, null);

                    // Set the message back.
                    pNotificationType.MessageTemplate = "";
                    pNotificationType.Store();
                }
                else Console.WriteLine("Please enter a valid report ID.");

                prog.CheckinLicense();
            }
        }