private void Scheduler_ExecuteScheduledEvent(object sender, EventArgs e) { try { var admin = new busCodeSnippet(); admin.ClearAnonymousSnippets(App.Configuration.HoursToDeleteAnonymousSnippets, 9999999); } catch { } }
public ActionResult ClearAnonymousSnippets() { busCodeSnippet codeSnippet = CodePasteFactory.GetCodeSnippet(); int result = codeSnippet.ClearAnonymousSnippets(App.Configuration.HoursToDeleteAnonymousSnippets, App.Configuration.MinViewBeforeDeleteAnonymousSnippets); if (result < 0) { ErrorDisplay.ShowError(codeSnippet.ErrorMessage); } else { ErrorDisplay.ShowMessage((result).ToString() + " old snippets have been cleared out."); } return(View("Index", ViewModel)); }
protected void Application_Start() { RegisterRoutes(RouteTable.Routes); //.RewriteRoutesForTesting(RouteTable.Routes); //JSONSerializer.DefaultJsonParserType = SupportedJsonParserTypes.JavaScriptSerializer; // Create a log manager based on setting in config file LogManager.Create(); // Clear out expired anonymous snippets whenever app starts busCodeSnippet Snippet = new busCodeSnippet(); Snippet.ClearAnonymousSnippets(App.Configuration.DaysToDeleteAnonymousSnippets, App.Configuration.MinViewBeforeDeleteAnonymousSnippets); }
protected void Application_Start() { RegisterRoutes(RouteTable.Routes); //.RewriteRoutesForTesting(RouteTable.Routes); //JSONSerializer.DefaultJsonParserType = SupportedJsonParserTypes.JavaScriptSerializer; // Create a log manager based on setting in config file LogManager.Create(); // Clear out expired anonymous snippets whenever app starts busCodeSnippet Snippet = new busCodeSnippet(); Snippet.ClearAnonymousSnippets(App.Configuration.HoursToDeleteAnonymousSnippets, App.Configuration.MinViewBeforeDeleteAnonymousSnippets); // Clear Anonymous snippets scheduler = new Scheduler(); scheduler.CheckFrequency = 3600 * 1000; scheduler.ExecuteScheduledEvent += Scheduler_ExecuteScheduledEvent; }