private void button1_Click(object sender, EventArgs e) { try { Met16 m = new Met16(); string[] str = comboBox1.Items[comboBox1.SelectedIndex].ToString().Split(new char[] { ' ' }); m.Delete(Convert.ToInt32(str[0])); this.Close(); } catch { MessageBox.Show("Error"); } }
private void button1_Click(object sender, EventArgs e) { try { Met16 d = new Met16(); var ec = from n2 in db1.Pacient where n2.FIO == comboBox1.Items[comboBox1.SelectedIndex].ToString() select n2; string[] str = comboBox2.Items[comboBox2.SelectedIndex].ToString().Split(new char[] { ' ' }); string[] str2 = dateTimePicker1.Value.ToString().Split(new char[] { ' ' }); var ec2 = from n2 in db11.Raspisanie where n2.ID == Convert.ToInt32(str[0]) select n2; var ec3 = from n2 in db13.Uslugi where n2.Name == comboBox3.Items[comboBox3.SelectedIndex].ToString() select n2; string temp = ""; int temp2 = 0; foreach (var i in ec2) { temp2 = i.IDVrem; } var ec4 = from n2 in db15.Vrem where n2.ID == temp2 select n2; foreach (var i in ec4) { temp = i.Den; } if (dateTimePicker1.Value.DayOfWeek.ToString() == d.Dni(temp)) { foreach (var i in ec) { foreach (var j in ec3) { d.ADD(i.ID, Convert.ToInt32(str[0]), j.ID, str2[0]); } } this.Close(); } else { MessageBox.Show("Ошибка ввода даты"); } } catch (ArgumentOutOfRangeException) { MessageBox.Show("Не все поля заполнены"); } catch { MessageBox.Show("Error"); } }
private void button1_Click(object sender, EventArgs e) { try { Met16 d = new Met16(); var Pacient = from n in db1.Pacient where n.FIO == comboBox2.Items[comboBox2.SelectedIndex].ToString() select n; var Uslugi = from n in db13.Uslugi where n.Name == comboBox4.Items[comboBox4.SelectedIndex].ToString() select n; string[] str = comboBox3.Items[comboBox3.SelectedIndex].ToString().Split(new char[] { ' ' }); string[] str2 = dateTimePicker1.Value.ToString().Split(new char[] { ' ' }); var Raspisanie = from n in db11.Raspisanie where n.ID == Convert.ToInt32(str[0]) select n; string temp = ""; foreach (var i in Raspisanie) { var Vrem = from n in db15.Vrem where n.ID == i.IDVrem select n; foreach (var j in Vrem) { temp = j.Den; } } if (dateTimePicker1.Value.DayOfWeek.ToString() == d.Dni(temp)) { foreach (var i in Pacient) { foreach (var j in Uslugi) { d.Edit(Convert.ToInt32(comboBox1.Items[comboBox1.SelectedIndex]), i.ID, Convert.ToInt32(str[0]), j.ID, str2[0]); } } this.Close(); } } catch (ArgumentOutOfRangeException) { MessageBox.Show("Не все поля заполнены"); } catch { MessageBox.Show("Error"); } }