Beispiel #1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (btnSave.Text == "Add")
     {
         var tax = new Tax
         {
             ID        = Guid.NewGuid(),
             Type      = txtType.Text,
             Value     = Decimal.Parse(txtValue.Text),
             EntryDate = DateTime.Now,
             Status    = "Active"
         };
         taxController.Add(tax);
         MessageBox.Show("Tax Added Sucessfully");
         grdProducts.DataSource = taxController.GetAllDataTable();
     }
     else
     {
         var tax = new Tax
         {
             ID        = Guid.NewGuid(),
             Type      = txtType.Text,
             Value     = Decimal.Parse(txtValue.Text),
             EntryDate = DateTime.Now,
             Status    = "Active"
         };
         taxController.Update(TaxID, tax);
         grdProducts.DataSource = dtProducts = taxController.GetAllDataTable();
         MessageBox.Show("Tax Updated Sucessfully");
     }
 }