/// <summary> /// Снять блокировку по ключу для указанного пользователя /// </summary> /// <param name="LockKey"> /// ключ блокировки /// </param> /// <param name="userName"> /// пользователь /// </param> /// <param name="ds"> /// Сервис данных /// </param> public void ClearWebLock(string LockKey, string userName, IDataService ds) { var ld = new LockData(); ld.LockKey = LockKey; ld.UserName = userName; try { ds.LoadObject(ld); ld.SetStatus(ObjectStatus.Deleted); DataObject dobj = ld; ds.UpdateObject(ref dobj); } catch { } }
/// <summary> /// Очистить блокировку /// </summary> /// <param name="LockKey"> /// </param> /// <param name="userName"> /// </param> public void ClearLock(string LockKey, string userName) { if (dataService == null) { throw new DataServiceNotFoundException(); } var ld = new LockData(); ld.LockKey = LockKey; ld.UserName = userName + (UseMachineNameInKey ? " @ " + Environment.MachineName : string.Empty); if (AllLocks.Contains(ld.CombinedKey())) { ld.SetStatus(ObjectStatus.Deleted); DataObject dobj = ld; dataService.UpdateObject(ref dobj); AllLocks.Remove(ld.CombinedKey()); } }