private void GenerateReport() { try { FPreviewForm.Cursor = Cursors.WaitCursor; TLogging.SetStatusBarProcedure(FPetraUtilsObject.WriteToStatusBar); // calculate the report FCalculator = new TRptCalculator(); FCalculator.GetParameters().LoadFromDataTable(FDetailParameters.ToDataTable()); if (FCalculator.GenerateResultRemoteClient()) { if (TClientSettings.DebugLevel >= TClientSettings.DEBUGLEVEL_REPORTINGDATA) { FCalculator.GetParameters().Save(TClientSettings.PathLog + Path.DirectorySeparatorChar + "debugParameterReturn.xml", true); FCalculator.GetResults().WriteCSV( FCalculator.GetParameters(), TClientSettings.PathLog + Path.DirectorySeparatorChar + "debugResultReturn.csv"); } FPreviewForm.Cursor = Cursors.Default; object[] Args = new object[1]; Args[0] = FCalculator; FPreviewForm.Invoke((System.Delegate) new TPreviewDelegate(FPreviewDelegate), Args); TLogging.Log("", TLoggingType.ToStatusBar); } else { // if generateResult failed FPreviewForm.Cursor = Cursors.Default; // EnableDisableToolbar(true); } } catch (Exception e) { TLogging.Log("Exception in GenerateReport: " + e.ToString()); // EnableDisableToolbar(true); } }
/// <summary> /// ... /// </summary> public void TestDetailReport(String ATestPath, String ASettingsPath) { String detailReportCSV; String action; String query; String paramName; String paramValue; int SelectedRow; int columnCounter; detailReportCSV = FCalculator.GetParameters().Get("param_detail_report_0").ToString(); TLogging.Log("detail report: " + StringHelper.GetNextCSV(ref detailReportCSV, ",")); action = StringHelper.GetNextCSV(ref detailReportCSV, ","); if (action == "PartnerEditScreen") { /* get the partner key from the parameter */ SelectedRow = 1; if (FCalculator.GetResults().GetResults().Count > 0) { TResult row = (TResult)FCalculator.GetResults().GetResults()[SelectedRow]; Console.WriteLine("detailReportCSV " + detailReportCSV.ToString()); Console.WriteLine(FCalculator.GetResults().GetResults().Count.ToString()); if (row.column.Length > 0) { TLogging.Log("Open Partner Edit Screen for partner " + row.column[Convert.ToInt32(detailReportCSV)].ToString()); } } } else if (action.IndexOf(".xml") != -1) { query = StringHelper.GetNextCSV(ref detailReportCSV, ","); FCalculator.GetParameters().Add("param_whereSQL", query); /* get the parameter names and values */ while (detailReportCSV.Length > 0) { paramName = StringHelper.GetNextCSV(ref detailReportCSV, ","); paramValue = StringHelper.GetNextCSV(ref detailReportCSV, ","); FCalculator.GetParameters().Add(paramName, paramValue); } /* add the values of the selected column (in this example the first one) */ SelectedRow = 1; for (columnCounter = 0; columnCounter <= FCalculator.GetParameters().Get("MaxDisplayColumns").ToInt32() - 1; columnCounter += 1) { FCalculator.GetParameters().Add("param_" + FCalculator.GetParameters().Get("param_calculation", columnCounter).ToString(), ((TResult)FCalculator.GetResults().GetResults()[SelectedRow]).column[columnCounter]); } /* action is a link to a settings file; it contains e.g. xmlfiles, currentReport, and column settings */ /* TParameterList.Load adds the new parameters to the existing parameters */ FCalculator.GetParameters().Load(ASettingsPath + '/' + action); if (FCalculator.GenerateResultRemoteClient()) { FCalculator.GetParameters().Save(ATestPath + "LogParametersAfterCalcDetail.log", true); FCalculator.GetResults().WriteCSV(FCalculator.GetParameters(), ATestPath + "LogResultsDetail.log", "FIND_BEST_SEPARATOR", true); /* test if there is a detail report */ if (FCalculator.GetParameters().Exists("param_detail_report_0") == true) { TestDetailReport(ATestPath, ASettingsPath); } } } }