public void EditRow(Taxs tax, int index)
 {
     //get selectedRow from the dataTable, tableCourse
     DataRow selectedRow = dataSet.Tables["Tax"].Rows[index];
     //replace values from course object
     selectedRow["TaxNo"] = tax.TaxNo;
     selectedRow["TaxFrom"] = tax.TaxFrom;
     selectedRow["TaxTo"] = tax.TaxTo;
     selectedRow["PercentOver"] = tax.PercentOver;
     selectedRow["TaxExemption"] = tax.TaxExemption;
     selectedRow["CivilStatus"] = tax.CivilStatus;
     selectedRow["Dependent"] = tax.Dependent;
     selectedRow["NoOfDependent"] = tax.NoOfDependent;
     EditRecord(tax, index);
 }
 public Tax()
 {
     InitializeComponent();
     admin = new Admin();
     tax = new Taxs();
 }
        public void DeleteRow(Taxs tax, int index)
        {
            //get selectedRow from the dataTable, tableCourse
            DataRow selectedRow = dataSet.Tables["Tax"].Rows[index];

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

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

            //set up parameters
            command.Parameters.AddWithValue("@TaxNo", tax.TaxNo);
            command.Parameters.AddWithValue("@TaxFrom", tax.TaxFrom);
            command.Parameters.AddWithValue("@TaxTo", tax.TaxTo);
            command.Parameters.AddWithValue("@PercentOver", tax.PercentOver);
            command.Parameters.AddWithValue("@TaxExemption", tax.TaxExemption);
            command.Parameters.AddWithValue("@CivilStatus", tax.CivilStatus);
            command.Parameters.AddWithValue("@Dependent", tax.Dependent);
            command.Parameters.AddWithValue("@NoOfDependent", tax.NoOfDependent);
            //update tableCourse from the dataSet
            dataAdapter.Update(dataSet, "Tax");
        }
        private void DeleteRecord(Taxs tax, 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 = "cprocedureDeleteTax";
            dataAdapter.DeleteCommand = command;

            //set up parameters
            command.Parameters.AddWithValue("@TaxNo", tax.TaxNo);
            //update tableCourse from the dataSet
            dataAdapter.Update(dataSet, "Tax");
        }
 public void AddRecord(Taxs tax)
 {
     connection.Open();
     //set up command
     SqlCommand command = new SqlCommand("cprocedureInsertTax", connection);
     //set up commandType
     command.CommandType = CommandType.StoredProcedure;
     //set up parameters
     command.Parameters.AddWithValue("@TaxFrom", tax.TaxFrom);
     command.Parameters.AddWithValue("@TaxTo", tax.TaxTo);
     command.Parameters.AddWithValue("@PercentOver", tax.PercentOver);
     command.Parameters.AddWithValue("@TaxExemption", tax.TaxExemption);
     command.Parameters.AddWithValue("@CivilStatus", tax.CivilStatus);
     command.Parameters.AddWithValue("@Dependent", tax.Dependent);
     command.Parameters.AddWithValue("@NoOfDependent", tax.NoOfDependent);
     command.ExecuteNonQuery();
     connection.Close();
 }
Example #7
0
 public Tax()
 {
     InitializeComponent();
     admin = new Admin();
     tax   = new Taxs();
 }