/// <summary> /// Konstruktor pro prejmuti parametru simulace /// </summary> /// <param name="ainfo"></param> /// <param name="spar"></param> /// <param name="sres"></param> public SimulationReport(List <AlgorithmInfo> ainfo, SimulationParams spar, List <SimulationResult> sres) { sparams = spar; sresult = sres; alginfo = ainfo; }
private uint SenateInfoExport(SimulationParams spar, SheetData sheetData, uint last_row_index) { uint index_senate_row = last_row_index; Row title_senate_row = new Row() { RowIndex = index_senate_row, Spans = new ListValue <StringValue>() }; Cell title_cell = new Cell() { CellReference = "A" + index_senate_row.ToString(), DataType = CellValues.String, StyleIndex = (UInt32Value)4U, CellValue = new CellValue("Senát ID") }; title_senate_row.Append(title_cell); title_cell = new Cell() { CellReference = "B" + index_senate_row.ToString(), DataType = CellValues.String, StyleIndex = (UInt32Value)4U, CellValue = new CellValue("Zatížení v %") }; title_senate_row.Append(title_cell); title_cell = new Cell() { CellReference = "C" + index_senate_row.ToString(), DataType = CellValues.String, StyleIndex = (UInt32Value)4U, CellValue = new CellValue("Aktivní Př.") }; title_senate_row.Append(title_cell); title_cell = new Cell() { CellReference = "D" + index_senate_row.ToString(), DataType = CellValues.String, StyleIndex = (UInt32Value)4U, CellValue = new CellValue("Povolen") }; title_senate_row.Append(title_cell); sheetData.Append(title_senate_row); index_senate_row++; foreach (var senate in spar.Senates) { Row senate_row = new Row() { RowIndex = index_senate_row, Spans = new ListValue <StringValue>() }; Cell cell = new Cell() { CellReference = "A" + index_senate_row.ToString(), DataType = CellValues.String, StyleIndex = (UInt32Value)6U, CellValue = new CellValue(senate.ID) }; senate_row.Append(cell); cell = new Cell() { CellReference = "B" + index_senate_row.ToString(), DataType = CellValues.Number, StyleIndex = (UInt32Value)6U, CellValue = new CellValue(Convert.ToString(senate.Load)) }; senate_row.Append(cell); cell = new Cell() { CellReference = "C" + index_senate_row.ToString(), DataType = CellValues.Number, StyleIndex = (UInt32Value)6U, CellValue = new CellValue(Convert.ToString(senate.ActiveCases)) }; senate_row.Append(cell); cell = new Cell() { CellReference = "D" + index_senate_row.ToString(), DataType = CellValues.String, StyleIndex = (UInt32Value)6U, CellValue = new CellValue(((senate.Enabled) ? "ANO" : "NE")) }; senate_row.Append(cell); sheetData.Append(senate_row); index_senate_row++; } return(index_senate_row); }
private void SimulationParamsExport(List <AlgorithmInfo> ainfo, SimulationParams spar, SimulationResult result, SheetData sheetData) { Row title_row = new Row() { RowIndex = 1U, Spans = new ListValue <StringValue>() }; //KUB 6.3. pridano var alg_name = ConvertAlgorithmName((from a in alginfo where a.AlgorithmID == result.UsedAlgorithm.ToString() select a.AlgorithmName).First()); Cell cell = new Cell() { CellReference = "A1", DataType = CellValues.String, StyleIndex = (UInt32Value)1U, CellValue = new CellValue(alg_name /*info[result.UsedAlgorithm].AlgorithmName.Replace(":", " ") // KUB 6.3. vyjmuto a opraveno*/) }; title_row.Append(cell); cell = new Cell() { CellReference = "C1", DataType = CellValues.String, StyleIndex = (UInt32Value)5U, CellValue = new CellValue("Uživatel:" + spar.User.ID) }; title_row.Append(cell); cell = new Cell() { CellReference = "D1", DataType = CellValues.String, StyleIndex = (UInt32Value)5U, CellValue = new CellValue(DateTime.Now.ToString()) }; title_row.Append(cell); sheetData.Append(title_row); Row param_row = new Row() { RowIndex = 3U, Spans = new ListValue <StringValue>() }; cell = new Cell() { CellReference = "A3", DataType = CellValues.String, StyleIndex = (UInt32Value)1U, CellValue = new CellValue("Parametry simulace:") }; param_row.Append(cell); cell = new Cell() { CellReference = "C3", DataType = CellValues.String, StyleIndex = (UInt32Value)5U, CellValue = new CellValue("Počet senátů: " + spar.Senates.Count) }; param_row.Append(cell); cell = new Cell() { CellReference = "E3", DataType = CellValues.String, StyleIndex = (UInt32Value)5U, CellValue = new CellValue("Počet případů: " + spar.CasesToDistribution) }; param_row.Append(cell); cell = new Cell() { CellReference = "G3", DataType = CellValues.String, StyleIndex = (UInt32Value)5U, CellValue = new CellValue("Počet iterací: " + spar.IterationsCount) }; param_row.Append(cell); sheetData.Append(param_row); }
private uint SimulationResultsExport(SimulationParams spar, SimulationResult result, SheetData sheetData, uint last_row_index) { Row title_senate_row = new Row() { RowIndex = last_row_index, Spans = new ListValue <StringValue>() }; Cell title_cell = new Cell() { CellReference = "A" + last_row_index, DataType = CellValues.String, StyleIndex = (UInt32Value)4U, CellValue = new CellValue("Iterace") }; title_senate_row.Append(title_cell); uint senate_column_index = 2; foreach (var s in spar.Senates) { string cellname = GetExcelColumnName(senate_column_index); title_cell = new Cell() { CellReference = cellname + last_row_index, //zacne od B DataType = CellValues.String, StyleIndex = (UInt32Value)4U, CellValue = new CellValue(s.ID) }; senate_column_index++; title_senate_row.Append(title_cell); } sheetData.Append(title_senate_row); last_row_index++;//posun se na dalsi radek int iter_counter = 1; foreach (var iter_data in result.Data)//pro kazdou iteraci { Row data_senate_row = new Row() { RowIndex = last_row_index, Spans = new ListValue <StringValue>() }; Cell data_cell = new Cell() { CellReference = "A" + last_row_index, DataType = CellValues.Number, StyleIndex = (UInt32Value)6U, CellValue = new CellValue(Convert.ToString(iter_counter++)) }; data_senate_row.Append(data_cell); senate_column_index = 2; foreach (var item in iter_data) { string cellname = GetExcelColumnName(senate_column_index); data_cell = new Cell() { CellReference = cellname + last_row_index, //zacne od B DataType = CellValues.Number, StyleIndex = (UInt32Value)6U, CellValue = new CellValue(Convert.ToString(item)) }; senate_column_index++; data_senate_row.Append(data_cell); } sheetData.Append(data_senate_row); last_row_index++; } return(last_row_index); }