/************************************** tabPage 1 **************************************/ private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox1.SelectedIndex == 0) { ds = new DataSet(); oda = new OracleDataAdapter("select * from store_products order by id_product", oc); oda.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; Products.printDataGridTitle(dataGridView1); } if (comboBox1.SelectedIndex == 1) { ds = new DataSet(); oda = new OracleDataAdapter("select * from store_clients order by id_client", oc); oda.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; Clients.printDataGridTitle(dataGridView1); } if (comboBox1.SelectedIndex == 2) { ds = new DataSet(); oda = new OracleDataAdapter("select * from store_distributors order by id_distrib", oc); oda.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; Distributors.printDataGridTitle(dataGridView1); } if (comboBox1.SelectedIndex == 3) { ds = new DataSet(); oda = new OracleDataAdapter("select * from store_bookings order by id_booking", oc); oda.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; Bookings.printDataGridTitle(dataGridView1); } }
// add distributor private void button5_Click(object sender, EventArgs e) { if (textBox23.Text != "" && textBox24.Text != "") { Distributors distributor = new Distributors(System.Convert.ToInt32(textBox22.Text), textBox23.Text, System.Convert.ToInt32(textBox24.Text)); distributor.addDistributor(); } int newID = System.Convert.ToInt32(textBox22.Text); ++newID; textBox22.Text = newID.ToString(); textBox23.Text = ""; textBox24.Text = ""; }
/************************************** tabPage 2 **************************************/ private void tabPage2_Enter(object sender, EventArgs e) { ds = new DataSet(); oda = new OracleDataAdapter("select * from store_products order by name_pr", oc); oda.Fill(ds); dataGridView2.DataSource = ds.Tables[0]; Products.printDataGridTitle(dataGridView2); ds = new DataSet(); oda = new OracleDataAdapter("select * from store_distributors order by title", oc); oda.Fill(ds); dataGridView3.DataSource = ds.Tables[0]; Distributors.printDataGridTitle(dataGridView3); textBox12.Text = DateTime.Today.ToString(); textBox12.Enabled = false; textBox9.Enabled = true; textBox9.Text = ""; textBox14.Text = ""; }