private void deleteButton_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows[0].Index < 0 || dataGridView1.SelectedRows[0].Index >= dataGridView1.Rows.Count) { return; } A_1_AddEmployee f = new A_1_AddEmployee((dataGridView1.SelectedRows[0].DataBoundItem as DataRowView).Row, this); a.runQuery("UPDATE Employees SET End_Date = '" + DateTime.Today.ToString("yyyy-MM-dd").Substring(0, 10).Replace('/', '-') + "' WHERE Employee_ID = " + int.Parse(dataGridView1.SelectedRows[0].Cells["Employee_ID"].Value.ToString()) + ""); loadDatabase(); }
private void editButton_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count <= 0) { return; } if (dataGridView1.SelectedRows[0].Index < 0 || dataGridView1.SelectedRows[0].Index >= dataGridView1.Rows.Count) { return; } DataRow input_row = (dataGridView1.SelectedRows[0].DataBoundItem as DataRowView).Row; A_1_AddEmployee f = new A_1_AddEmployee(input_row, this); f.ShowDialog(); }
private void AddButton_Click(object sender, EventArgs e) { A_1_AddEmployee f = new A_1_AddEmployee(this); f.ShowDialog(); }