public static void AddJob()
        {
            try
            {
                isSchedulerStart = true;

                log.Error(" Now Job is Called for RecordSales ");

                IRecordSalesJob myJob = new RecordSalesJob();
                //JobDetailImpl jobDetail = new JobDetailImpl("Job1", "Group1", myJob.GetType());
                JobDetailImpl jobDetail = new JobDetailImpl("JobRecordSales", "GroupRecordSales", myJob.GetType());
                //CronTriggerImpl trigger = new CronTriggerImpl("Trigger1", "Group1", "0 * 8-17 * * ?"); //run every minute between the hours of 8am and 5pm
                 // per minute 0 */1 * * * ?
                //Night 2 o' clock === 0 0 2 * * ?
                CronTriggerImpl trigger = new CronTriggerImpl("Trigger1", "GroupRecordSales", "0 0 3 * * ?"); //run every minute between the hours of 8am and 5pm
                _scheduler.ScheduleJob(jobDetail, trigger);

                DateTimeOffset? nextFireTime = trigger.GetNextFireTimeUtc();
            }
            catch (Exception ex)
            {
                log.Error("Exception in run AddJob ", ex);
            }
        }
 public static void AddJob()
 {
     log.Debug(" Called AddJob Method of Common Scheduler");
     IRunAllJob myJob = new RunAllJob();
     //JobDetailImpl jobDetail = new JobDetailImpl("Job1", "Group1", myJob.GetType());
     JobDetailImpl jobDetail = new JobDetailImpl("AllJob", "AllGroup", myJob.GetType());
     //CronTriggerImpl trigger = new CronTriggerImpl("Trigger1", "Group1", "0 * 8-17 * * ?"); //run every minute between the hours of 8am and 5pm
     // per minute 0 */1 * * * ?
     CronTriggerImpl trigger = new CronTriggerImpl("Trigger1", "AllGroup", "0 */1 * * * ?"); //run every minute between the hours of 8am and 5pm
     _scheduler.ScheduleJob(jobDetail, trigger);
     DateTimeOffset? nextFireTime = trigger.GetNextFireTimeUtc();
 }
Beispiel #3
0
        public static void AddHealthMonitoringJob()
        {
            const string trigger1 = "HealthMonitoring";
            const string timeToRun = "0 0/10 * * * ?";

            IMyJob myJob = new HealthMonitiorJob(); //This Constructor needs to be parameterless
            var jobDetail = new JobDetailImpl(trigger1 + Job, Group1, myJob.GetType());
            var trigger = new CronTriggerImpl(trigger1, Group1, timeToRun)
            {TimeZone = TimeZoneInfo.Utc};
            _scheduler.ScheduleJob(jobDetail, trigger);
            DateTimeOffset? nextFireTime = trigger.GetNextFireTimeUtc();
            if (nextFireTime != null)
                Log.Info(string.Format("{0}+{1}", Group1, trigger1), new Exception(nextFireTime.Value.ToString("u")));
        }
        public static void AddJob()
        {
            isSchedulerStart = true;

            log.Error(" Now Job is Called for Deposti ");
            IDepositJob myJob = new DepositJob();
            JobDetailImpl jobDetail = new JobDetailImpl("JobDeposit", "GroupDeposit", myJob.GetType());
            //CronTriggerImpl trigger = new CronTriggerImpl("Trigger1", "Group1", "0 * 8-17 * * ?"); //run every minute between the hours of 8am and 5pm
            // per minute 0 */1 * * * ?
            // Night 2 o'clock==== 0 0 2 * * ?
            CronTriggerImpl trigger = new CronTriggerImpl("Trigger1", "GroupDeposit", "0 0 2 * * ?"); //run every minute between the hours of 8am and 5pm
            _scheduler.ScheduleJob(jobDetail, trigger);
            DateTimeOffset? nextFireTime = trigger.GetNextFireTimeUtc();
        }
Beispiel #5
0
        public static void AddBirthdayJob()
        {
            const string trigger1 = "EmailTasksTrigger";
            const string jobName = trigger1 + Job;
            const string timeToRun = "0 0 2 * * ?";

            IMyJob myJob = new BirthdayJob(); //This Constructor needs to be parameterless
            var jobDetail = new JobDetailImpl(jobName, Group1, myJob.GetType());
            var trigger = new CronTriggerImpl(trigger1, Group1, timeToRun)
            {TimeZone = TimeZoneInfo.Utc};
            _scheduler.ScheduleJob(jobDetail, trigger);
            DateTimeOffset? nextFireTime = trigger.GetNextFireTimeUtc();
            if (nextFireTime != null)
                Log.Debug(string.Format("{0}+{1}", Group1, trigger1), new Exception(nextFireTime.Value.ToString("u")));
        }
        /**
            Método que pérmite calendarizar un nuevo job dentro de los cron del Sistema
        **/
        public static void scheduleJob(IJob jobToSchedule, String cronExpression)
        {

            JobDetailImpl       jobDetail = new JobDetailImpl("Job_" + jobCounter, "Group_" + jobCounter, jobToSchedule.GetType());
            CronTriggerImpl     trigger = null;
            DateTimeOffset?     dateTimOffset = null;

            if ( _scheduler == null)
            {
                initScheduler();
            }

            //Se crea el trigeer con el que se va a lanzar el job
            trigger = new CronTriggerImpl("Trigger_" + jobCounter, "Group_" + jobCounter, cronExpression);
            //Se agrega el calendarizador al scheduler
            _scheduler.ScheduleJob(jobDetail, trigger);

            //Se solicita el date Para el siguiente evento del scheduler
            dateTimOffset = trigger.GetNextFireTimeUtc();
            Console.WriteLine("Job Scheduled");
            Console.WriteLine(jobDetail.FullName + " its about to be fired at "  + dateTimOffset.Value );

            jobCounter++;
        }
Beispiel #7
0
        private void AddTopForumThreadsJob()
        {
            const string trigger1 = "TopForumThreads";
            const string timeToRun = "0 0 1 ? * SAT";

            IMyJob myJob = new TopForumThreadsJob(); //This Constructor needs to be parameterless
            var jobDetail = new JobDetailImpl(trigger1 + Job, Group1, myJob.GetType());
            var trigger = new CronTriggerImpl(trigger1, Group1, timeToRun)
            {TimeZone = TimeZoneInfo.Utc};
            _scheduler.ScheduleJob(jobDetail, trigger);
            DateTimeOffset? nextFireTime = trigger.GetNextFireTimeUtc();
            if (nextFireTime != null)
                Log.Info(string.Format("{0}+{1}", Group1, trigger1), new Exception(nextFireTime.Value.ToString("u")));
        }