public Department() { InitializeComponent(); admin = new Admin(); department = new Departments(); counts = new Counts(); }
public Positions() { departments = new Departments(); }
private void DeleteRecord(Departments department, int index) { //set up command SqlCommand command = new SqlCommand(); command.Connection = connection; //set up commandType command.CommandType = CommandType.StoredProcedure; //set up procedure name command.CommandText = "bprocedureDeleteDepartment"; dataAdapter.DeleteCommand = command; //set up parameters command.Parameters.AddWithValue("@DepartmentID", department.DepartmentID); //update tableCourse from the dataSet dataAdapter.Update(dataSet, "Department"); }
public void DeleteRow(Departments department, int index) { //get selectedRow from the dataTable, tableCourse DataRow selectedRow = dataSet.Tables["Department"].Rows[index]; //delete selected row from the dataSet selectedRow.Delete(); DeleteRecord(department, index); }
public void EditRow(Departments department, int index) { //get selectedRow from the dataTable, tableCourse DataRow selectedRow = dataSet.Tables["Department"].Rows[index]; //replace values from course object selectedRow["DepartmentName"] = department.DepartmentName; EditRecord(department, index); }
public void AddRow(Departments department) { //get dataTable tableCourse DataTable dataTable = dataSet.Tables["Department"]; //create a new dataRow DataRow dataRow = dataTable.NewRow(); //assign values from course object dataRow["DepartmentID"] = department.DepartmentID; dataRow["DepartmentName"] = department.DepartmentName; //add the new dataRow to dataTable dataTable.Rows.Add(dataRow); AddRecord(department); }