private static void SetTimer(string key, object value, CacheItemRemovedReason reason) { try { DateTime moment = DateTime.Now; int day = moment.Day; int hour = moment.Hour; if (hour == 9) { CommonTasks Tasking = new CommonTasks(); if (day == 1) { Tasking.AddExpenseToHorseLanders(); } Tasking.InsertChecksToMas(); } } catch { } finally { // StartMailChecker(); } }
public void CacheItemRemoved(string k, object v, CacheItemRemovedReason r) { // do stuff here if it matches our taskname, like WebRequest // re-add our task so it recurs try { DateTime moment = DateTime.Now; int day = moment.Day; int hour = moment.Hour; if (hour == 7) { CommonTasks Tasking = new CommonTasks(); if (day == 1) { Tasking.AddExpenseToHorseLanders(); } Tasking.InsertChecksToMas(); Tasking.InsertSchedularToken(); } } catch (Exception ex) { } AddTask(k, Convert.ToInt32(v)); }