예제 #1
0
        private void btnDBTest_Click(object sender, EventArgs e)
        {
            bool success = DBSettings.TestConnection(txtDBServer.Text.Trim(), txtDBName.Text.Trim(), txtDBUser.Text.Trim(), txtDBPassword.Text.Trim(), chkIntegratedSecurity.Checked);

            if (success)
            {
                MyMessageBox.Show(this, "Database Settings", MyDisplayMessage.TestSuccess);
                InitializePreferencesTab();
            }
            else
            {
                MessageBox.Show("A connection could not be made to the database.  Please check your connection information.", "Database Error", MessageBoxButtons.OK);
            }
        }
예제 #2
0
        private bool TestConnection()
        {
            while (true)
            {
                //try
                //{
                if (DBSettings.TestConnection())
                {
                    return(true);
                }
                else
                //{
                //}
                //catch (MyException myex)
                {
                    try
                    {
                        if (DialogResult.No == MessageBox.Show("A connection could not be made to the database.  Please check your connection information.  Click \"Yes\" to try again or \"No\" to exit.", "Database Error", MessageBoxButtons.YesNo))
                        {
                            Environment.Exit(0);
                        }

                        frmOptions frm = new frmOptions();
                        frm.ShowInTaskbar = true;
                        frm.StartPosition = FormStartPosition.CenterScreen;
                        frm.Text          = Application.CompanyName + " " + Application.ProductName + " Database Connection";
                        frm.ShowDialog();

                        if (frm.IsEmpty())
                        {
                            return(false);
                        }
                    }
                    catch (ArgumentException)
                    {
                        frmOptions frm = new frmOptions();
                        frm.ShowInTaskbar = true;
                        frm.StartPosition = FormStartPosition.CenterScreen;
                        frm.Text          = Application.CompanyName + " " + Application.ProductName + " Database Connection";
                        frm.ShowDialog();

                        if (frm.IsEmpty())
                        {
                            return(false);
                        }
                    }
                }
            }
        }
예제 #3
0
        private void InitializePreferencesTab()
        {
            try
            {
                DBSettings.TestConnection();

                cbbCounties.DataSource    = Helper.IowaCountyList;
                cbbCounties.DisplayMember = "county";
                cbbCounties.ValueMember   = "countyid";

                cbbCounties.SelectedValue = _user.HomeCountyId;
                cbxLenientBilling.Checked = _user.LenientBilling;
            }
            catch
            {
            }
        }