示例#1
0
        public void connect()
        {
            try
            {
                posdb = new InnosoftPOSData.InnosoftPOSDataDataContext(Controllers.SysGlobalSettings.getConnectionString());
                if (posdb.DatabaseExists())
                {
                    pgbMainLoading.Value = 100;
                    lblLoading.Text      = "Connected!";

                    launchingLoginFormTimer.Interval = 1500;
                    launchingLoginFormTimer.Tick    += new EventHandler(launchLoginFormTimerTick);
                    launchingLoginFormTimer.Enabled  = true;
                }
                else
                {
                    pgbMainLoading.Value = 100;
                    lblLoading.Text      = "Failed!";

                    MessageBox.Show("Connection Failed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    btnMainIntegrate.Enabled  = true;
                    btnIntegrateFiles.Enabled = true;

                    pgbMainLoading.Value   = 0;
                    pgbMainLoading.Visible = false;

                    lblLoading.Visible = false;

                    Forms.SysConnectionString sysConnectionString = new Forms.SysConnectionString(this);
                    sysConnectionString.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                btnMainIntegrate.Enabled  = true;
                btnIntegrateFiles.Enabled = true;

                pgbMainLoading.Value   = 0;
                pgbMainLoading.Visible = false;

                lblLoading.Visible = false;
            }
        }