internal static bool AcquireLock(double timeframe)
{
Synchronization notificationLock;
using (var context = new DataHandler())
{
notificationLock = context.Synchronizations.SingleOrDefault(lockItem => lockItem.LockName == NOTIFICATIONLOCKNAME);
if (notificationLock == null)
return InsertLock(timeframe);
}
if (notificationLock.Locked && (notificationLock.LockId != AppDomainId) && notificationLock.LockedUntil > DateTime.Now)
return false;
return UpdateLock(notificationLock, timeframe);
}
internal static void RefreshLock(double timeframe)