Esempio n. 1
0
        //common form processing routines

        private void SetHelpFile()
        {
            string executableFolder = new Uri(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)).LocalPath;
            string helpFileName     = AppConfig.GetStringValueFromConfigFile("HelpFileName", "InitWinFormsHelpFile.chm");
            string helpFilePath     = PFFile.FormatFilePath(executableFolder, helpFileName);

            this.appHelpProvider.HelpNamespace = helpFilePath;
            _helpFilePath = helpFilePath;
        }
        //event handlers

        private void QueryBuilderForm_Load(object sender, EventArgs e)
        {
            string executableFolder = new Uri(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)).LocalPath;
            string helpFileName     = AppConfig.GetStringValueFromConfigFile("QBFHelpFileName", "QbfUsersGuide.chm");
            //string helpFileName = AppConfig.GetStringValueFromConfigFile("HelpFileName", "InitWinFormsHelpFile.chm");
            string helpFilePath = PFFile.FormatFilePath(executableFolder, helpFileName);

            this.qbfHelpProvider.HelpNamespace = helpFilePath;
            _helpFilePath = helpFilePath;
        }
        internal void SetHelpFileValues()
        {
            string configValue = string.Empty;

            string executableFolder = new Uri(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)).LocalPath;
            string helpFileName     = AppConfig.GetStringValueFromConfigFile("HelpFileName", "pfFolderSize.chm");
            string helpFilePath     = PFFile.FormatFilePath(executableFolder, helpFileName);

            this.tableNamesHelpProvider.HelpNamespace = helpFilePath;
            _helpFilePath = helpFilePath;
        }
Esempio n. 4
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            string configValue = string.Empty;

            try
            {
                //this.Text = AppInfo.AssemblyProduct;
                this.Text = StaticKeysSection.Settings.MainFormCaption;

                configValue = AppGlobals.AppConfig.GetConfigValue("SaveErrorMessagesToErrorLog");
                if (configValue.ToUpper() == "TRUE")
                {
                    _saveErrorMessagesToAppLog = true;
                }
                else
                {
                    _saveErrorMessagesToAppLog = false;
                }
                _appLogFileName = AppGlobals.AppConfig.GetConfigValue("AppLogFileName");

                if (_appLogFileName.Trim().Length > 0)
                {
                    AppGlobals.AppMessages.AppLogFilename = _appLogFileName;
                }

                string executableFolder = new Uri(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)).LocalPath;
                string helpFileName     = AppConfig.GetStringValueFromConfigFile("HelpFileName", "InitWinFormsHelpFile.chm");
                string helpFilePath     = PFFile.FormatFilePath(executableFolder, helpFileName);
                this.appHelpProvider.HelpNamespace = helpFilePath;
                _helpFilePath = helpFilePath;

                this.chkEraseOutputBeforeEachTest.Checked = true;
                this.optUseXmlFiles.Checked = true;

                InitForm();


                _mfp        = new MainFormProcessor(this);
                configValue = AppGlobals.AppConfig.GetStringValueFromConfigFile("TaskDefsDbConnectionString", string.Empty);
                if (configValue.Length > 0)
                {
                    _taskDefsDbConnectionString = configValue;
                }
            }
            catch (System.Exception ex)
            {
                _msg.Length = 0;
                _msg.Append(AppGlobals.AppMessages.FormatErrorMessage(ex));
                Program._messageLog.WriteLine(_msg.ToString());
                AppMessages.DisplayErrorMessage(_msg.ToString(), _saveErrorMessagesToAppLog);
            }
        }
Esempio n. 5
0
        private bool VerifyColumnValue(string currAppSetting, string currValue)
        {
            bool isValid = true;

            _verifyDataMessages.Length = 0;
            _verifyDataMessages.Append("Value for ");
            _verifyDataMessages.Append(currAppSetting);
            _verifyDataMessages.Append(" changed to ");
            _verifyDataMessages.Append(currValue);
            _verifyDataMessages.Append(".");

            switch (currAppSetting)
            {
            case "SaveErrorMessagesToErrorLog":
                if (IsValidBoolean(currValue) == false)
                {
                    _verifyDataMessages.Length = 0;
                    _verifyDataMessages.Append("Invalid value for ");
                    _verifyDataMessages.Append(currAppSetting);
                    _verifyDataMessages.Append(": ");
                    _verifyDataMessages.Append(currValue);
                    _verifyDataMessages.Append(".");
                    isValid = false;
                }
                break;

            case "ApplicationLogFileName":
                if (PFFile.IsValidPath(currValue) == false)
                {
                    _verifyDataMessages.Length = 0;
                    _verifyDataMessages.Append("Invalid value for ");
                    _verifyDataMessages.Append(currAppSetting);
                    _verifyDataMessages.Append(": ");
                    _verifyDataMessages.Append(currValue);
                    _verifyDataMessages.Append(".");
                    isValid = false;
                }
                break;

            default:
                break;
            }

            return(isValid);
        }
