Ejemplo n.º 1
0
 /// <summary>
 /// 最后一个控件回车时的回调
 /// </summary>
 protected void LastControlAction()
 {
     if (IsNew)
     {
         if (SaveNewButton != null && SaveNewButton.Enabled)
         {
             SaveNewButton.Select();
             SaveNewButton.PerformClick();
         }
         else
         {
             SelectFirstControl();
         }
     }
     else
     {
         if (SaveButton != null && SaveButton.Enabled)
         {
             SaveButton.Select();
             SaveButton.PerformClick();
         }
         else
         {
             SelectFirstControl();
         }
     }
 }
Ejemplo n.º 2
0
        private void SystemDefaultsForm_Load(object sender, EventArgs e)
        {
            SaveButton.Select();
            int BoundsWidth  = Screen.PrimaryScreen.Bounds.Width;
            int BoundsHeight = Screen.PrimaryScreen.Bounds.Height;
            int X_Coordinate = BoundsWidth - this.Width;
            int Y_Coordinate = BoundsHeight - this.Height;

            Location = new Point(X_Coordinate / 2, (Y_Coordinate / 2) + 10);

            //EXCEPTION 1
            try
            {
                variables           = new Variables();
                opacityform         = new OpacityForm();
                cryptography        = new Cryptography();
                sqlconnectionconfig = new SQLConnectionConfig();

                RegistryKey registrykey = Registry.CurrentUser.OpenSubKey(@variables.pathname);
                string      tempdata    = registrykey.GetValue("SQLServerConnectionString").ToString();

                //USER SQLSERVER CONNECTION SETTINGS
                sqlconnectionconfig.SqlConnectionString = cryptography.Decrypt(tempdata);
                sqlconnection = new SqlConnection(sqlconnectionconfig.SqlConnectionString);
                sqlconnection.Open();

                //INNER EXCEPTION 1
                try
                {
                    //DON'T MIND THIS !
                    Where_To_Check_Radio_Buttons();

                    //DISPLAY CURRENT SCHOOL YEAR
                    Init_Current_SchoolYear();

                    //INITIALIZE SCHOOL YEAR DROPDOWN AND ID
                    Retrieve_School_Year_List_And_ID();

                    //CHECK VALIDITY OF SECTIONS
                    Enable_Or_Disable_2ndSaveButton();

                    //INITIALIZE SECTION ID DROPDOWN
                    Retrieve_SectionID_List();

                    //POPULATE DATAGRIDVIES
                    Load_Section_Records();
                    Load_School_Year_Records();
                }

                catch (Exception exception)
                {
                    opacityform.Show();
                    MessageBox.Show(exception.ToString(), "@Other Settings Form Inner Exception 1",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    opacityform.Hide();
                }
            }

            catch (Exception exception)
            {
                opacityform.Show();
                MessageBox.Show(exception.ToString(), "@Other Settings Form Exception 1",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                opacityform.Hide();
            }
        }