public void EditRow(NoOfLeave noOfLeave, int index) { //get selectedRow from the dataTable, tableCourse DataRow selectedRow = dataSet.Tables["JoinEmployeeNoOfLeave"].Rows[index]; //replace values from course object selectedRow["SickLeave"] = noOfLeave.SickLeave; selectedRow["VacationLeave"] = noOfLeave.VacationLeave; selectedRow["Maternity"] = noOfLeave.MaternityLeave; selectedRow["Paternity"] = noOfLeave.PaternityLeave; EditRecord(noOfLeave, index); }
public void DeleteRow(NoOfLeave noOfLeave, int index) { //get selectedRow from the dataTable, tableCourse DataRow selectedRow = dataSet.Tables["JoinEmployeeNoOfLeave"].Rows[index]; //delete selected row from the dataSet selectedRow.Delete(); DeleteRecord(noOfLeave, index); }
public void AddRecord(NoOfLeave noOfLeave) { connection.Open(); //set up command SqlCommand command = new SqlCommand("jprocedureInsertNoOfLeave", connection); //set up commandType command.CommandType = CommandType.StoredProcedure; //set up parameters //command.Parameters.AddWithValue("@LeaveNo", noOfLeave.LeaveNo); command.Parameters.AddWithValue("@SickLeave", noOfLeave.SickLeave); command.Parameters.AddWithValue("@Maternity", noOfLeave.MaternityLeave); command.Parameters.AddWithValue("@Paternity", noOfLeave.PaternityLeave); command.Parameters.AddWithValue("@VacationLeave", noOfLeave.VacationLeave); command.Parameters.AddWithValue("@EmployeeID", noOfLeave.Employee.EmoloyeeID); command.ExecuteNonQuery(); connection.Close(); }
private void EditRecord(NoOfLeave noOfLeave, 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 = "jprocedureUpdateNoOfLeave"; dataAdapter.UpdateCommand = command; //set up parameters command.Parameters.AddWithValue("@LeaveNo", noOfLeave.LeaveNo); command.Parameters.AddWithValue("@SickLeave", noOfLeave.SickLeave); command.Parameters.AddWithValue("@Maternity", noOfLeave.MaternityLeave); command.Parameters.AddWithValue("@Paternity", noOfLeave.PaternityLeave); command.Parameters.AddWithValue("@VacationLeave", noOfLeave.VacationLeave); command.Parameters.AddWithValue("@EmployeeID", noOfLeave.Employee.EmoloyeeID); //update tableCourse from the dataSet dataAdapter.Update(dataSet, "JoinEmployeeNoOfLeave"); }
private void DeleteRecord(NoOfLeave noOfLeave, 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 = "jprocedureDeleteNoOfLeave"; dataAdapter.DeleteCommand = command; //set up parameters command.Parameters.AddWithValue("@LeaveNo", noOfLeave.LeaveNo); //update tableCourse from the dataSet dataAdapter.Update(dataSet, "JoinEmployeeNoOfLeave"); }
public FormNoOfLeave() { InitializeComponent(); admin = new Admin(); noOfleave = new NoOfLeave(); }