Skip to content

Instantly share code, notes, and snippets.

@jonathanread
Created June 9, 2014 15:00
Show Gist options
  • Save jonathanread/f4d391695f6e82091c97 to your computer and use it in GitHub Desktop.
Save jonathanread/f4d391695f6e82091c97 to your computer and use it in GitHub Desktop.
using SitefinityWebApp.Custom;
using System;
using System.Linq;
using System.Web.Http;
using System.Web.Routing;
using Telerik.Sitefinity.Abstractions;
using Telerik.Sitefinity.Configuration;
using Telerik.Sitefinity.Data;
using System.Web.Http.OData.Builder;
using Aptera.Sitefinity.Model;
using Aptera.Sitefinity.Scheduling;
using Telerik.Sitefinity.Scheduling;
using Telerik.Sitefinity.Services.Events;
using Telerik.Sitefinity.Web.Events;
using System.Web;
using System.Globalization;
using Telerik.Sitefinity.Services;
using Telerik.Sitefinity.Modules.Ecommerce;
using Telerik.Sitefinity.Security.Events;
using Telerik.Sitefinity.Ecommerce.Payment.Model;
using Telerik.Sitefinity.Security;
namespace SitefinityWebApp
{
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
Bootstrapper.Initialized += new EventHandler<ExecutedEventArgs>(this.OnSitefinityAppInitialized);
}
private void OnSitefinityAppInitialized(object sender, EventArgs args)
{
SchedulingManager schedulingManager = SchedulingManager.GetManager();
string key = "868C0440-705E-6A7D-A775-FF0A00BA8CFC";
var count = schedulingManager.GetTaskData().Where(i => i.Key == key).ToList().Count;
if (count == 0)
{
RecurringScheduledTask newTask = new RecurringScheduledTask() { Key = key, ExecuteTime = DateTime.UtcNow.AddSeconds(30) };
schedulingManager.AddTask(newTask);
schedulingManager.SaveChanges();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment