/// <summary> /// Called by the <see cref="IScheduler" /> when a /// <see cref="ITrigger" /> fires that is associated with /// the <see cref="IJob" />. /// </summary> public void Execute(IJobExecutionContext context) { if (SysVars.isConsole) Console.WriteLine("Executing Job ExpireTokens"); Dictionary<Guid, DateTime> tokens; // Get All locks using (SystemDAO dao = new SystemDAO()) { using (dao.DbConnection) { if (dao.DbConnection.IsConnected()) { using (dao.DbCommand) { tokens = dao.GetTokens(); foreach (KeyValuePair<Guid, DateTime> item in tokens) { if (item.Value.AddMinutes(AppVars.hostOptions.SessionTimeout) < DateTime.Now) { dao.RemoveToken(item.Key); } } } } } } }
public Boolean DoRemoveToken(Identification identification) { logger.Log(LogLevel.Trace, AppLib.GetCaller(logger)); using (SystemDAO dao = new SystemDAO()) { return dao.RemoveToken(identification.Token, identification.UserId); } }