Esempio n. 6
0
        public static void CreateDatabaseTest(MainForm frm)
        {
            PFSQLAnywhereUL sqlu             = new PFSQLAnywhereUL();
            string          connectionString = string.Empty;

            try
            {
                _msg.Length = 0;
                _msg.Append("CreateDatabaseTest started ...\r\n");
                Program._messageLog.WriteLine(_msg.ToString());

                if (frm.txtDatabaseFile.Text.Trim().Length == 0)
                {
                    _msg.Length = 0;
                    _msg.Append("You must specify a database file name for Create Database Test.");
                    throw new DataException(_msg.ToString());
                }

                sqlu.DatabasePath = frm.txtDatabaseFile.Text;
                sqlu.DatabaseName = frm.txtDatabaseName.Text;
                sqlu.Username     = frm.txtUsername.Text;
                sqlu.Password     = frm.txtPassword.Text;

                sqlu.DatabaseKey = frm.txtDatabaseKey.Text;

                connectionString = sqlu.ConnectionString;

                _msg.Length = 0;
                _msg.Append("Connection string is: \r\n");
                _msg.Append(connectionString);
                Program._messageLog.WriteLine(_msg.ToString());


                sqlu.OpenConnection();


                if (File.Exists(@"c:\temp\newSQL.udb"))
                {
                    PFFile.FileDelete(@"c:\temp\newSQL.udb");
                }
                if (File.Exists(@"c:\temp\newSQLenc.udb"))
                {
                    PFFile.FileDelete(@"c:\temp\newSQLenc.udb");
                }

                sqlu.CreateDatabase(@"c:\temp\newSQL.udb", false, string.Empty);
                sqlu.CreateDatabase(@"c:\temp\newSQLenc.udb", true, "testkey");
            }
            catch (System.Exception ex)
            {
                _msg.Length = 0;
                _msg.Append(AppGlobals.AppMessages.FormatErrorMessage(ex));
                Program._messageLog.WriteLine(_msg.ToString());
                AppMessages.DisplayErrorMessage(_msg.ToString(), _saveErrorMessagesToAppLog);
            }
            finally
            {
                if (sqlu != null)
                {
                    if (sqlu.IsConnected)
                    {
                        sqlu.CloseConnection();
                    }
                }
                sqlu        = null;
                _msg.Length = 0;
                _msg.Append("\r\n... CreateDatabaseTest finished.");
                Program._messageLog.WriteLine(_msg.ToString());
            }
        }
Esempio n. 7
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            string configValue = string.Empty;

            try
            {
                this.Text = AppInfo.AssemblyProduct;

                configValue = AppGlobals.AppConfig.GetConfigValue("SaveErrorMessagesToErrorLog");
                if (configValue.ToUpper() == "TRUE")
                {
                    _saveErrorMessagesToAppLog = true;
                }
                else
                {
                    _saveErrorMessagesToAppLog = false;
                }
                _appLogFileName = AppGlobals.AppConfig.GetConfigValue("AppLogFileName");

                if (_appLogFileName.Trim().Length > 0)
                {
                    AppGlobals.AppMessages.AppLogFilename = _appLogFileName;
                }

                string executableFolder = new Uri(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)).LocalPath;
                string helpFileName     = AppConfig.GetStringValueFromConfigFile("HelpFileName", "InitWinFormsHelpFile.chm");
                string helpFilePath     = PFFile.FormatFilePath(executableFolder, helpFileName);
                this.appHelpProvider.HelpNamespace = helpFilePath;
                _helpFilePath = helpFilePath;

                this.chkEraseOutputBeforeEachTest.Checked = true;

                _saveMruListToRegistry    = AppConfig.GetBooleanValueFromConfigFile("SaveMruListToRegistry", "True");
                _mRUListSaveFileSubFolder = AppConfig.GetStringValueFromConfigFile("MRUListSaveFileSubFolder", @"PFApps\InitWinFormsAppWithToolbar\Mru\");
                _mRUListSaveRegistryKey   = AppConfig.GetStringValueFromConfigFile("MRUListSaveRegistryKey", @"SOFTWARE\PFApps\InitWinFormsAppWithToolbar");
                _maxMruListEntries        = AppConfig.GetIntValueFromConfigFile("MaxMruListEntries", (int)4);
                _useSubMenuForMruList     = AppConfig.GetBooleanValueFromConfigFile("UseSubMenuForMruList", "true");

                if (_saveMruListToRegistry)
                {
                    if (_useSubMenuForMruList)
                    {
                        _msm = new MruStripMenu(mnuFileRecent, new MruStripMenu.ClickedHandler(OnMruFile), _mRUListSaveRegistryKey + "\\MRU", false, _maxMruListEntries);
                    }
                    else
                    {
                        //use inline
                        _msm = new MruStripMenuInline(mnuFile, mnuFileRecent, new MruStripMenu.ClickedHandler(OnMruFile), _mRUListSaveRegistryKey + "\\MRU", _maxMruListEntries);
                    }
                    _msm.LoadFromRegistry();
                }
                else
                {
                    //load from and save to the file system
                    if (_useSubMenuForMruList)
                    {
                        _msm = new MruStripMenu(mnuFileRecent, new MruStripMenu.ClickedHandler(OnMruFile), _maxMruListEntries);
                    }
                    else
                    {
                        //use inline
                        _msm = new MruStripMenuInline(mnuFile, mnuFileRecent, new MruStripMenu.ClickedHandler(OnMruFile), _maxMruListEntries);
                    }
                    _msm.FileSystemMruPath = _mRUListSaveFileSubFolder;
                    _msm.LoadFromFileSystem();
                }
            }
            catch (System.Exception ex)
            {
                _msg.Length = 0;
                _msg.Append(AppGlobals.AppMessages.FormatErrorMessage(ex));
                Program._messageLog.WriteLine(_msg.ToString());
                AppMessages.DisplayErrorMessage(_msg.ToString(), _saveErrorMessagesToAppLog);
            }
        }
