Exemplo n.º 1
0
 void tsmiLanguage_Click(object sender, EventArgs e)
 {
     int newLangID = 1;
     ToolStripMenuItem tsmi = (ToolStripMenuItem) sender;
     if (int.TryParse(tsmi.Tag.ToString(), out newLangID))
     {
         _sharedUtils.ChangeLanguage(newLangID);
         languageCode = newLangID.ToString();
         _sharedUtils.UserLanguageCode = newLangID;
         _sharedUtils.UpdateComponents(this.components.Components, this.Name);
         _sharedUtils.UpdateControls(this.Controls, this.Name);
         // Save the statusbar text for the left, center, and right controls...
         ux_statusLeftMessage.Tag = ux_statusLeftMessage.Text;
         ux_statusCenterMessage.Tag = ux_statusCenterMessage.Text;
         ux_statusRightMessage.Tag = ux_statusRightMessage.Text;
         ux_statusRightMessage.Text = "";
         // Refresh the DGV data to get new column headings...
         ux_buttonRefreshData.PerformClick();
     // Warn the user that they should reload their LU tables...
     GRINGlobal.Client.Common.GGMessageBox ggMessageBox = new GRINGlobal.Client.Common.GGMessageBox("You have successfully changed your language to {0}.\n\nWarning: Your lookup tables are language specific so you should reload them very soon.\n\nWould you like to do this now?", "Reload Lookup Tables", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button1);
     ggMessageBox.Name = "tsmiLanguage1";
     _sharedUtils.UpdateControls(ggMessageBox.Controls, ggMessageBox.Name);
     if (ggMessageBox.MessageText.Contains("{0}")) ggMessageBox.MessageText = string.Format(ggMessageBox.MessageText, tsmi.Text);
     if (DialogResult.Yes == ggMessageBox.ShowDialog())
     {
     // Reload LU tables now...
     LookupTableLoader ltl = new LookupTableLoader(localDBInstance, _sharedUtils);
     ltl.StartPosition = FormStartPosition.CenterParent;
     ltl.Show();
     }
     }
 }
Exemplo n.º 2
0
        private void ux_buttonLookupTableMaintenance_Click(object sender, EventArgs e)
        {
            //LookupTableLoader ltl = new LookupTableLoader(localDBInstance, lookupTables);
            LookupTableLoader ltl = new LookupTableLoader(localDBInstance, _sharedUtils);
            ltl.StartPosition = FormStartPosition.CenterParent;
            ltl.Show();
            //ltl.Focus();

            // Change cursor to the wait cursor...
            //Cursor origCursor = Cursor.Current;
            //Cursor.Current = Cursors.WaitCursor;

            //GrinGlobalClient.ActiveForm.Enabled = false;
            //lookupTables.ResetLookupTables();
            //lookupTables.GetUpdates();
            //GrinGlobalClient.ActiveForm.Enabled = true;

            // Restore cursor to default cursor...
            //Cursor.Current = origCursor;
        }
Exemplo n.º 3
0
        private void LookupTableStatusCheck()
        {
            //// Display the splash page to let the user know that things are happening...
            //Splash splash = new Splash();
            //splash.StartPosition = FormStartPosition.CenterScreen;
            //splash.Show();
            //splash.Update();
            try
            {
                int partiallyLoadedTables = 0;
                DataTable lookupTableStatus = _sharedUtils.LookupTablesGetSynchronizationStats();
                if (lookupTableStatus != null &&
                    lookupTableStatus.Rows.Count > 0)
                {
                    foreach (DataRow dr in lookupTableStatus.Rows)
                    {
                        if (dr["status"].ToString().Trim().ToUpper() != "COMPLETED" &&
                            dr["status"].ToString().Trim().ToUpper() != "UPDATED")
                        {
                            // The program will not auto-update a partially loaded LUT because there could potentially
                            // be 10s of thousands of missing records - so just bail out and warn the user...
                            if (ux_checkboxWarnWhenLUTablesAreOutdated.Checked) partiallyLoadedTables++;
                        }
                        else
                        {
            //// If the attempted update fails for any reason - warn the user...
            //if (!_sharedUtils.LookupTablesUpdateTable(dr["dataview_name"].ToString()))
            //{
            //    if (ux_checkboxWarnWhenLUTablesAreOutdated.Checked) partiallyLoadedTables++;
            //}
                            // Thread the LU table update as a background task...
                            _sharedUtils.LookupTablesUpdateTable(dr["dataview_name"].ToString(), true);
                        }
                    }
                }
                if (partiallyLoadedTables > 0)
                {
            //if (DialogResult.Yes == MessageBox.Show(this, "There are " + partiallyLoadedTables.ToString() + " lookup tables with missing data.\nTo maximize performace of this application it is recommended that all lookup tables be downloaded.\n\nWould you like to do this now?", "Missing Lookup Table Data", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1))
            GRINGlobal.Client.Common.GGMessageBox ggMessageBox = new GRINGlobal.Client.Common.GGMessageBox("There are {0} lookup tables with missing data.\nTo maximize performace of this application it is recommended that all lookup tables be downloaded.\n\nWould you like to do this now?", "Missing Lookup Table Data", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button1);
            ggMessageBox.Name = "LookupTableStatusCheckMessage1";
            _sharedUtils.UpdateControls(ggMessageBox.Controls, ggMessageBox.Name);
            if (ggMessageBox.MessageText.Contains("{0}")) ggMessageBox.MessageText = string.Format(ggMessageBox.MessageText, partiallyLoadedTables.ToString());
            if (DialogResult.Yes == ggMessageBox.ShowDialog(this))
                    {
                        LookupTableLoader ltl = new LookupTableLoader(localDBInstance, _sharedUtils);
            ltl.StartPosition = FormStartPosition.CenterParent;
                        ltl.Show();
                        ltl.Focus();
                    }
                }
            }
            catch
            {
            //MessageBox.Show("An error was encountered while performing the status check for lookup tables.  Stopping status check.", "Lookup Table Status Check Error");
            GRINGlobal.Client.Common.GGMessageBox ggMessageBox = new GRINGlobal.Client.Common.GGMessageBox("An error was encountered while performing the status check for lookup tables.  Stopping status check.", "Lookup Table Status Check Error", MessageBoxButtons.OK, MessageBoxDefaultButton.Button1);
            ggMessageBox.Name = "LookupTableStatusCheckMessage2";
            _sharedUtils.UpdateControls(ggMessageBox.Controls, ggMessageBox.Name);
            ggMessageBox.ShowDialog(this);
            }

            //// Close the splash page...
            //splash.Close();
        }