private void ButtonEmployee_Click object sender EventArgs int id -1 if

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
private void ButtonEmployee_Click(object sender, EventArgs e)
{
int id = -1;
if (((DataRowView)salaryBindingSource.Current)["ID_Employee"].ToString() != "")
{
id = (int)(((DataRowView)salaryBindingSource.Current)["ID_Employee"]);
}
// id = FormEmployee.fd.ShowSelectForm(id);
try
{
id = FormEmployee.fd.ShowSelectForm(id);
if (id >= 0)
{
// MessageBox.Show(id.ToString());
((DataRowView)salaryBindingSource.Current)["ID_Employee"] = id;
salaryBindingSource.EndEdit();
standard_salaryTextBox1.Focus();
}
if (!(String.IsNullOrEmpty(iD_EmployeeTextBox1.Text)))
FIO();
}
catch (Exception err)
{
MessageBox.Show("Информация о данном сотруднике уже имеется в базе. Выберете другого", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
/* if (id >= 0)
{
MessageBox.Show(id.ToString());
((DataRowView)salaryBindingSource.Current)["ID_Employee"] = id;
salaryBindingSource.EndEdit();
standard_salaryTextBox1.Focus();
}*/
}