public void EditRow(Bonus bonus, int index) { DataRow selectedRow = dataSet.Tables["JoinEmployeeBonus"].Rows[index]; selectedRow["Date"] = bonus.Date; selectedRow["Amount"] = bonus.Amount; selectedRow["Type"] = bonus.Type; EditRecord(bonus, index); }
public void DeleteRow(Bonus bonus, int index) { DataRow selectedRow = dataSet.Tables["JoinEmployeeBonus"].Rows[index]; selectedRow.Delete(); DeleteRecord(bonus, index); }
private void EditRecord(Bonus bonus, int index) { SqlCommand command = new SqlCommand(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "jprocedureUpdateEmployeeBonus"; dataAdapter.UpdateCommand = command; command.Parameters.AddWithValue("@EmployeeID", bonus.Employee.EmoloyeeID); command.Parameters.AddWithValue("@Date", bonus.Date); command.Parameters.AddWithValue("@Amount", bonus.Amount); command.Parameters.AddWithValue("@BonusID", bonus.BonusID); command.Parameters.AddWithValue("@Type", bonus.Type); dataAdapter.Update(dataSet, "JoinEmployeeBonus"); }
public void AddRecord(Bonus bonus) { connection.Open(); //set up command SqlCommand command = new SqlCommand("jprocedureInsertEmployeeBonus", connection); //set up commandType command.CommandType = CommandType.StoredProcedure; //set up parameters command.Parameters.AddWithValue("@Date", bonus.Date); command.Parameters.AddWithValue("@Amount", bonus.Amount); command.Parameters.AddWithValue("@EmployeeID", bonus.Employee.EmoloyeeID); command.Parameters.AddWithValue("@Type", bonus.Type); command.ExecuteNonQuery(); connection.Close(); }
private void DeleteRecord(Bonus bonus, int index) { SqlCommand command = new SqlCommand(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "jprocedureDeleteEmployeeBonus"; dataAdapter.DeleteCommand = command; command.Parameters.AddWithValue("@BonusID",bonus.BonusID ); dataAdapter.Update(dataSet, "JoinEmployeeBonus"); }