private void Save_Click(object sender, RoutedEventArgs e) { if (txtDescription.Text == "" || txtDocumentType.Text == "") { MessageBox.Show("please fill in the blank fields", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error); return; } TypeDokumenBLL typeDokumenBLL = new TypeDokumenBLL(); TypeDokumen oData = new TypeDokumen(); oData.Type = txtDocumentType.Text; oData.Keterangan = txtDescription.Text; if (typeDokumenBLL.AddTypeDokumen(oData) > 0) { this.ClearForm(); MessageBox.Show("Document Type successfully saved"); this.documentTypeForm.LoadTypeDokumen(); } else { MessageBox.Show("Document Type failed to save"); } this.Close(); }
private void Delete_Click(object sender, RoutedEventArgs e) { if (this.typeDokumenSelected == null) { MessageBox.Show("Document Type is not selected !"); } else { TypeDokumenBLL TypeDokumenBLL = new TypeDokumenBLL(); if (TypeDokumenBLL.RemoveTypeDokumen(this.typeDokumenSelected.Id) == true) { MessageBox.Show("Document Type successfully deleted"); this.LoadTypeDokumen(); this.typeDokumenSelected = null; } } }