public void AddRecord(Philhealth philHealth) { connection.Open(); //set up command SqlCommand command = new SqlCommand("aprocedureInsertPhilHealth", connection); //set up commandType command.CommandType = CommandType.StoredProcedure; //set up parameters command.Parameters.AddWithValue("@SalaryRangeFrom", philHealth.SalaryRangeFrom); command.Parameters.AddWithValue("@SalaryRangeTo", philHealth.SalaryRangeTo); command.Parameters.AddWithValue("@SalaryBase", philHealth.SalaryBase); command.Parameters.AddWithValue("@EmployeeShare", philHealth.EmployeeShare); command.Parameters.AddWithValue("@EmployerShare", philHealth.EmployerShare); command.Parameters.AddWithValue("@TotalMonthlyPremium", philHealth.TotalMonthlyPremium); command.ExecuteNonQuery(); connection.Close(); }
public Philheath() { InitializeComponent(); admin = new Admin(); philHealth = new Philhealth(); }
public void EditRow(Philhealth philHealth, int index) { //get selectedRow from the dataTable, PhilHealth DataRow selectedRow = dataSet.Tables["PhilHealth"].Rows[index]; //replace values from course object selectedRow["PhilHealthSalaryBracetNo"] = philHealth.PhilHealthSalaryBracetNo; selectedRow["SalaryRangeFrom"] = philHealth.SalaryRangeFrom; selectedRow["SalaryRangeTo"] = philHealth.SalaryRangeTo; selectedRow["SalaryBase"] = philHealth.SalaryBase; selectedRow["EmployeeShare"] = philHealth.EmployeeShare; selectedRow["EmployerShare"] = philHealth.EmployerShare; selectedRow["TotalMonthlyPremium"] = philHealth.TotalMonthlyPremium; EditRecord(philHealth, index); }
public void DeleteRow(Philhealth philHealth, int index) { //get selectedRow from the dataTable, PhilHealth DataRow selectedRow = dataSet.Tables["PhilHealth"].Rows[index]; //delete selected row from the dataSet selectedRow.Delete(); DeleteRecord(philHealth, index); }
private void EditRecord(Philhealth philHealth, 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 = "aprocedureUpdatePhilHealth"; dataAdapter.UpdateCommand = command; //set up parameters command.Parameters.AddWithValue("@PhilHealthSalaryBracetNo", philHealth.PhilHealthSalaryBracetNo); command.Parameters.AddWithValue("@SalaryRangeFrom", philHealth.SalaryRangeFrom); command.Parameters.AddWithValue("@SalaryRangeTo", philHealth.SalaryRangeTo); command.Parameters.AddWithValue("@SalaryBase", philHealth.SalaryBase); command.Parameters.AddWithValue("@EmployeeShare", philHealth.EmployeeShare); command.Parameters.AddWithValue("@EmployerShare", philHealth.EmployerShare); command.Parameters.AddWithValue("@TotalMonthlyPremium", philHealth.TotalMonthlyPremium); //update tableCourse from the dataSet dataAdapter.Update(dataSet, "PhilHealth"); }
private void DeleteRecord(Philhealth philHealth, 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 = "aprocedureDeletePhilHealth"; dataAdapter.DeleteCommand = command; //set up parameters command.Parameters.AddWithValue("@PhilHealthSalaryBracetNo", philHealth.PhilHealthSalaryBracetNo); //update tableCourse from the dataSet dataAdapter.Update(dataSet, "PhilHealth"); }