public IndividualBreakerReport(string breakerId, DateTime startTime, DateTime endTime) { StartTime = startTime; EndTime = endTime; BreakerID = breakerId; FontDefinition = new FontDef(this, "Helvetica"); using (AdoDataConnection connection = new AdoDataConnection("systemSettings")) { #if DEBUG TimingDataTable = connection.RetrieveData(testTimingQuery, breakerId, startTime, endTime); #else TimingDataTable = connection.RetrieveData(timingQuery, breakerId, startTime, endTime); #endif TimingPoints = TimingDataTable.Select().Select(x => { double r; bool s = double.TryParse(x["BreakerTiming"].ToString(), out r); return(new Point { Time = DateTime.Parse(x["Time"].ToString()), Value = (s ? (double?)r : null) }); }).OrderBy(x => x.Time).ToList(); MaxCurrentPoints = TimingDataTable.Select().Select(x => { double r; bool s = double.TryParse(x["MaxCurrent"].ToString(), out r); return(new Point { Time = DateTime.Parse(x["Time"].ToString()), Value = (s ? (double?)r : null) }); }).OrderBy(x => x.Time).ToList(); #if DEBUG InfoDataTable = connection.RetrieveData(testInfoQuery, breakerId, startTime, endTime); #else InfoDataTable = connection.RetrieveData(infoQuery, breakerId, startTime, endTime); #endif double result; bool success = double.TryParse(InfoDataTable.Select().FirstOrDefault()?["Breaker Mfr Speed"].ToString(), out result); Speed = (success ? (double?)result : null); success = double.TryParse(InfoDataTable.Select().FirstOrDefault()?["Speed Bandwidth"].ToString(), out result); SpeedBandwidth = (success ? (double?)result : null); success = double.TryParse(InfoDataTable.Select().FirstOrDefault()?["Interrupt Current Rating (A)"].ToString(), out result); InterruptCurrentRating = (success ? (double?)result : null); } }
private double CreateInfoTable(double verticalMillimeters) { if (InfoDataTable.Rows.Count == 0) { verticalMillimeters += InsertItalicText(verticalMillimeters, $" No Breaker Information available."); 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); }; new TlmColumnMM(tlm, "Breaker Info", (PageWidthMillimeters - 2 * PageMarginMillimeters) * .5); new TlmColumnMM(tlm, "Value", (PageWidthMillimeters - 2 * PageMarginMillimeters) * .5); DataRow dataRow = InfoDataTable.Select().First(); foreach (DataColumn column in InfoDataTable.Columns) { tlm.NewRow(); tlm.Add(0, new RepString(textProp, column.ColumnName)); tlm.Add(1, new RepString(textProp, dataRow[column.ColumnName].ToString())); } tlm.Commit(); verticalMillimeters += tlm.rCurY_MM + 10; } return(verticalMillimeters); }