// END Piece event // Supervisor Add Event private void supervisorToolStripMenuItem_Click(object sender, EventArgs e) { int listIndex = 0; Supervisor empSup; empSup = new Supervisor(); AddUpdateSupervisorDialog addDialog = new AddUpdateSupervisorDialog(); empSup.ID = empList.AssignID(); addDialog.Text = "Add Supervisor Employee"; addDialog.Tag = empSup; if (addDialog.ShowDialog(this) == DialogResult.OK) { listIndex = ~this.empList.BinarySearch(empSup, listOrder); this.empList.InsertAt(listIndex, empSup); this.RefreshClientAreaControls(listIndex); } addDialog.Dispose(); }
private void supervisorToolStripMenuItem1_Click(object sender, EventArgs e) { int listIndex; Supervisor emp; //Need new dialog AddUpdateSupervisorDialog updateDialog = new AddUpdateSupervisorDialog(); listIndex = this.dataGridView.CurrentRow.Index + 1; emp = (Supervisor)this.empList[listIndex]; updateDialog.Text = "Update Employee"; updateDialog.Tag = emp; if (updateDialog.ShowDialog(this) == DialogResult.OK) { this.empList.RemoveAt(listIndex); listIndex = ~this.empList.BinarySearch(emp, listOrder); this.empList.InsertAt(listIndex, emp); this.RefreshClientAreaControls(listIndex); } updateDialog.Dispose(); }