/// <summary>
        /// Актуализируется ДЦ пользователя.
        /// </summary>
        public static bool CouldBeUpdatedByCurrentUser(
            string electroStationUniqueCode,
            DateTime operationDate,
            string currentUserLogin,
            IUserInfoService userInfoService,
            IDbContextProvider dbContextProvider)
        {
            ElectroStationVersion electroStation;

            using (var unitOfWork = new UnitOfWorkForRead(dbContextProvider))
            {
                electroStation = unitOfWork.ElectroStationVersion.FirstOrDefault(
                    electroStationUniqueCode,
                    operationDate);
            }

            if (electroStation == null)
            {
                throw new Exception();
            }

            UserInfo userInfo;

            if (!userInfoService.TryGetUserInfo(currentUserLogin, out userInfo, operationDate))
            {
                throw new Exception();
            }

            return(electroStation.ActualDispatchCenterUniqueCode == userInfo.DispatchCenter.UniqueCode);
        }
        /// <summary>
        /// Наименование электростанции.
        /// </summary>
        public static string GetName(
            string electroStationUniqueCode,
            DateTime operationDate,
            IDbContextProvider dbContextProvider)
        {
            ElectroStationVersion electroStation;

            using (var unitOfWork = new UnitOfWorkForRead(dbContextProvider))
            {
                electroStation = unitOfWork.ElectroStationVersion.FirstOrDefault(
                    electroStationUniqueCode,
                    operationDate);
            }

            if (electroStation == null)
            {
                throw new Exception();
            }

            return(electroStation.Name);
        }
        /// <summary>
        /// Есть ли блокировка отчетных суток.
        /// </summary>
        public static bool IsDayLockSetForParentDc(
            string electroStationUniqueCode,
            DateTime operationDate,
            IDbContextProvider dbContextProvider,
            IDispatchCenterDayStatusManager dayStatusManager)
        {
            ElectroStationVersion electroStation;

            using (var unitOfWork = new UnitOfWorkForRead(dbContextProvider))
            {
                electroStation = unitOfWork.ElectroStationVersion.FirstOrDefault(
                    electroStationUniqueCode,
                    operationDate);
            }

            if (electroStation == null)
            {
                throw new Exception();
            }

            DispatchCenterTotalDayStatus actualDcLockState =
                !string.IsNullOrWhiteSpace(electroStation.ActualDispatchCenterUniqueCode)
                    ? dayStatusManager.GetStatus(
                    electroStation.ActualDispatchCenterUniqueCode,
                    operationDate)
                    : null;
            DispatchCenterTotalDayStatus conductDcLockState =
                !string.IsNullOrWhiteSpace(electroStation.ConductDispatchCenterUniqueCode)
                    ? dayStatusManager.GetStatus(
                    electroStation.ConductDispatchCenterUniqueCode,
                    operationDate)
                    : null;

            return((actualDcLockState != null && (actualDcLockState.IsLocked || actualDcLockState.IsParentLocked)) ||
                   (conductDcLockState != null && (conductDcLockState.IsLocked || conductDcLockState.IsParentLocked)));
        }