private void button5_Click(object sender, EventArgs e) { try { Met5 d = new Met5(); Form1 f = new Form1(); Met1 m = new Met1(); string[] str = comboBox1.Items[comboBox1.SelectedIndex].ToString().Split(new char[] { ' ' }); var Zapis = from n2 in db16.Zapis where n2.ID == Convert.ToInt32(str[0]) select n2; foreach (var i in Zapis) { var Uslugi = from n2 in db13.Uslugi where n2.ID == i.IDUslugi select n2; foreach (var j in Uslugi) { m.Posesh(i.IDPacienta); d.ADD(Convert.ToInt32(str[0]), j.Cena, d.RaschetSkidki(i.IDPacienta), j.Cena - ((j.Cena * d.RaschetSkidki(i.IDPacienta)) / 100)); } } button1.Visible = true; button2.Visible = true; button3.Visible = true; label1.Visible = false; comboBox1.Visible = false; button5.Visible = false; button4.Visible = false; } catch (ArgumentOutOfRangeException) { MessageBox.Show("Не все поля заполнены"); } //catch { MessageBox.Show("Error"); } }
private void button1_Click(object sender, EventArgs e) { try { Met5 m = new Met5(); string[] str = comboBox1.Items[comboBox1.SelectedIndex].ToString().Split(new char[] { ' ' }); m.Delete(Convert.ToInt32(str[0])); this.Close(); } catch { MessageBox.Show("Error"); } }