public void EditRow(Loan loan, int index) { DataRow selectedRow = dataSet.Tables["JoinEmployeeLoan"].Rows[index]; selectedRow["StartDate"] = loan.StartDate; selectedRow["EndDate"] = loan.EndDate; selectedRow["TotalAmorzitation"] = loan.TotalAmorzitation; selectedRow["AmountLoan"] = loan.Amountloan; selectedRow["TypeOfLoan"] = loan.TypeLoan; EditRecord(loan, index); }
public void DeleteRow(Loan loan, int index) { DataRow selectedRow = dataSet.Tables["JoinEmployeeLoan"].Rows[index]; selectedRow.Delete(); DeleteRecord(loan, index); }
private void EditRecord(Loan loan, int index) { SqlCommand command = new SqlCommand(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "iprocedureUpdateEmployeeLoan"; dataAdapter.UpdateCommand = command; command.Parameters.AddWithValue("@EmployeeID", loan.Employee.EmoloyeeID); command.Parameters.AddWithValue("@StartDate", loan.StartDate); command.Parameters.AddWithValue("@EndDate", loan.EndDate); command.Parameters.AddWithValue("@AmountLoan", loan.Amountloan); command.Parameters.AddWithValue("@TotalAmorzitation", loan.TotalAmorzitation); command.Parameters.AddWithValue("@LoanID", loan.LoanID); command.Parameters.AddWithValue("@TypeLoan", loan.TypeLoan); dataAdapter.Update(dataSet, "JoinEmployeeLoan"); }
public void AddRecord(Loan loan) { connection.Open(); //set up command SqlCommand command = new SqlCommand("iprocedureInsertEmployeeLoan", connection); //set up commandType command.CommandType = CommandType.StoredProcedure; //set up parameters command.Parameters.AddWithValue("@EmployeeID", loan.Employee.EmoloyeeID); command.Parameters.AddWithValue("@StartDate", loan.StartDate); command.Parameters.AddWithValue("@EndDate", loan.EndDate); command.Parameters.AddWithValue("@AmountLoan", loan.Amountloan); command.Parameters.AddWithValue("@TotalAmorzitation",loan.TotalAmorzitation); command.Parameters.AddWithValue("@TypeLoan", loan.TypeLoan); command.ExecuteNonQuery(); connection.Close(); }
private void DeleteRecord(Loan loan, int index) { SqlCommand command = new SqlCommand(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "iprocedureDeleteEmployeeLoan"; dataAdapter.DeleteCommand = command; command.Parameters.AddWithValue("@LoanID", loan.LoanID); dataAdapter.Update(dataSet, "JoinEmployeeLoan"); }