Exemplo n.º 1
0
        public override IConfigService GetConfigFromUI()
        {
            ConsolePrintNet conf = new ConsolePrintNet
            {
                InstallDirectory  = cbPath.Text,
                OdbcDatasource    = cbOdbcDatasource.Text,
                DatabaseName      = tbDbName.Text,
                Basetype          = cbDatabaseType.Text,
                Login             = tbLogin.Text,
                Password          = tbPassword.Text,
                ReportFilename    = cbReportName.Text,
                ExportDirectory   = cbExportDirectory.Text,
                Action            = cbActions.Text,
                OutputFormat      = cbOutputFormat.Text,
                OpenGeneratedFile = cbOpenDocumentAfterGeneration.Checked
            };

            if (dgSettings.DataSource != null)
            {
                var fileList = dgSettings.DataSource as ConsolePrintNetParameter[];
                conf.Settings = fileList;
            }

            if (reportParametersGridView.DataSource != null)
            {
                var fileList = reportParametersGridView.DataSource as ConsolePrintNetParameter[];
                conf.Parameters = fileList;
            }
            return(conf);
        }
Exemplo n.º 2
0
        internal void LoadConfigFromJSON(string filename)
        {
            InitControls();

            linkOpenJson.Tag = filename;
            this.filename    = filename;
            ConsolePrintNet config = JsonConvert.DeserializeObject <ConsolePrintNet>(File.ReadAllText(filename));

            Helper.SetTextFromSettings(config.InstallDirectory, this.cbPath);
            Helper.SetTextFromSettings(config.OdbcDatasource, this.cbOdbcDatasource);
            Helper.SetTextFromSettings(config.DatabaseName, this.tbDbName);
            Helper.SetTextFromSettings(config.Basetype, this.cbDatabaseType);
            Helper.SetTextFromSettings(config.Login, this.tbLogin);
            Helper.SetTextFromSettings(config.Password, this.tbPassword);
            Helper.SetTextFromSettings(config.ReportFilename, this.cbReportName);
            Helper.SetTextFromSettings(config.ExportDirectory, this.cbExportDirectory);
            Helper.SetSafeComboBox(this.cbActions, SafeEnumParse(config.Action));
            Helper.SetSafeText(this.cbOutputFormat, config.OutputFormat);
            Helper.SetSafeCheck(this.cbOpenDocumentAfterGeneration, config.OpenGeneratedFile);

            if (config.Settings != null)
            {
                dgSettings.DataSource = config.Settings;
            }

            if (config.Parameters != null)
            {
                reportParametersGridView.DataSource = config.Parameters;
            }

            if (!configurationInfoInitialized && !GetConfigurationInfo())
            {
                string dirInstallPath = PrintServerHelper.GetPrintServerIntallPath();
                if (!string.IsNullOrEmpty(dirInstallPath))
                {
                    string adxSrvImp = Path.Combine(dirInstallPath, "AdxSrvImp.exe");
                    if (Directory.Exists(dirInstallPath) && File.Exists(adxSrvImp))
                    {
                        GetVersion(adxSrvImp, "/v");
                    }
                }
                else
                {
                    Logger.Log("Error: PrintServer IntallPath not found");
                }
                var subKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Crystal Reports");

                tbCRRuntime32Version.Text = $"{subKey.GetValue("CRRuntime32Version")}";

                foreach (string item in subKey.GetValueNames())
                {
                    tbSapCrystalReport.Text += $"{item}: {subKey.GetValue(item)} \r\n";
                }
                foreach (string item in subKey.GetSubKeyNames())
                {
                    tbSapCrystalReport.Text += $"{item} \r\n";
                }
                configurationInfoInitialized = true;
            }
        }
Exemplo n.º 3
0
 public override string GetDefaultWorkspaceFilename()
 {
     return(ConsolePrintNet.GetWorkspaceFilename());
 }