/// <summary> /// Расчетная блокировка станции на дату. /// </summary> /// <returns></returns> public static bool IsOperationLockSet( string electroStationUniqueCode, DateTime operationDate, ElectroStationLocksManager locksManager) { var electroStations = new[] { new ElectroStationAndDataKey( electroStationUniqueCode, LocalDateTime.FromDateTime(operationDate).Date) }; ElectroStationLock[] locks; using (locksManager.GetCriticalSection()) { locks = locksManager.GetLocks(electroStations).ToArray(); } return(locks.Any() && locks.Single().OperationLockTime != null); }
/// <summary> /// Установлена ли блокировка на редактирование другим пользователем. /// </summary> public static bool IsLockedByAnotherUserForEdit( string electroStationUniqueCode, DateTime operationDate, string currentUserLogin, ElectroStationLocksManager locksManager) { var electroStations = new[] { new ElectroStationAndDataKey( electroStationUniqueCode, LocalDateTime.FromDateTime(operationDate).Date) }; ElectroStationLock[] locks; using (locksManager.GetCriticalSection()) { locks = locksManager.GetLocks(electroStations).ToArray(); } return(locks.Any() && locks.Single().UserLogin != currentUserLogin && locks.Single().EditLockTime != null); }