private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (this.comboBox1.SelectedIndex == -1) { businessId = 0; return; } businessId = business[this.comboBox1.SelectedIndex].id; products = ProductDAO.GetList(businessId); }
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { if (this.comboBox2.SelectedIndex == -1) { businessId = 0; this.comboBox3.SelectedIndex = -1; this.comboBox3.Items.Clear(); return; } businessId = business[this.comboBox2.SelectedIndex].id; products = ProductDAO.GetList(businessId); resetComboBox3(); }
private void resetComboBox3() { products = ProductDAO.GetList(businessId); var names = new object[products.Count]; int n = 0; foreach (var i in products) { names[n] = i.id + " - " + i.name; n++; } this.comboBox3.SelectedIndex = -1; this.comboBox3.Items.Clear(); this.comboBox3.Items.AddRange(names); }