private void save_Click(object sender, RoutedEventArgs e) { using (var context = new PsboContext()) { try { bool status = repo.Update(akun); if (status) { MessageBox.Show("Akun telah berhasil diedit", "Edit Akun", MessageBoxButton.OK, MessageBoxImage.Information); if (akun.Username == "admin") { menuadmin update = new test.menuadmin(); update.tabControl1.SelectedIndex = 2; update.Show(); this.Close(); } else { lihatakun update = new test.lihatakun(akun); update.Show(); this.Close(); } } else { MessageBox.Show("Gagal mengupdate akun, silahkan coba lagi", "Edit Akun", MessageBoxButton.OK, MessageBoxImage.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void save_Click(object sender, RoutedEventArgs e) { akun.Username = username.Text; akun.Password = password.Password; try { bool status = repo.tambah(akun); if (status) { repo.Add(akun); menuadmin update = new test.menuadmin(); update.tabControl1.SelectedIndex = 2; update.Show(); this.Close(); } else { MessageBox.Show("username sudah dipakai, coba username lain", "Error!", MessageBoxButton.OK, MessageBoxImage.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void cancelbaredit_Click(object sender, RoutedEventArgs e) { menuadmin update = new test.menuadmin(); update.tabControl1.SelectedIndex = 3; update.Show(); this.Close(); }
private void cancel_Click(object sender, RoutedEventArgs e) { if (akun.Username == "admin") { menuadmin update = new test.menuadmin(); update.tabControl1.SelectedIndex = 2; update.Show(); this.Close(); } else { lihatakun update = new test.lihatakun(akun); update.Show(); this.Close(); } }
private void savebar_Click(object sender, RoutedEventArgs e) { try { bool status = repobar.tambah(barang); if (status) { repobar.Add(barang); menuadmin update = new test.menuadmin(); update.tabControl1.SelectedIndex = 3; update.Show(); this.Close(); } else { MessageBox.Show("barang sudah ada"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }