protected override void GenerateDataList() { IList <PointKeyValue> dataList = this.device.tempList; TableLayoutPanel dataListTable = null; int columnIndex = 0; int cellContentSectionWidth = (DefaultSectionWidth - 4) / 3; int cellDataCount = 100; int columnPerPage = 4; int dataPerPage = cellDataCount * columnPerPage; SectionControl cellContentSection = null; SectionControl tableHearderSection = null; dataListTable = this.CreateDataListTableLayoutPanel(true); dataListTable.Top = this.currentSectionTop + sectionMargin * 2; for (int i = 0; i < Math.Min((cellDataCount - this.rowsInfectedBySignature) * columnPerPage, this.device.tempList.Count); i++) { if (i % (cellDataCount - this.rowsInfectedBySignature) == 0) { if (cellContentSection != null) { dataListTable.SetCellPosition(tableHearderSection, new TableLayoutPanelCellPosition(columnIndex, 0)); dataListTable.SetCellPosition(cellContentSection, new TableLayoutPanelCellPosition(columnIndex, 1)); tableHearderSection.InitializeLayout(dataListTableColumnWidthsLayout); cellContentSection.InitializeLayout(dataListTableColumnWidthsLayout); } tableHearderSection = new SectionControl(false); cellContentSection = new SectionControl(false); cellContentSection.IsDataListContentSection = true; dataListTable.Controls.Add(cellContentSection); dataListTable.Controls.Add(tableHearderSection); tableHearderSection.Width = cellContentSectionWidth; cellContentSection.Width = cellContentSectionWidth; cellContentSection.IsContentWithSmallFont = true; tableHearderSection.IsContentWithSmallFont = true; tableHearderSection.HorizonalTextAlignment = ContentAlignment.MiddleCenter; cellContentSection.HorizonalTextAlignment = ContentAlignment.MiddleCenter; cellContentSection.IsBorderShown = false; tableHearderSection.IsBorderShown = false; tableHearderSection.DefaultRowHeight = 16; cellContentSection.DefaultRowHeight = 11.2f; tableHearderSection.SetHeader(new string[] { "Date", "Time", unit }); columnIndex = (i / (cellDataCount - this.rowsInfectedBySignature)) % columnPerPage; } cellContentSection.AddRow(new string[] { TempsenFormatHelper.GetFormattedDate(dataList[i].PointTime.ToLocalTime()), TempsenFormatHelper.GetFormattedTime(dataList[i].PointTime.ToLocalTime()), TempsenFormatHelper.GetFormattedTemperature(dataList[i].PointTemp), dataList[i].IsMark.ToString() }); if (i == Math.Min((cellDataCount - this.rowsInfectedBySignature) * columnPerPage, this.device.tempList.Count) - 1) { dataListTable.SetCellPosition(tableHearderSection, new TableLayoutPanelCellPosition(columnIndex, 0)); dataListTable.SetCellPosition(cellContentSection, new TableLayoutPanelCellPosition(columnIndex, 1)); tableHearderSection.InitializeLayout(dataListTableColumnWidthsLayout); cellContentSection.InitializeLayout(dataListTableColumnWidthsLayout); this.AddSection(dataListTable); this.GenerateReportFooter(); cellContentSection = null; dataListTable = null; } } for (int i = (cellDataCount - this.rowsInfectedBySignature) * columnPerPage; i < device.tempList.Count; i++) { int j = i - ((cellDataCount - this.rowsInfectedBySignature) * columnPerPage); if (j % dataPerPage == 0) { if (dataListTable != null) { this.AddSection(dataListTable); } dataListTable = this.CreateDataListTableLayoutPanel(); } if (j % cellDataCount == 0) { if (cellContentSection != null) { dataListTable.SetCellPosition(tableHearderSection, new TableLayoutPanelCellPosition(columnIndex, 0)); dataListTable.SetCellPosition(cellContentSection, new TableLayoutPanelCellPosition(columnIndex, 1)); tableHearderSection.InitializeLayout(dataListTableColumnWidthsLayout); cellContentSection.InitializeLayout(dataListTableColumnWidthsLayout); } tableHearderSection = new SectionControl(false); cellContentSection = new SectionControl(false); cellContentSection.IsDataListContentSection = true; dataListTable.Controls.Add(cellContentSection); dataListTable.Controls.Add(tableHearderSection); tableHearderSection.Width = cellContentSectionWidth; cellContentSection.Width = cellContentSectionWidth; cellContentSection.IsContentWithSmallFont = true; tableHearderSection.IsContentWithSmallFont = true; tableHearderSection.HorizonalTextAlignment = ContentAlignment.MiddleCenter; cellContentSection.HorizonalTextAlignment = ContentAlignment.MiddleCenter; cellContentSection.IsBorderShown = false; tableHearderSection.IsBorderShown = false; tableHearderSection.DefaultRowHeight = 16; cellContentSection.DefaultRowHeight = 11.2f; tableHearderSection.SetHeader(new string[] { "Date", "Time", unit }); columnIndex = (j / cellDataCount) % 4; } cellContentSection.AddRow(new string[] { TempsenFormatHelper.GetFormattedDate(dataList[i].PointTime.ToLocalTime()), TempsenFormatHelper.GetFormattedTime(dataList[i].PointTime.ToLocalTime()), TempsenFormatHelper.GetFormattedTemperature(dataList[i].PointTemp), dataList[i].IsMark.ToString() }); if (i == device.tempList.Count - 1) { dataListTable.SetCellPosition(tableHearderSection, new TableLayoutPanelCellPosition(columnIndex, 0)); dataListTable.SetCellPosition(cellContentSection, new TableLayoutPanelCellPosition(columnIndex, 1)); tableHearderSection.InitializeLayout(dataListTableColumnWidthsLayout); cellContentSection.InitializeLayout(dataListTableColumnWidthsLayout); this.AddSection(dataListTable); this.GenerateReportFooter(); } } }
protected override void GenerateAlarms() { SectionControl sectionAlarm = new SectionControl(); sectionAlarm.HorizonalTextAlignment = ContentAlignment.MiddleCenter; sectionAlarm.Width = DefaultSectionWidth; sectionAlarm.SetSectionTitle(this.reportdataGenerator.GetAlarmSectionTitle(this.device)); IDictionary <string, string[]> alarmDataContents = this.reportdataGenerator.GetAlarmRowContents(this.device); string[] highRowContents = alarmDataContents["highRowContents"]; string[] lowRowContents = alarmDataContents["lowRowContents"]; string[] a1RowContents = alarmDataContents["a1RowContents"]; string[] a2RowContents = alarmDataContents["a2RowContents"]; string[] a3RowContents = alarmDataContents["a3RowContents"]; string[] a4RowContents = alarmDataContents["a4RowContents"]; string[] a5RowContents = alarmDataContents["a5RowContents"]; string[] a6RowContents = alarmDataContents["a6RowContents"]; int totalRows = 6; if (this.device.AlarmMode == 0) { // nothing to do } else if (device.AlarmMode == 1) { sectionAlarm.SetHeader(new string[] { "Alarm Zones", "Alarm Delay", "Total Time", "Events", "First Triggered", "Alarm Status" }); if (reportdataGenerator.IsStringArrayNotEmpty(highRowContents)) { sectionAlarm.AddRow(highRowContents); totalRows--; } if (reportdataGenerator.IsStringArrayNotEmpty(lowRowContents)) { sectionAlarm.AddRow(lowRowContents); totalRows--; } } else if (device.AlarmMode == 2) { sectionAlarm.SetHeader(new string[] { "Alarm Zones", "Alarm Delay", "Total Time", "Events", "First Triggered", "Alarm Status" }); if (reportdataGenerator.IsStringArrayNotEmpty(a1RowContents)) { sectionAlarm.AddRow(a1RowContents); totalRows--; } if (reportdataGenerator.IsStringArrayNotEmpty(a2RowContents)) { sectionAlarm.AddRow(a2RowContents); totalRows--; } if (reportdataGenerator.IsStringArrayNotEmpty(a3RowContents)) { sectionAlarm.AddRow(a3RowContents); totalRows--; } if (reportdataGenerator.IsStringArrayNotEmpty(a4RowContents)) { sectionAlarm.AddRow(a4RowContents); totalRows--; } if (reportdataGenerator.IsStringArrayNotEmpty(a5RowContents)) { sectionAlarm.AddRow(a5RowContents); totalRows--; } if (reportdataGenerator.IsStringArrayNotEmpty(a6RowContents)) { sectionAlarm.AddRow(a6RowContents); totalRows--; } } for (int i = 0; i < totalRows; i++) { sectionAlarm.AddRow(new string[6]); } sectionAlarm.InitializeLayout(new float[] { 0.18f, 0.19f, 0.17f, 0.10f, 0.23f, 0.13f }, new ContentAlignment[] { ContentAlignment.MiddleLeft, ContentAlignment.MiddleLeft, ContentAlignment.MiddleLeft, ContentAlignment.MiddleLeft, ContentAlignment.MiddleLeft, ContentAlignment.MiddleRight }); this.AddSection(sectionAlarm); }