//public Scheduler() //{ // try // { // // Create the table client. // StorageCredentials creds = new StorageCredentials("snapmails", "K34cW5qYo2LBovgfMQMTQMQvdDv84LWWJucWpmwHoN5lL81/r2Ct8ZFx1UqmhMq9GlMN84uYXYIH6xTndB8Eqw=="); // CloudStorageAccount storageAccount = new CloudStorageAccount(creds, useHttps: true); // CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); // CloudTable tblEmails = tableClient.GetTableReference("Emails"); // tblEmails.CreateIfNotExists(); // SnapmailData snapmail = new SnapmailData() // { // JobKey = "jk1", // JobGroup = "jg1", // UserId = "shakeelanjum", // Cameras = "window", // Sender = "*****@*****.**", // Subject = "Hi Shakeel, this is a daily email", // Recipients = "*****@*****.**", // NotifyDays = "sat, sun", // NotifyHH = 10, // NotifyMM = 00, // Status = 0 // }; // EmailData email = new EmailData() // { // ETag = "*", // PartitionKey = "P1", // RowKey = Guid.NewGuid().ToString(), // UserID = "shakeelanjum", // Email = "*****@*****.**", // Timestamp = DateTimeOffset.Now, // }; // } // catch(Exception x) // { // Console.WriteLine(x.ToString()); // } //} //static void Main(string[] args) //{ // //Common.Logging.LogManager.Adapter = new Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter { Level = Common.Logging.LogLevel.Info }; // // Now let's start our scheduler; you could perform // // any processing or bootstrapping code here before // // you start it but it must be started to schedule // // any jobs // Scheduler.Start(); // // Schedule a test job, that will run instantly // //ScheduleInstantJob(CreateTestJob("SendTestEmail", "testgroup")); // // Tirgger instantly // //Scheduler.TriggerJob(new JobKey("SendTestEmail", "testgroup")); // //// Schedule a daily job // ScheduleDailyJob(CreateDailyJob("SendDailyEmail", "dailygroup")); // //Scheduler.TriggerJob(new JobKey("SendDailyEmail", "dailygroup")); // // some sleep to show what's happening // Thread.Sleep(TimeSpan.FromSeconds(60)); // Scheduler.Shutdown(); // Console.ReadKey(); //} private static IJobDetail CreateDailyJob(string jobKey, string jobGroup) { IJobDetail _detail = JobBuilder.Create <SnapmailJob>() .WithIdentity(jobKey, jobGroup) // Here we can assign a friendly name to our job .Build(); // And now we build the job detail SnapmailData data = new SnapmailData() { JobKey = jobKey, JobGroup = jobGroup, UserId = "shakeelanjum", Cameras = "window", Sender = "*****@*****.**", Subject = "Hi Shakeel, this is a daily email", Recipients = "*****@*****.**", NotifyDays = "sat, sun", NotifyHH = 10, NotifyMM = 00, Status = 0 }; _detail.JobDataMap.Add("JobData", data); return(_detail); }
//public Scheduler() //{ // try // { // // Create the table client. // StorageCredentials creds = new StorageCredentials("snapmails", "K34cW5qYo2LBovgfMQMTQMQvdDv84LWWJucWpmwHoN5lL81/r2Ct8ZFx1UqmhMq9GlMN84uYXYIH6xTndB8Eqw=="); // CloudStorageAccount storageAccount = new CloudStorageAccount(creds, useHttps: true); // CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); // CloudTable tblEmails = tableClient.GetTableReference("Emails"); // tblEmails.CreateIfNotExists(); // SnapmailData snapmail = new SnapmailData() // { // JobKey = "jk1", // JobGroup = "jg1", // UserId = "shakeelanjum", // Cameras = "window", // Sender = "*****@*****.**", // Subject = "Hi Shakeel, this is a daily email", // Recipients = "*****@*****.**", // NotifyDays = "sat, sun", // NotifyHH = 10, // NotifyMM = 00, // Status = 0 // }; // EmailData email = new EmailData() // { // ETag = "*", // PartitionKey = "P1", // RowKey = Guid.NewGuid().ToString(), // UserID = "shakeelanjum", // Email = "*****@*****.**", // Timestamp = DateTimeOffset.Now, // }; // } // catch(Exception x) // { // Console.WriteLine(x.ToString()); // } //} //static void Main(string[] args) //{ // //Common.Logging.LogManager.Adapter = new Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter { Level = Common.Logging.LogLevel.Info }; // // Now let's start our scheduler; you could perform // // any processing or bootstrapping code here before // // you start it but it must be started to schedule // // any jobs // Scheduler.Start(); // // Schedule a test job, that will run instantly // //ScheduleInstantJob(CreateTestJob("SendTestEmail", "testgroup")); // // Tirgger instantly // //Scheduler.TriggerJob(new JobKey("SendTestEmail", "testgroup")); // //// Schedule a daily job // ScheduleDailyJob(CreateDailyJob("SendDailyEmail", "dailygroup")); // //Scheduler.TriggerJob(new JobKey("SendDailyEmail", "dailygroup")); // // some sleep to show what's happening // Thread.Sleep(TimeSpan.FromSeconds(60)); // Scheduler.Shutdown(); // Console.ReadKey(); //} private static IJobDetail CreateDailyJob(string jobKey, string jobGroup) { IJobDetail _detail = JobBuilder.Create<SnapmailJob>() .WithIdentity(jobKey, jobGroup) // Here we can assign a friendly name to our job .Build(); // And now we build the job detail SnapmailData data = new SnapmailData() { JobKey = jobKey, JobGroup = jobGroup, UserId = "shakeelanjum", Cameras = "window", Sender = "*****@*****.**", Subject = "Hi Shakeel, this is a daily email", Recipients = "*****@*****.**", NotifyDays = "sat, sun", NotifyHH = 10, NotifyMM = 00, Status = 0 }; _detail.JobDataMap.Add("JobData", data); return _detail; }