コード例 #1
0
 private void btnDeactivateCard_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (this.dgCardCollection.SelectedItems.Count > 0)
         {
             if (((Card)this.dgCardCollection.SelectedItem).Active == false)
             {
                 MessageBox.Show("This Card is already inactive.");
             }
             else
             {
                 MessageBoxResult result = MessageBox.Show("Are you sure you want to Deactivate Card " +
                                                           ((Card)this.dgCardCollection.SelectedItem).Name + "?", "Deactivation Warning", MessageBoxButton.YesNo);
                 if (result == MessageBoxResult.No)
                 {
                     return;
                 }
                 _cardManager.DeactivateCardByID(((Card)this.dgCardCollection.SelectedItem).CardID);
                 refreshCardCollection();
             }
         }
         else
         {
             MessageBox.Show("You must select a card.");
         }
     }
     catch (Exception ex)
     {
         var message = ex.Message + "\n\n" + ex.InnerException;
         MessageBox.Show(message, "Deactivation Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
     }
 }
コード例 #2
0
 // GET: Card/Delete/5
 public ActionResult Delete(int id)
 {
     _cdMgr.DeactivateCardByID(id);
     return(RedirectToAction("Index"));
 }