Пример #1
0
        /// <summary>
        /// Instance this object and it changes the behaviour of the ReportForm UI to use FastReports if the DLL is installed.
        /// </summary>
        /// <param name="PetraUtilsObject"></param>
        public FastReportsWrapper(TFrmPetraReportingUtils PetraUtilsObject)
        {
            try
            {
                LoadedOK          = false;
                FDataGetter       = null;
                FPetraUtilsObject = PetraUtilsObject;

                if (!LoadDll())
                {
                    return;
                }

                FReportName = FPetraUtilsObject.FReportName;

                if (!LoadDefaultTemplate())
                {
                    return;
                }

                FPetraUtilsObject.DelegateGenerateReportOverride = GenerateReport;
                FPetraUtilsObject.DelegateViewReportOverride     = DesignReport;
                FPetraUtilsObject.DelegateCancelReportOverride   = CancelReportGeneration;

                FPetraUtilsObject.EnableDisableSettings(false);
                FInitState = TInitState.LoadedOK;
                LoadedOK   = true;
            }
            catch (Exception) // If there's no FastReports DLL, this object will do nothing.
            {
//              TLogging.Log("FastReports Wrapper Not loaded: " + e.Message);
            }
        }
Пример #2
0
        private Boolean LoadDll()
        {
            try
            {
                FInitState     = TInitState.LoadDll;
                FastReportsDll = Assembly.LoadFrom("FastReport.DLL"); // If there's no FastReports DLL, this will "fall at the first hurdle"!

                FInitState = TInitState.InitSystem;


                FfastReportInstance = FastReportsDll.CreateInstance("FastReport.Report");
                FFastReportType     = FfastReportInstance.GetType();
                FFastReportType.GetProperty("StoreInResources").SetValue(FfastReportInstance, false, null);

                //
                // I want to set the Utils.Config.EmailSettings
                // to our SMTP server settings.
                //
                object EmailSettings = FastReportsDll.GetType("FastReport.Utils.Config").GetProperty("EmailSettings").GetValue(null, null);

                Type EmailSettingsType = EmailSettings.GetType();
                EmailSettingsType.GetProperty("Host").SetValue(EmailSettings, "TimHost.com", null);
            }
            catch (Exception) // If there's no FastReports DLL, this object will do nothing.
            {
//              TLogging.Log("FastReports Wrapper Not loaded: " + e.Message);
                return(false);
            }
            return(true);
        }
Пример #3
0
        private Boolean LoadDefaultTemplate()
        {
            FInitState = TInitState.LoadTemplate;
            SReportTemplateTable TemplateTable = TRemote.MReporting.WebConnectors.GetTemplateVariants(FReportName,
                                                                                                      UserInfo.GUserInfo.UserID,
                                                                                                      true);

            if (TemplateTable.Rows.Count == 0)
            {
//              TLogging.Log("No FastReports template for " + FReportName);
                return(false);
            }

            SetTemplate(TemplateTable[0]);
            FInitState = TInitState.LoadedOK;
            return(true);
        }
Пример #4
0
        private Boolean LoadDefaultTemplate()
        {
            FInitState = TInitState.LoadTemplate;
            SReportTemplateTable TemplateTable = TRemote.MReporting.WebConnectors.GetTemplateVariants(FReportName,
                UserInfo.GUserInfo.UserID,
                true);

            if (TemplateTable.Rows.Count == 0)
            {
//              TLogging.Log("No FastReports template for " + FReportName);
                return false;
            }

            SetTemplate(TemplateTable[0]);
            FInitState = TInitState.LoadedOK;
            return true;
        }
Пример #5
0
        /// <summary>
        /// Instance this object and it changes the behaviour of the ReportForm UI to use FastReports if the DLL is installed.
        /// </summary>
        /// <param name="PetraUtilsObject"></param>
        public FastReportsWrapper(TFrmPetraReportingUtils PetraUtilsObject)
        {
            try
            {
                LoadedOK = false;
                FDataGetter = null;
                FPetraUtilsObject = PetraUtilsObject;

                if (!LoadDll())
                {
                    return;
                }

                FReportName = FPetraUtilsObject.FReportName;

                if (!LoadDefaultTemplate())
                {
                    return;
                }

                FPetraUtilsObject.DelegateGenerateReportOverride = GenerateReport;
                FPetraUtilsObject.DelegateViewReportOverride = DesignReport;
                FPetraUtilsObject.DelegateCancelReportOverride = CancelReportGeneration;

                FPetraUtilsObject.EnableDisableSettings(false);
                FInitState = TInitState.LoadedOK;
                LoadedOK = true;
            }
            catch (Exception) // If there's no FastReports DLL, this object will do nothing.
            {
//              TLogging.Log("FastReports Wrapper Not loaded: " + e.Message);
            }
        }
Пример #6
0
        private Boolean LoadDll()
        {
            try
            {
                FInitState = TInitState.LoadDll;
                FastReportsDll = Assembly.LoadFrom("FastReport.DLL"); // If there's no FastReports DLL, this will "fall at the first hurdle"!

                FInitState = TInitState.InitSystem;


                FfastReportInstance = FastReportsDll.CreateInstance("FastReport.Report");
                FFastReportType = FfastReportInstance.GetType();
                FFastReportType.GetProperty("StoreInResources").SetValue(FfastReportInstance, false, null);

                //
                // I want to set the Utils.Config.EmailSettings
                // to our SMTP server settings.
                //
                object EmailSettings = FastReportsDll.GetType("FastReport.Utils.Config").GetProperty("EmailSettings").GetValue(null, null);

                Type EmailSettingsType = EmailSettings.GetType();
                EmailSettingsType.GetProperty("Host").SetValue(EmailSettings, "TimHost.com", null);
            }
            catch (Exception) // If there's no FastReports DLL, this object will do nothing.
            {
//              TLogging.Log("FastReports Wrapper Not loaded: " + e.Message);
                return false;
            }
            return true;
        }