private void M1_Click(object sender, EventArgs e) { Button btn = (Button)sender; Siparis siparis = new Siparis(); string number = btn.Text.Substring(5); siparis.label6.Text = number; siparis.label7.Text = "aç"; this.Hide(); siparis.ShowDialog(); }
private void Save_Click(object sender, EventArgs e) { connection.Open(); if (label6.Text != "") { int table_NO = Convert.ToInt32(label6.Text); foreach (var x in drink) { command = new SqlCommand("insert into sold values(@id,NULL,@price,@date,@table,1)", connection); command.Parameters.AddWithValue("@id", x.Id); command.Parameters.AddWithValue("@price", x.price); command.Parameters.AddWithValue("@date", DateTime.Now); command.Parameters.AddWithValue("@table", table_NO); command.ExecuteNonQuery(); } foreach (var x in food) { command = new SqlCommand("insert into sold values(NULL,@id,@price,@date,@table,NULL)", connection); command.Parameters.AddWithValue("@id", x.Id); command.Parameters.AddWithValue("@price", x.price); command.Parameters.AddWithValue("@date", DateTime.Now); command.Parameters.AddWithValue("@table", table_NO); command.ExecuteNonQuery(); connection.Close(); } } Choosen_list.Items.Clear(); Sum.Text = ""; Drink_list.Items.Clear(); Food_list.Items.Clear(); label7.Text = ""; Isopen(); Siparis siparis = new Siparis(); this.Hide(); siparis.ShowDialog(); }