public void AddRecord(PagIbigs pagIbig)
 {
     connection.Open();
     //set up command
     SqlCommand command = new SqlCommand("bprocedureInsertPagIbig", connection);
     //set up commandType
     command.CommandType = CommandType.StoredProcedure;
     //set up parameters
     command.Parameters.AddWithValue("@MonthlyCompensationFrom", pagIbig.MonthlyCompensationFrom);
     command.Parameters.AddWithValue("@MonthlyCompensationTo", pagIbig.MonthlyCompensationTo);
     command.Parameters.AddWithValue("@EmployeeShare", pagIbig.EmployeeShare);
     command.Parameters.AddWithValue("@EmployerShare", pagIbig.EmployerShare);
     command.Parameters.AddWithValue("@TotalMonthlyContribution", pagIbig.TotalMonthlyContribution);
     command.ExecuteNonQuery();
     connection.Close();
 }
        public void EditRow(PagIbigs pagIbig, int index)
        {
            //get selectedRow from the dataTable, tableCourse
            DataRow selectedRow = dataSet.Tables["PagIbig"].Rows[index];

            //replace values from course object
            selectedRow["PagIbigSalaryBracetNo"] = pagIbig.PagIbigSalaryBracetNo;
            selectedRow["MonthlyCompensationFrom"] = pagIbig.MonthlyCompensationFrom;
            selectedRow["MonthlyCompensationFrom"] = pagIbig.MonthlyCompensationTo;
            selectedRow["EmployeeShare"] = pagIbig.EmployeeShare;
            selectedRow["EmployerShare"] = pagIbig.EmployerShare;
            selectedRow["TotalMonthlyContribution"] = pagIbig.TotalMonthlyContribution;
            EditRecord(pagIbig, index);
        }
        public void DeleteRow(PagIbigs pagIbig, int index)
        {
            //get selectedRow from the dataTable, tableCourse
            DataRow selectedRow = dataSet.Tables["PagIbig"].Rows[index];

            //delete selected row from the dataSet
            selectedRow.Delete();

            DeleteRecord(pagIbig, index);
        }
        private void EditRecord(PagIbigs pagIbig, 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 = "bprocedureUpdatePagIbig";
            dataAdapter.UpdateCommand = command;

            //set up parameters
            command.Parameters.AddWithValue("@PagIbigSalaryBracetNo", pagIbig.PagIbigSalaryBracetNo);
            command.Parameters.AddWithValue("@MonthlyCompensationFrom", pagIbig.MonthlyCompensationFrom);
            command.Parameters.AddWithValue("@MonthlyCompensationTo", pagIbig.MonthlyCompensationTo);
            command.Parameters.AddWithValue("@EmployeeShare", pagIbig.EmployeeShare);
            command.Parameters.AddWithValue("@EmployerShare", pagIbig.EmployerShare);
            command.Parameters.AddWithValue("@TotalMonthlyContribution", pagIbig.TotalMonthlyContribution);

            //update tableCourse from the dataSet
            dataAdapter.Update(dataSet, "PagIbig");
        }
        private void DeleteRecord(PagIbigs pagIbig, 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 = "bprocedureDeletePagIbig";
            dataAdapter.DeleteCommand = command;

            //set up parameters
            command.Parameters.AddWithValue("@PagIbigSalaryBracetNo", pagIbig.PagIbigSalaryBracetNo);
            //update tableCourse from the dataSet
            dataAdapter.Update(dataSet, "PagIbig");
        }
Beispiel #6
0
 public PagIbig()
 {
     InitializeComponent();
     admin   = new Admin();
     pagIbig = new PagIbigs();
 }