private void Button_Click(object sender, RoutedEventArgs e)
        {
            string sql = "";

            GlobalDataBase.OSLid = Convert.ToInt32(OSLtextBox.Text);
            SQL_Class.SQL_OpenServer();
            if (GlobalDataBase.OSLCh == 1)
            {
                sql = "INSERT INTO `savedfiles` (`id`, `Процессор`, `Материнская плата`, `Видеокарта`, `Оперативная память`, `Хранилище`, `Блок питания`) VALUES ('" + GlobalDataBase.OSLid + "', '" + GlobalDataBase.pr + "', '" + GlobalDataBase.mat + "', '" + GlobalDataBase.vid + "', '" + GlobalDataBase.op + "', '" + GlobalDataBase.hdd + "', '" + GlobalDataBase.pow + "');";
                MySqlCommand command11 = new MySqlCommand(sql, SQL_Class.connection);
                MessageBox.Show("Успех! (В раазработке)", "Успех");
            }

            /*
             * if (GlobalDataBase.OSLCh == 1)
             * {
             *  sql = "SELECT * FROM `savedfiles` WHERE " + GlobalDataBase.OSLid;
             *  MySqlCommand command11 = new MySqlCommand(sql, SQL_Class.connection);
             *  MySqlDataReader reader11 = command11.ExecuteReader();
             *  while(reader11.Read())
             *  {
             *      GlobalDataBase.pr = reader11[1].ToString();
             *      GlobalDataBase.mat = reader11[2].ToString();
             *      GlobalDataBase.vid = reader11[3].ToString();
             *      GlobalDataBase.op = reader11[4].ToString();
             *      GlobalDataBase.hdd = reader11[5].ToString();
             *      GlobalDataBase.pow = reader11[6].ToString();
             *  }
             * }
             */
            this.Close();
        }
Beispiel #2
0
        private void ProcLoad(object sender, RoutedEventArgs e)
        {
            SQL_Class.SQL_OpenServer();
            data1 = new List <string>();
            ProcLabel.Background = Brushes.Red;
            data1.Add("Выберете процессор");
            var combo = sender as ComboBox;

            sql = "SELECT * FROM `processor`";
            MySqlCommand    command = new MySqlCommand(sql, SQL_Class.connection);
            MySqlDataReader reader  = command.ExecuteReader();

            combo.SelectedIndex = 0;
            while (reader.Read())
            {
                data1.Add(reader[1].ToString() + " " + reader[2].ToString());
            }
            combo.ItemsSource = data1;

            /* Обнуление лишней строки */
            data1.Remove("Выберете процессор");
            combo.ItemsSource = data1;
            reader.Close();
            SQL_Class.SQL_CloseServer();
        }
Beispiel #3
0
        private void Proс_Selection(object sender, SelectionChangedEventArgs e)
        {
            string spname   = "Выберете процессор";
            var    selected = sender as ComboBox;

            if (!(spname == selected.SelectedItem as string))
            {
                string   name     = selected.SelectedItem as string;
                string[] stringer = name.Split(' ');
                if (factor)
                {
                    SQL_Class.SQL_OpenServer();
                    sql = "SELECT * FROM `processor` WHERE `Название` = " + '"' + stringer[0] + '"';
                    MySqlCommand    nextCommand = new MySqlCommand(sql, SQL_Class.connection);
                    MySqlDataReader reader      = nextCommand.ExecuteReader();
                    while (reader.Read())
                    {
                        allID = System.Convert.ToInt32(reader[0].ToString());
                    }
                    reader.Close();
                    SQL_Class.SQL_CloseServer();
                }
                ProcLabel.Background = Brushes.Transparent;
            }
            GlobalDataBase.pr = Convert.ToString(selected.SelectedItem);
            SovmestReloader();
        }
 private void Starter_Click(object sender, RoutedEventArgs e)
 {
     SQL_Class.SQL_Starter();
     if (SQL_Class.OPENED)
     {
         MainForm forma = new MainForm();
         forma.Show();
         this.Close();
     }
     else
     {
         this.Close();
     }
 }
Beispiel #5
0
        private void BlockLoad(object sender, RoutedEventArgs e)
        {
            SQL_Class.SQL_OpenServer();
            data6 = new List <string>();
            data6.Add("Выберете блок питания");
            var combo = sender as ComboBox;

            sql = "SELECT * FROM `power`";
            MySqlCommand    command = new MySqlCommand(sql, SQL_Class.connection);
            MySqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                data6.Add(reader[1].ToString() + " " + reader[2].ToString());
            }
            reader.Close();
            SQL_Class.SQL_CloseServer();
            combo.SelectedIndex = 0;
            combo.ItemsSource   = data6;
            data6.Remove("Выберете блок питания");
            combo.ItemsSource     = data6;
            BlockLabel.Background = Brushes.Red;
        }
Beispiel #6
0
        private void OperLoad(object sender, RoutedEventArgs e)
        {
            SQL_Class.SQL_OpenServer();
            data4 = new List <string>();
            data4.Add("Выберете оперативную память");
            var combo = sender as ComboBox;

            sql = "SELECT * FROM `operativa`";
            MySqlCommand    command = new MySqlCommand(sql, SQL_Class.connection);
            MySqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                data4.Add(reader[1].ToString() + " " + reader[2].ToString());
            }
            reader.Close();
            SQL_Class.SQL_CloseServer();
            combo.SelectedIndex = 0;
            combo.ItemsSource   = data4;
            data4.Remove("Выберете оперативную память");
            combo.ItemsSource    = data4;
            OperLabel.Background = Brushes.Red;
        }
