private void Save_Click(object sender, RoutedEventArgs e)
        {
            if (CbNamaPenyusutan.Text == "" || TxtNamaPenyusutan.Text == "" || TxtUmur.Text == "" || TxtTotal.Text == "")
            {
                MessageBox.Show("please fill in the blank fields", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            double total = 0;

            for (int i = 0; i < MappingBindings.Count; i++)
            {
                var txt = (TextBox)this.MappingBindings[i].Control;
                total += double.Parse(txt.Text);
            }

            if (total != 100)
            {
                MessageBox.Show("Total cannot be more than 100%!");
                return;
            }

            TabelPenyusutanBLL tabelPenyusutanBLL = new TabelPenyusutanBLL();

            if (this.deprectiationTableForm.isEdit == false)
            {
                if (tabelPenyusutanBLL.AddTabelPenyusutan(this.GetData()) > 0)
                {
                    this.ClearForm();
                    MessageBox.Show("Depreciation Table added successfully !");
                    this.deprectiationTableForm.LoadTabelPenyusutan();
                }
                else
                {
                    MessageBox.Show("Depreciation Table failed to add !");
                }
            }
            else
            {
                if (tabelPenyusutanBLL.EditTabelPenyusutan(this.GetData()) == true)
                {
                    this.ClearForm();
                    MessageBox.Show("Depreciation Tables successfully changed !");
                    this.deprectiationTableForm.LoadTabelPenyusutan();
                }
                else
                {
                    MessageBox.Show("Depreciation Table failed to change !");
                }
            }
            this.Close();
        }
 private void Delete_Click(object sender, RoutedEventArgs e)
 {
     if (this.tabelPenyusutanSelected == null)
     {
         MessageBox.Show("Depreciation Table has not been selected !");
     }
     else
     {
         TabelPenyusutanBLL TabelPenyusutanBLL = new TabelPenyusutanBLL();
         if (TabelPenyusutanBLL.RemoveTabelPenyusutan(this.tabelPenyusutanSelected.Id) == true)
         {
             MessageBox.Show("Depreciation Table successfully deleted");
             this.LoadTabelPenyusutan();
             this.tabelPenyusutanSelected = null;
         }
     }
 }