Example #1
0
 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);
         }
     }
 }
Example #2
0
 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();
     }
 }