Beispiel #1
0
        public MB selectOneMB(string p1)
        {
            MB mb = new MB();
            MySqlDataReader reader;

            command.CommandText = "SELECT * FROM mb WHERE p1='" + p1 + "';";
            try
            {
                reader = command.ExecuteReader();
                while (reader.Read())
                {
                    mb = new MB(Convert.ToInt32(reader["id"]),
                                Convert.ToString(reader["p1"]), Convert.ToString(reader["p2"]),
                                Convert.ToString(reader["p3"]), Convert.ToString(reader["p4"]),
                                Convert.ToString(reader["p5"]), Convert.ToString(reader["p6"]),
                                Convert.ToString(reader["p7"]), Convert.ToString(reader["p8"]),
                                Convert.ToInt32(reader["p9"]));
                }
                reader.Close();
            }
            catch (MySqlException ex)
            {
                Console.WriteLine("Error: \r\n{0}", ex.ToString());
            }
            finally
            {
                command.Connection.Close();
            }
            return(mb);
        }
Beispiel #2
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            oneMB       = new MB().selectOneMB(comboBox1.SelectedItem.ToString());
            id1         = oneMB.id;
            c1          = oneMB.p9;
            c2          = 0;
            c3          = 0;
            c4          = 0;
            c8          = 0;
            label2.Text = Convert.ToString(c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8);
            comboBox2.Items.Clear();
            comboBox2.Text = "";
            for (int i = 0; i < cpu.Count; i++)
            {
                if (cpu[i].p2.Equals(oneMB.p2))
                {
                    comboBox2.Items.Add(cpu[i].p1);
                }
            }
            if (comboBox2.Items.Count == 0)
            {
                comboBox2.Enabled = false;
            }
            else
            {
                comboBox2.Enabled = true;
            }
            comboBox3.Items.Clear();
            comboBox3.Text = "";
            for (int i = 0; i < ram.Count; i++)
            {
                if (ram[i].p2.Equals(oneMB.p5))
                {
                    comboBox3.Items.Add(ram[i].p1);
                }
            }
            if (comboBox3.Items.Count == 0)
            {
                comboBox3.Enabled = false;
            }
            else
            {
                comboBox3.Enabled = true;
            }
            comboBox4.Items.Clear();
            comboBox4.Text = "";
            for (int i = 0; i < cs.Count; i++)
            {
                if (cs[i].p4.Contains(oneMB.p2))
                {
                    comboBox4.Items.Add(cs[i].p1);
                }
            }
            if (comboBox4.Items.Count == 0)
            {
                comboBox4.Enabled = false;
            }
            else
            {
                comboBox4.Enabled = true;
            }
            comboBox8.Items.Clear();
            comboBox8.Text = "";
            for (int i = 0; i < cc.Count; i++)
            {
                if (oneMB.p7.Contains(cc[i].p2))
                {
                    comboBox8.Items.Add(cc[i].p1);
                }
            }
            if (comboBox8.Items.Count == 0)
            {
                comboBox8.Enabled = false;
            }
            else
            {
                comboBox8.Enabled = true;
            }

            if (!comboBox1.Text.Equals("") & !comboBox2.Text.Equals("") & !comboBox3.Text.Equals("") & !comboBox4.Text.Equals("") & !comboBox5.Text.Equals("") & !comboBox6.Text.Equals("") & !comboBox7.Text.Equals("")
                & !comboBox8.Text.Equals("") & !textBox1.Text.Equals(""))
            {
                bunifuTileButton9.Enabled = true;
            }
            else
            {
                bunifuTileButton9.Enabled = false;
            }
        }