private void Delete_Click(object sender, RoutedEventArgs e) { if (this.DataProyekSelected == null) { MessageBox.Show("Project not selected !"); } else { DataProyekBLL DataProyekBLL = new DataProyekBLL(); this.DataProyekSelected.CheckboxInAtive = true; if (DataProyekBLL.EditDataProyek(this.DataProyekSelected) == true) { MessageBox.Show("Project successfully deleted"); this.LoadDataProyek(""); this.DataProyekSelected = null; } } }
private void BtnSave_Click(object sender, RoutedEventArgs e) { if (txtProjectno.Text == "" || txtProjectName.Text == "" || CbCustomer.Text == "" || CbPIC.Text == "" || CbCurrency.Text == "" || txtContractPrice.Text == "" || DpStartDate.Text == "" || DpEndDate.Text == "" || CbStatus.Text == "" || txtRemarks.Text == "") { MessageBox.Show("please fill in the blank fields", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error); return; } DataProyekBLL DataProyekBLL = new DataProyekBLL(); if (this.ProjectForm.isEdit == false) { if (DataProyekBLL.AddDataProyek(this.GetData()) > 0) { this.ClearForm(); MessageBox.Show("Project successfully added !"); this.ProjectForm.LoadDataProyek(""); } else { MessageBox.Show("Project failed to add !"); } } else { if (DataProyekBLL.EditDataProyek(this.GetData()) == true) { this.ClearForm(); MessageBox.Show("Project successfully changed !"); this.ProjectForm.LoadDataProyek(""); } else { MessageBox.Show("Project failed to change !"); } } Project v = new Project(); Switcher.Switchnewproject(v); }