Esempio n. 8
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            string configValue = string.Empty;

            try
            {
                this.Text = AppInfo.AssemblyProduct;

                configValue = AppGlobals.AppConfig.GetConfigValue("SaveErrorMessagesToErrorLog");
                if (configValue.ToUpper() == "TRUE")
                {
                    _saveErrorMessagesToAppLog = true;
                }
                else
                {
                    _saveErrorMessagesToAppLog = false;
                }
                _appLogFileName = AppGlobals.AppConfig.GetConfigValue("AppLogFileName");

                if (_appLogFileName.Trim().Length > 0)
                {
                    AppGlobals.AppMessages.AppLogFilename = _appLogFileName;
                }

                string executableFolder = new Uri(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)).LocalPath;
                string helpFileName     = AppConfig.GetStringValueFromConfigFile("HelpFileName", "InitWinFormsHelpFile.chm");
                string helpFilePath     = PFFile.FormatFilePath(executableFolder, helpFileName);
                this.appHelpProvider.HelpNamespace = helpFilePath;
                _helpFilePath = helpFilePath;

                this.chkEraseOutputBeforeEachTest.Checked = true;

                this.chkShowStackTraceOnError.Checked = false;
                this.chkUseIntegratedSecurity.Checked = true;
                this.chkUseAsyncProcessing.Checked    = false;
                this.chkIsStoredProcedure.Checked     = false;
                this.txtServerName.Text   = "PROFASTSV2";
                this.txtDatabaseName.Text = "AdventureWorksDW2008R2";
                //this.txtDatabaseName.Text = "Miketest";
                this.txtApplicationName.Text = "TestprogSQL";
                this.txtWorkstationId.Text   = Environment.MachineName;
                this.txtUsername.Text        = string.Empty;
                this.txtPassword.Text        = string.Empty;

                this.txtTableName.Text  = "TestTable01";
                this.txtSchemaName.Text = "dbo";

                //_str.Length = 0;
                //_str.Append("select top 25");
                //_str.Append("\r\n");
                //_str.Append("  cGroup, cNumLow, cNumHigh, cCount, cName");
                //_str.Append("\r\n");
                //_str.Append(" from Namelists.dbo.tblUS_LastNames");
                //this.txtSQLQuery.Text = _str.ToString();

                _str.Length = 0;
                _str.Append("select LocKey=g.GeographyKey\r\n");
                _str.Append("      ,g.City\r\n");
                _str.Append("      ,[State]=g.StateProvinceName\r\n");
                _str.Append("      ,Country=g.EnglishCountryRegionName\r\n");
                _str.Append("      ,g.PostalCode\r\n");
                _str.Append("      ,st.SalesTerritoryRegion\r\n");
                _str.Append("      ,st.SalesTerritoryCountry\r\n");
                _str.Append("      ,st.SalesTerritoryGroup\r\n");
                _str.Append("  from dbo.DimGeography g\r\n");
                _str.Append("       join dbo.DimSalesTerritory st\r\n");
                _str.Append("         on g.SalesTerritoryKey = st.SalesTerritoryKey\r\n");
                _str.Append(";");
                this.txtSQLQuery.Text = _str.ToString();

                LoadAppConfigItems();
            }
            catch (System.Exception ex)
            {
                _msg.Length = 0;
                _msg.Append(AppGlobals.AppMessages.FormatErrorMessage(ex));
                Program._messageLog.WriteLine(_msg.ToString());
                AppMessages.DisplayErrorMessage(_msg.ToString(), _saveErrorMessagesToAppLog);
            }
        }