Aarif Ansari

Aarif Ansari

  • 1.8k
  • 76
  • 1.5k

How to fire scheduler using C# based on Event table in DB?

Feb 16 2018 1:30 AM
Please explain this how to solve this issue.
 
This is my code: --
 
public class Job : IJob
{
public void SendSMS()
{
var Message = "Server Response " + new SmsProcessor().SendSMS("918800604269", "hi this is test SMS API by MVC 02-01-2018", SmsProcessor.SmsType.SendSMS_MType);
using (var message = new MailMessage("traveleasy45014@gmail.com", "traveleasy45014@gmail.com"))
{
message.Subject = "Message Subject test";
message.Body = "Message body test at " + DateTime.Now;
using (SmtpClient client = new SmtpClient
{
EnableSsl = true,
Host = "smtp.gmail.com",
Port = 587,
Credentials = new NetworkCredential("traveleasy45014@gmail.com", "7838279575")
})
{
client.Send(message);
}
}
}
public static bool IsTaskDone = false;
public void Execute(IJobExecutionContext context)
{
SendSMS();
}
}

Answers (1)