Beispiel #7
0
        private void MatLoad(object sender, RoutedEventArgs e)
        {
            SQL_Class.SQL_OpenServer();
            data2 = new List <string>();
            data2.Add("Выберете материнскую плату");
            var combo = sender as ComboBox;

            sql = "SELECT * FROM `motherboard`";
            MySqlCommand    command = new MySqlCommand(sql, SQL_Class.connection);
            MySqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                data2.Add(reader[1].ToString() + " " + reader[2].ToString());
            }
            reader.Close();
            SQL_Class.SQL_CloseServer();
            combo.SelectedIndex = 0;
            combo.ItemsSource   = data2;
            data2.Remove("Выберете материнскую плату");
            combo.ItemsSource   = data2;
            MatLabel.Background = Brushes.Red;
        }
Beispiel #8
0
        private void SovmestReloader()
        {
            if (factor)
            {
                SQL_Class.SQL_OpenServer();
                data2 = new List <string>();
                data2.Add("Выберете материнскую плату");
                sql = "SELECT * FROM `motherboard` WHERE `id` = " + allID.ToString();
                MySqlCommand    nextCommand = new MySqlCommand(sql, SQL_Class.connection);
                MySqlDataReader reader      = nextCommand.ExecuteReader();
                while (reader.Read())
                {
                    data2.Add(reader[1].ToString() + " " + reader[2].ToString());
                }
                reader.Close();
                SQL_Class.SQL_CloseServer();
                combo2.ItemsSource   = data2;
                combo2.SelectedIndex = 0;
                data2.Remove("Выберете материнскую плату");
                combo2.ItemsSource = data2;
                SQL_Class.SQL_CloseServer();

                /*----------------------------------------------------------------------------------------------------------------*/

                SQL_Class.SQL_OpenServer();
                data3 = new List <string>();
                data3.Add("Выберете видеокарту");
                sql = "SELECT * FROM `videocard` WHERE `id` = " + allID.ToString();
                MySqlCommand    nextCommand3 = new MySqlCommand(sql, SQL_Class.connection);
                MySqlDataReader reader3      = nextCommand3.ExecuteReader();
                while (reader3.Read())
                {
                    data3.Add(reader3[1].ToString() + " " + reader3[2].ToString());
                }
                reader3.Close();
                SQL_Class.SQL_CloseServer();
                combo3.ItemsSource   = data3;
                combo3.SelectedIndex = 0;
                data3.Remove("Выберете видеокарту");
                combo3.ItemsSource = data3;
                SQL_Class.SQL_CloseServer();

                /*----------------------------------------------------------------------------------------------------------------*/

                SQL_Class.SQL_OpenServer();
                data4 = new List <string>();
                data4.Add("Выберете оперативную память");
                sql = "SELECT * FROM `operativa` WHERE `id` = " + allID.ToString();
                MySqlCommand    nextCommand4 = new MySqlCommand(sql, SQL_Class.connection);
                MySqlDataReader reader4      = nextCommand4.ExecuteReader();
                while (reader4.Read())
                {
                    data4.Add(reader4[1].ToString() + " " + reader4[2].ToString());
                }
                reader4.Close();
                SQL_Class.SQL_CloseServer();
                combo4.ItemsSource   = data4;
                combo4.SelectedIndex = 0;
                data4.Remove("Выберете оперативную память");
                combo4.ItemsSource = data4;
                SQL_Class.SQL_CloseServer();

                /*----------------------------------------------------------------------------------------------------------------*/

                SQL_Class.SQL_OpenServer();
                data5 = new List <string>();
                data5.Add("Выберете хранилище данных");
                sql = "SELECT * FROM `hdd` WHERE `id` = " + allID.ToString();
                MySqlCommand    nextCommand5 = new MySqlCommand(sql, SQL_Class.connection);
                MySqlDataReader reader5      = nextCommand5.ExecuteReader();
                while (reader5.Read())
                {
                    data5.Add(reader5[1].ToString() + " " + reader5[2].ToString());
                }
                reader5.Close();
                SQL_Class.SQL_CloseServer();
                combo5.ItemsSource   = data5;
                combo5.SelectedIndex = 0;
                data5.Remove("Выберете хранилище данных");
                combo5.ItemsSource = data5;
                SQL_Class.SQL_CloseServer();

                /*----------------------------------------------------------------------------------------------------------------*/

                SQL_Class.SQL_OpenServer();
                data6 = new List <string>();
                data6.Add("Выберете блок питания");
                sql = "SELECT * FROM `power` WHERE `id` = " + allID.ToString();
                MySqlCommand    nextCommand6 = new MySqlCommand(sql, SQL_Class.connection);
                MySqlDataReader reader6      = nextCommand6.ExecuteReader();
                while (reader6.Read())
                {
                    data6.Add(reader6[1].ToString() + " " + reader6[2].ToString());
                }
                reader6.Close();
                SQL_Class.SQL_CloseServer();
                combo6.ItemsSource   = data6;
                combo6.SelectedIndex = 0;
                data6.Remove("Выберете блок питания");
                combo6.ItemsSource = data6;
                SQL_Class.SQL_CloseServer();
            }
        }