1

I want to implement a job scheduler in my C# project. I searched on google and finally got information about Quartz.

So I try to use Quartz in my project. For that I added quartz.dll file and developed a simple application.

This is my code:

using Quartz;
using Quartz.Impl;

public partial class job_scheduling_in_c : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ISchedulerFactory schedFact = new StdSchedulerFactory();

        //Yeni bir zamanlayıcı oluşturulup çalıştırılıyor
        IScheduler sched = schedFact.GetScheduler();
        sched.Start();

        //Oluşturduğumuz görev(MyJob) hazırlanıyor

        JobDetail jobDetail = new JobDetail("myJob", null, typeof(MyJob));

        //Başlatıldıktan 20 sn sonra çalışacak bir SimpleTrigger oluşturuluyor. 
        //İlk çalışmadan sonra 10 sn arayla 5 kez daha tetiklenecek
        Trigger trigger = new SimpleTrigger("myFirstTrigger",
                                               null,
                                               DateTime.UtcNow.AddSeconds(20),
                                               null,
                                               5,
                                               TimeSpan.FromSeconds(10));

        //Görev tetikleyici ile zamanlanıyor
        sched.ScheduleJob(jobDetail, trigger);
        //Uygulama bekletiliyor
        ManualResetEvent resetEvent = new ManualResetEvent(false);
        resetEvent.WaitOne();

    }

But in that

JobDetail jobDetail = new JobDetail("myJob", null, typeof(MyJob));
Trigger trigger = new SimpleTrigger("myFirstTrigger",
                                           null,
                                           DateTime.UtcNow.AddSeconds(20),
                                           null,
                                           5,
                                           TimeSpan.FromSeconds(10));

I don't get the corresponding reference of JobDetail and Trigger class. If both are built in class or user-defined class. If any one know please help me.

Jehof
  • 34,674
  • 10
  • 123
  • 155
Isha John
  • 593
  • 2
  • 5
  • 16

1 Answers1

0

Did you add a reference to the Quartz namespace?

Right click on your project, choose Add reference from the menu and select the Quartz.dll.

jao
  • 18,273
  • 15
  • 63
  • 96
  • If he's working with the 1.0 version, is more than enough. However, if he's working with the 2.x he has a bit of a problem because all properties are changed in the Quartz.dll library for the Quartz package. I had the same problem and I started reading this [link](http://jayvilalta.com/blog/). He gives you some of the references and he's busy with a new ebook about it. – Marialvy Martínez Aug 28 '13 at 14:02