コード例 #1
0
ファイル: ReportingForm.cs プロジェクト: js1987/openpetragit
        /// <summary>
        /// This can be used directly by external functions that need to generate
        /// a report without first showing the UI for it. See method CreateReportNoGui in AP_PaymentReport.ManualCode.cs
        /// </summary>
        /// <param name="ACalculator">This must be set up already</param>
        /// <param name="ACallerForm">Parent Form</param>
        /// <param name="AReportName"></param>
        /// <param name="AWrapColumn"></param>
        public static void GenerateReport(TRptCalculator ACalculator, Form ACallerForm, String AReportName, bool AWrapColumn)
        {
            try
            {
                if (ACalculator.GenerateResultRemoteClient())
                {
                    TMyUpdateDelegate myDelegate = @ReportCalculationSuccess;

                    if (ACallerForm.IsHandleCreated)
                    {
                        ACallerForm.Invoke((System.Delegate) new TMyUpdateDelegate(
                                myDelegate), new object[] { ACalculator, ACallerForm, AReportName, AWrapColumn });
                        TLogging.Log("", TLoggingType.ToStatusBar);
                    }
                    else
                    {
                        MessageBox.Show(
                            Catalog.GetString("Results cannot be shown because form was closed."),
                            Catalog.GetString("Generate Report"),
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception e)
            {
                {
                    MessageBox.Show(e.ToString());
                }
            }
        }
コード例 #2
0
ファイル: GridPreview.cs プロジェクト: Davincier/openpetra
        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);
            }
        }