public FormPositions() { InitializeComponent(); admin = new Admin(); positions = new Positions(); counts = new Counts(); }
private void DeleteRecord(Positions position, int index) { SqlCommand command = new SqlCommand(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "cprocedureDeletePosition"; dataAdapter.DeleteCommand = command; command.Parameters.AddWithValue("@PositionID", position.PositionID); dataAdapter.Update(dataSet, "JoinPositionDepartment"); }
public void DeleteRow(Positions positions, int index) { DataRow selectedRow = dataSet.Tables["JoinPositionDepartment"].Rows[index]; selectedRow.Delete(); DeleteRecord(positions, index); }
private void EditRecord(Positions positions, int index) { SqlCommand command = new SqlCommand(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "cprocedureUpdatePosition"; dataAdapter.UpdateCommand = command; command.Parameters.AddWithValue("@PositionID", positions.PositionID); command.Parameters.AddWithValue("@PositionName", positions.PositionName); command.Parameters.AddWithValue("@Salary", positions.Salary); command.Parameters.AddWithValue("@DepartmentID", positions.Department.DepartmentID); dataAdapter.Update(dataSet, "JoinPositionDepartment"); }
public void EditRow(Positions positions, int index) { DataRow selectedRow = dataSet.Tables["JoinPositionDepartment"].Rows[index]; selectedRow["PositionID"] = positions.PositionID; selectedRow["PositionName"] = positions.PositionName; selectedRow["Salary"] = positions.Salary; selectedRow["DepartmentName"] = positions.Department.DepartmentName; EditRecord(positions, index); }
public void AddRow(Positions positions) { DataTable dataTable = dataSet.Tables["JoinPositionDepartment"]; DataRow dataRow = dataTable.NewRow(); dataRow["PositionID"] = positions.PositionID; dataRow["PositionName"] = positions.PositionName; dataRow["Salary"] = positions.Salary; dataRow["DepartmentName"] = positions.Department.DepartmentName; dataTable.Rows.Add(dataRow); AddRecord(positions); }