private void addEmployee_Click(object sender, EventArgs e) { var addEmp = new AddEmployee(); addEmp.IdentityUpdated += this.SaveRecord; addEmp.ShowDialog(); }
private void btnEdit_Click(object sender, EventArgs e) { try { var row = dataGridView.CurrentCell.RowIndex; var id = Convert.ToString(dataGridView.Rows[row].Cells[0].Value); var name = Convert.ToString(dataGridView.Rows[row].Cells[1].Value); var address = Convert.ToString(dataGridView.Rows[row].Cells[2].Value); var contact = Convert.ToString(dataGridView.Rows[row].Cells[3].Value); var email = Convert.ToString(dataGridView.Rows[row].Cells[4].Value); var desigination = Convert.ToString(dataGridView.Rows[row].Cells[5].Value); var department = Convert.ToString(dataGridView.Rows[row].Cells[6].Value); var dateOfJoin = Convert.ToString(dataGridView.Rows[row].Cells[7].Value); var wageRate = Convert.ToString(dataGridView.Rows[row].Cells[8].Value); var hourWorked = Convert.ToString(dataGridView.Rows[row].Cells[9].Value); var addEmp = new AddEmployee(); addEmp.LoadData(id, name, address, contact, email, desigination, department, dateOfJoin, wageRate, hourWorked); addEmp.IdentityUpdated += this.UpdateRecord; addEmp.ShowDialog(); } catch (Exception exception) { MessageBox.Show(exception.Message, "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void addEmployee_Click(object sender, EventArgs e) { ButtonMarker.Top = addEmployee.Top + 60; var addEmp = new AddEmployee(); addEmp.IdentityUpdated += this.SaveRecord; addEmp.ShowDialog(); }
private void btnEdit_Click(object sender, EventArgs e) { try { var row = dataGridView.CurrentCell.RowIndex; var employeeNum = Convert.ToString(dataGridView.Rows[row].Cells[0].Value); var id = Convert.ToString(dataGridView.Rows[row].Cells[1].Value); var name = Convert.ToString(dataGridView.Rows[row].Cells[2].Value); var mobile = Convert.ToString(dataGridView.Rows[row].Cells[3].Value); var email = Convert.ToString(dataGridView.Rows[row].Cells[4].Value); var department = Convert.ToString(dataGridView.Rows[row].Cells[5].Value); _row = row; var addEmp = new AddEmployee(); addEmp.LoadData(employeeNum, id, name, mobile, email, department); addEmp.IdentityUpdated += this.UpdateRecord; addEmp.ShowDialog(); } catch (Exception exception) { MessageBox.Show(exception.Message, "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error); } }