public MonitoringClientFactory(DateTime dtStart, DateTime dtEnd, double?maxValue, bool isConcentratorsEnabled, bool isMetersEnabled, List <int> selectedEvents, List <byte> selectedСhannels, VALUES_FLAG_DB?filterFlag, CancellationToken cancellationToken, ProgressBarButton progressBar, Action <TStatisticInformation> showTotalStatistic, Guid waiterId, MonitoringDBSupport monitoringDBResult, ModuleType типМодуля) { DtStart = dtStart; DtEnd = dtEnd; _maxValue = maxValue; IsConcentratorsEnabled = isConcentratorsEnabled; IsMetersEnabled = isMetersEnabled; _selectedEvents = selectedEvents; _selectedСhannels = selectedСhannels; _filterFlag = filterFlag; _cancellationToken = cancellationToken; _rowsComparer = new TMonitoringAnalyseRowEqualityComparer(); MonitoringAnalyseDict = MakeMonitoringSource(monitoringDBResult, типМодуля); _progressBar = progressBar; _showTotalStatistic = showTotalStatistic; _waiterId = waiterId; _progressBar.SetIndeterminat(true); }
/// <summary> /// Отсортировываем все ПУ по своим родителям /// </summary> /// <param name="monitoringDBResult">Плоский результат запроса в БД</param> /// <param name="типМодуля">Тип модуля</param> /// <returns>Источник данных для формы анализа мониторинга</returns> private Dictionary <MonitoringObjectKey, TMonitoringAnalyseRow> MakeMonitoringSource(MonitoringDBSupport monitoringDBResult, ModuleType типМодуля) { var result = new HashSet <TMonitoringAnalyseRow>(_rowsComparer); //Наполняем УСПД, Е422 и 61968, концентраторы if (типМодуля == ModuleType.MonitoringAutoSbor) { //Добавляем УСПД if (monitoringDBResult.MonitoringAnalyseUSPD != null) { result.UnionWith(monitoringDBResult.MonitoringAnalyseUSPD.ToRow(enumTypeParrentMonitoringHierarchy.USPD, null)); } //Добавляем Е422 if (monitoringDBResult.MonitoringAnalyseE422 != null) { result.UnionWith(monitoringDBResult.MonitoringAnalyseE422.ToRow(enumTypeParrentMonitoringHierarchy.E422, monitoringDBResult.MonitoringAnalyseConcentrator)); } } else { if (monitoringDBResult.MonitoringAnalyse61968 != null) { result.UnionWith(monitoringDBResult.MonitoringAnalyse61968.ToRow()); } } return(result.ToDictionary(k => k.ID, v => v, new MonitoringObjectKeyEqualityComparer())); }