private void button1_Click(object sender, EventArgs e) { try { Met14 d = new Met14(); var ec = from n2 in db12.SpisokDoljnostei where n2.Doljnost == comboBox1.Items[comboBox1.SelectedIndex].ToString() select n2; int temp = 0; foreach (var i in ec) { temp = i.ID; } d.ADD(textBox1.Text, temp, d.RaschetZarplat2(temp, Convert.ToInt32(textBox3.Text), Convert.ToInt32(textBox5.Text), Convert.ToInt32(textBox4.Text)), DateTime.Today.ToString(), Convert.ToInt32(textBox3.Text), Convert.ToInt32(textBox4.Text), Convert.ToInt32(textBox5.Text)); this.Close(); } catch (ArgumentOutOfRangeException) { MessageBox.Show("Не все поля заполнены"); } catch { MessageBox.Show("Error"); } }
private void button1_Click(object sender, EventArgs e) { try { Met14 m = new Met14(); var ec = from n in db12.SpisokDoljnostei where n.Doljnost == comboBox2.Items[comboBox2.SelectedIndex].ToString() select n; foreach (var i in ec) { temp = i.ID; } m.Edit(Convert.ToInt32(comboBox1.Items[comboBox1.SelectedIndex]), textBox2.Text, temp, m.RaschetZarplat2(temp, Convert.ToInt32(textBox6.Text), Convert.ToInt32(textBox5.Text), Convert.ToInt32(textBox4.Text)), Convert.ToInt32(textBox6.Text), Convert.ToInt32(textBox4.Text), Convert.ToInt32(textBox5.Text)); this.Close(); } catch (ArgumentOutOfRangeException) { MessageBox.Show("Не все поля заполнены"); } catch { MessageBox.Show("Error"); } }