Ejemplo n.º 1
0
        private async void LoadData()
        {
            await Task.Run(() =>
            {
                FROM_DATE.Invoke((MethodInvoker)(() => FROM_DATE.CustomFormat = " "));
                TO_DATE.Invoke((MethodInvoker)(() => TO_DATE.CustomFormat = " "));
                Stats.Invoke((MethodInvoker)(() => Stats.SelectedIndex = 0));
                AREA.Invoke((MethodInvoker)(() => AREA.SelectedIndex = 0));
                Tester_platform.Invoke((MethodInvoker)(() => Tester_platform.SelectedIndex = 0));
                Boards.Invoke((MethodInvoker)(() => Boards.SelectedIndex = 0));
                dataGridViewList.Invoke((MethodInvoker)(() => dataGridViewList.DataSource = table(3)));
                commands(0);
                if (Connection.OpenConnection())
                {
                    all = command.ExecuteScalar().ToString();
                    Connection.CloseConnection();
                }
                else
                {
                    Connection.CloseConnection();
                    CheckForUpdates();
                    this.Close();
                }
                commands(6);
                if (Connection.OpenConnection())
                {
                    MySqlDataReader read_data = command.ExecuteReader();
                    while (read_data.Read())
                    {
                        Tester_platform.Invoke((MethodInvoker)(() => Tester_platform.Items.Add(read_data.GetString("Tester platforms"))));
                    }
                    Connection.CloseConnection();
                }
                else
                {
                    Connection.CloseConnection();
                    CheckForUpdates();
                    this.Close();
                }
                commands(2);
                if (Connection.OpenConnection())
                {
                    check = command.ExecuteScalar().ToString();
                    Connection.CloseConnection();
                }
                else
                {
                    Connection.CloseConnection();
                    CheckForUpdates();
                    this.Close();
                }
            }
                           );

            Counts();
            results();
            OVERDUE.Text = string.Format("OVERDUE({0})", check);
        }
Ejemplo n.º 2
0
 private void LoadBoards()
 {
     AddOrDelete.Items.Clear();
     Current_List.Items.Clear();
     database        = boards;
     Tester_platform = Tester_platforms.Text;
     Commands(1);
     if (Connection.OpenConnectionForBoards())
     {
         MySqlDataReader readBoards = Command.ExecuteReader();
         while (readBoards.Read())
         {
             Current_List.Items.Add(readBoards.GetString(Tester_platform.ToUpper()));
         }
         Connection.CloseConnectionForBoards();
     }
 }
Ejemplo n.º 3
0
        private void Commands(int commads)
        {
            switch (commads)
            {
            case 0:      //LOAD TESTER PLATFORMS
                Command = new MySqlCommand("SELECT * FROM `boards_for_verification`.`tester platforms`", Connection.connect);
                break;

            case 1:      //LOAD TESTERS OR BOARDS IN THE TESTER PLATFORM
                if (Tester.Checked)
                {
                    Command = new MySqlCommand(string.Format("SELECT * FROM `{0}`.`{1}`",
                                                             database, Tester_platform.ToLower()), Connection.connect); //LOAD TESTER
                }
                else
                {
                    Command = new MySqlCommand(string.Format("SELECT * FROM `{0}`.`{1}`",        //LOAD BOARD
                                                             database, Tester_platform.ToLower()), Connection.ConnectBoards);
                }
                break;

            case 2:      //INSERT NEW TESTERS OR BOARDS IN THE CHOSEN TESTER PLATFORM
                for (int ListCount = 0; ListCount < AddOrDelete.Items.Count; ListCount++)
                {
                    AddOrDelete.SelectedIndex = ListCount;
                    Values           = AddOrDelete.SelectedItem.ToString();
                    List_value       = string.Format("('{0}'),", Values);
                    List_AddOrDelete = List_AddOrDelete + List_value;
                }
                List_AddOrDelete = List_AddOrDelete.Remove(List_AddOrDelete.Length - 1, 1);
                FullCommand      = string.Format("INSERT INTO `{0}`.`{1}`(`{2}`) VALUES {3}"
                                                 , database, Tester_platform.ToLower(), Tester_platform.ToUpper(), List_AddOrDelete);
                if (Tester.Checked)
                {
                    Command = new MySqlCommand(FullCommand, Connection.connect);       //INSERT NEW TESTER
                }
                else
                {
                    Command = new MySqlCommand(FullCommand, Connection.ConnectBoards);       //INSERT NEW BOARDS
                }
                break;

            case 3:      ///DELETE TESTERS OR BOARDS IN THE CHOSEN TESTER PLATFORM
                for (int ListCount = 0; ListCount < AddOrDelete.Items.Count; ListCount++)
                {
                    AddOrDelete.SelectedIndex = ListCount;
                    List_value       = AddOrDelete.SelectedItem.ToString();
                    List_AddOrDelete = string.Format("DELETE FROM `{0}`.`{1}` WHERE (`{2}` = '{3}');",
                                                     database, Tester_platform.ToLower(), Tester_platform.ToUpper(), List_value);
                    FullCommand = FullCommand + List_AddOrDelete;
                }
                if (Tester.Checked)
                {
                    Command = new MySqlCommand(FullCommand, Connection.connect);        //DELETE TESTER
                }
                else
                {
                    Command = new MySqlCommand(FullCommand, Connection.ConnectBoards);       //DELETE BOARD
                }
                break;
            }
        }