private void buttonEdit_Click(object sender, EventArgs e) { Employee empl = new Employee(); int selectedIndex = dataGridView1.CurrentCell.RowIndex; empl.Id = (int)dataGridView1.Rows[selectedIndex].Cells[0].Value; empl.Surname = (string)dataGridView1.Rows[selectedIndex].Cells[1].Value; empl.Name = (string)dataGridView1.Rows[selectedIndex].Cells[2].Value; empl.Patronymic = (string)dataGridView1.Rows[selectedIndex].Cells[3].Value; empl.Login = (string)dataGridView1.Rows[selectedIndex].Cells[4].Value; empl.Password = (string)dataGridView1.Rows[selectedIndex].Cells[5].Value; empl.PositionId = (int)dataGridView1.Rows[selectedIndex].Cells[7].Value; EmployeeEditForm f = new EmployeeEditForm(getInstance(), empl); f.ShowDialog(); }
private void buttonCreate_Click(object sender, EventArgs e) { EmployeeEditForm f = new EmployeeEditForm(getInstance()); f.ShowDialog(); }