/// <summary> /// Добавить часовые данные в список /// </summary> private void AppendHourCnlData(List <HourCnlData> hourCnlDataList, double hour, IList <int> cnlList, SrezTableLight.Srez snapshot, DateTime snapshotDT, DateTime nowDT) { HourCnlData hourCnlData = new HourCnlData(hour); hourCnlData.Modified = true; string emptyVal; bool dataVisible = DataFormatter.HourDataVisible(snapshotDT, nowDT, snapshot != null, out emptyVal); hourCnlData.CnlDataExtArr = CreateCnlDataExtArr(cnlList, snapshot, dataVisible, emptyVal); hourCnlDataList.Add(hourCnlData); }
/// <summary> /// Обработать директиву, связанную со значением ячейки /// </summary> protected override void ProcVal(Cell cell, string valName) { string nodeText = null; if (valName == "Title") { nodeText = string.Format(TablePhrases.HourDataTitle, tableView.Title, date.ToLocalizedDateString(), WFrmTable.GetLocalizedHour(startHour) + " - " + WFrmTable.GetLocalizedHour(endHour)); } else if (valName == "Gen") { nodeText = TablePhrases.HourDataGen + genDT.ToLocalizedString(); } else if (valName == "ItemCol") { nodeText = TablePhrases.ItemCol; } else if (valName.StartsWith("H")) { // заголовок таблицы часовых данных if (int.TryParse(valName.Substring(1), out int hour)) { nodeText = WFrmTable.GetLocalizedHour(hour); } } else if (viewItem != null) { if (valName == "Name") { nodeText = viewItem.Caption; } else if (valName.StartsWith("h")) { // часовые данные if (int.TryParse(valName.Substring(1), out int hour)) { if (viewItem.CnlNum > 0 && startHour <= hour && hour <= endHour) { DateTime colDT = date.AddHours(hour); SrezTableLight hourTable = hour >= 0 ? reqDateHourTable : prevDateHourTable; hourTable.SrezList.TryGetValue(colDT, out SrezTableLight.Srez snapshot); if (dataFormatter.HourDataVisible(colDT, genDT, snapshot != null, out string emptyVal)) { // получение данных snapshot.GetCnlData(viewItem.CnlNum, out double val, out int stat); // форматирование данных dataFormatter.FormatCnlVal(val, stat, viewItem.CnlProps, ".", "", out string text, out string textWithUnit, out bool textIsNumber); string color = dataFormatter.GetCnlValColor(val, stat, viewItem.CnlProps, dataAccess.GetCnlStatProps(stat)); // вывод данных nodeText = text; workbook.SetColor(cell.Node, null, color); if (textIsNumber) { cell.SetNumberType(); } } else { nodeText = emptyVal; } } else { nodeText = ""; } } } } if (nodeText != null) { cell.DataNode.InnerText = nodeText; } }