private void toolStripMenuItem5_Click(object sender, EventArgs e) { Employee employee = new Employee(); if (treeViewDepEmpl.SelectedNode != null) { DataRow dr = _db._ds.Tables["Employee"].Rows.Find(treeViewDepEmpl.SelectedNode.Name); employee.SetValues( Convert.ToInt32(dr["Id"]), dr["LastName"].ToString(), dr["FirstName"].ToString(), dr["MiddleName"].ToString(), Convert.ToInt32(dr["DepartmentId"]), Convert.ToInt32(dr["UserId"]), Convert.ToDateTime(dr["AcceptanceDate"]), Convert.ToDouble(dr["Bonuses"]), Convert.ToDouble(dr["SumOrders"]) ); EmployeeForm ef = new EmployeeForm( employee, employee.DepartmentId, _db._ds.Tables["Department"], _db._ds.Tables["Position"], _db._ds.Tables["User"], client ); ef.ShowDialog(); employee = ef.employee; if (employee.Id != 0) { client.SetEmployee(employee); //_waitForResponse.WaitOne(); } } }
private void newEmpToolStripMenuItem1_Click(object sender, EventArgs e) { int depNode; if (treeViewDepEmpl.Nodes.Count != 0) { if (treeViewDepEmpl.SelectedNode != null) { depNode = treeViewDepEmpl.SelectedNode.Index; } else { MessageBox.Show(@"Нужно выделить левой кнопкой отдел, в котором будете создавать работника!"); treeViewDepEmpl.Focus(); return; } } else { depNode = 0; } Employee employee = new Employee(); employee.SetId(client.GetCurIdentity("Employee") + 1); EmployeeForm ef = new EmployeeForm( employee, depNode, _db._ds.Tables["Department"], _db._ds.Tables["Position"], _db._ds.Tables["User"], client ); ef.ShowDialog(); employee = ef.employee; User user = ef.user; if (employee.Id != 0) { client.SetUser(user); //_waitForResponse.WaitOne(); client.SetEmployee(employee); //_waitForResponse.WaitOne(); } }