public Form2() { InitializeComponent(); using (IDbConnection connection = new SqlConnection()) { } using (PizzaShopEntities db = new PizzaShopEntities()) { var MenuPizzas = db.MenuPizza; var SizePizzas = db.SizePizza; var TypeDoughPizzas = db.typeDoughPizza; foreach (MenuPizza pl in MenuPizzas) { this.comboBox1.Items.Add(pl.Pizza + " " + pl.Cost); } foreach (SizePizza tl in SizePizzas) { this.comboBox2.Items.Add(tl.Size); } foreach (typeDoughPizza rl in TypeDoughPizzas) { this.comboBox3.Items.Add(rl.Dough); } } }
private void button2_Click(object sender, EventArgs e) { using (PizzaShopEntities db = new PizzaShopEntities()) { var MenuPizzas = db.MenuPizza; foreach (MenuPizza pl in MenuPizzas) { int id = comboBox1.SelectedIndex + 1; int co = Convert.ToInt32(pl.id); if (co == id) { label5.Text = pl.Cost; } } } }
private void Button1_Click(object sender, EventArgs e) { using (IDbConnection connection = new SqlConnection()) { } using (PizzaShopEntities db = new PizzaShopEntities()) { var ShoppingBaskets = db.ShoppingBasket; foreach (ShoppingBasket pl in ShoppingBaskets) { //int i = pl.id; //pl.id = i; //pl.Pizza = comboBox1.Text; //pl.Size = comboBox2.Text; //pl.Dough = comboBox3.Text; //pl.Cost = label5.Text; //db.SaveChanges(); } } }