private double CreateTimingTable(double verticalMillimeters)
        {
            List <dynamic> columns = new List <dynamic>()
            {
                new { Name = "Time", Column = "Time", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .1 },
                new { Name = "Line", Column = "LineName", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .2 },
                new { Name = "Phase", Column = "Phase", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .1 },
                new { Name = "Timing (br)", Column = "BreakerTiming", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .1 },
                new { Name = "Timing (wf)", Column = "WaveformTiming", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .1 },
                new { Name = "Timing (sp)", Column = "StatusTiming", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .1 },
                new { Name = "Classification", Column = "OperationTiming", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .1 },
                new { Name = "Prefault Current", Column = "PrefaultCurrent", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .1 },
                new { Name = "Max Current", Column = "MaxCurrent", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .1 },
            };

            if (TimingDataTable.Rows.Count == 0)
            {
                verticalMillimeters += InsertItalicText(verticalMillimeters, $"   No Breaker Operations during {StartTime.ToString("MM/dd/yyyy")} - {EndTime.ToString("MM/dd/yyyy")}");
                return(verticalMillimeters);
            }

            FontProp headerProp = new FontProp(FontDefinition, 0);

            headerProp.rSizePoint = 10.0D;
            using (TableLayoutManager tlm = new TableLayoutManager(headerProp))
            {
                FontProp textProp = new FontProp(FontDefinition, 0);
                textProp.rSizePoint                       = 8.0D;
                tlm.tlmCellDef_Header.rAlignV             = RepObj.rAlignCenter;                      // set vertical alignment of all header cells
                tlm.tlmCellDef_Default.penProp_LineBottom = new PenProp(this, 0.05, Color.LightGray); // set bottom line for all cells
                tlm.tlmHeightMode  = TlmHeightMode.AdjustLast;
                tlm.eNewContainer += (oSender, ea) =>
                {
                    verticalMillimeters += tlm.rCurY_MM;
                    verticalMillimeters  = NextTablePage(verticalMillimeters, ea);
                };


                // define columns
                foreach (var column in columns)
                {
                    new TlmColumnMM(tlm, column.Name, column.Width);
                }


                foreach (DataRow row in TimingDataTable.Rows)
                {
                    tlm.NewRow();
                    int index = 0;
                    foreach (var column in columns)
                    {
                        if (column.Column == "Time")
                        {
                            string date = DateTime.Parse(row[column.Column].ToString()).ToString("MM/dd/yyyy");
                            string time = DateTime.Parse(row[column.Column].ToString()).ToString("HH:mm:ss");
                            tlm.Add(index, new RepString(textProp, date));
                            tlm.NewLine(index);
                            tlm.Add(index++, new RepString(textProp, time));
                        }
                        else if (column.Column == "LineName")
                        {
                            AddDataColumn(tlm, index++, row[column.Column].ToString(), textProp, column.Width);
                        }
                        else
                        {
                            tlm.Add(index++, new RepString(textProp, row[column.Column].ToString()));
                        }
                    }
                }

                tlm.Commit();

                verticalMillimeters += tlm.rCurY_MM + 10;
            }

            return(verticalMillimeters);
        }
Пример #2
0
        private double CreateTable(double verticalMillimeters)
        {
            if (DataTable.Rows.Count == 0)
            {
                verticalMillimeters += InsertItalicText(verticalMillimeters, $"   No Breaker Operations during {StartTime.ToString("MM/dd/yyyy")} - {EndTime.ToString("MM/dd/yyyy")}");
                return(verticalMillimeters);
            }

            FontProp headerProp = new FontProp(FontDefinition, 0);

            headerProp.rSizePoint = 7.0D;
            using (TableLayoutManager tlm = new TableLayoutManager(headerProp))
            {
                tlm.tlmCellDef_Header.rAlignV             = RepObj.rAlignCenter;                      // set vertical alignment of all header cells
                tlm.tlmCellDef_Default.penProp_LineBottom = new PenProp(this, 0.05, Color.LightGray); // set bottom line for all cells
                tlm.tlmHeightMode  = TlmHeightMode.AdjustLast;
                tlm.eNewContainer += (oSender, ea) =>
                {
                    verticalMillimeters += tlm.rCurY_MM;
                    verticalMillimeters  = NextTablePage(verticalMillimeters, ea);
                };

                List <dynamic> columns = new List <dynamic>()
                {
                    new { Name = "Last Op", Column = "LastOperationDate", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .05 },
                    new { Name = "Breaker", Column = "BreakerNumber", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .04 },
                    new { Name = "# of Ops", Column = "Total", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .04 },
                    new { Name = "Asset", Column = "AssetNum", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .05 },
                    new { Name = "Line", Column = "LineName", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .10 },
                    new { Name = "Phase", Column = "LastPhase", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .04 },
                    new { Name = "Timing (wf)", Column = "LastWaveformTiming", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .05 },
                    new { Name = "Timing (sb)", Column = "LastStatusTiming", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .05 },
                    new { Name = "MFR Speed", Column = "MfrSpeed", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .04 },
                    new { Name = "Operation Timing", Column = "OperationTiming", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .06 },
                    new { Name = "Method", Column = "LastMethod", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .05 },
                    new { Name = "# Late", Column = "TotalLateOperation", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .03 },
                    new { Name = "Last Late", Column = "LastLateOperation", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .05 },
                    new { Name = "MFR", Column = "Manufacturer", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .07 },
                    new { Name = "Serial #", Column = "SerialNum", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .08 },
                    new { Name = "MFR Year", Column = "MfrYear", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .04 },
                    new { Name = "Model #", Column = "ModelNum", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .07 },
                    new { Name = "ICR (A)", Column = "InterruptCurrentRating", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .05 },
                    new { Name = "CAR (A)", Column = "ContinuousAmpRating", Width = (PageWidthMillimeters - 2 * PageMarginMillimeters) * .05 }
                };

                foreach (var column in columns)
                {
                    new TlmColumnMM(tlm, column.Name, column.Width);
                }

                List <string> centeredCols = new List <string>()
                {
                    "Total", "BreakerNumber", "AssetNum", "LastPhase"
                };
                foreach (DataRow row in DataTable.Rows)
                {
                    tlm.NewRow();
                    int index = 0;
                    foreach (var column in columns)
                    {
                        if (column.Column == "LastOperationDate" || (column.Column == "LastLateOperation" && row[column.Column].ToString() != string.Empty))
                        {
                            FontProp textProp = new FontProp(FontDefinition, 0);
                            textProp.rSizePoint = 6.0D;
                            string date = DateTime.Parse(row[column.Column].ToString()).ToString("MM/dd/yyyy");
                            string time = DateTime.Parse(row[column.Column].ToString()).ToString("HH:mm:ss");
                            tlm.Add(index, new RepString(textProp, date));
                            tlm.NewLine(index);
                            tlm.Add(index++, new RepString(textProp, time));
                        }
                        else
                        {
                            FontProp textProp = new FontProp(FontDefinition, 0);
                            textProp.rSizePoint = 6.0D;
                            string value = "";

                            value = row[column.Column].ToString();
                            RepString repObj = new RepString(textProp, value);
                            if (centeredCols.Contains(column.Column))
                            {
                                repObj.rAlignH = RepObj.rAlignCenter;
                            }

                            AddDataColumn(tlm, index, value, textProp, column.Width);
                            index++;
                        }
                    }
                }

                tlm.Commit();

                verticalMillimeters += tlm.rCurY_MM + 10;
            }

            return(verticalMillimeters);
        }