Пример #1
0
 private void cmdDelete_Execute(object obj)
 {
     System.Windows.MessageBoxResult result = System.Windows.MessageBox.Show("Do you want to Delete it", "Confirmation", System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.Question, System.Windows.MessageBoxResult.No);
     if (result == System.Windows.MessageBoxResult.Yes)
     {
         try
         {
             if (obj is InvoiceDetailsService)
             {
                 InvoiceDetailsService invoiceDetails = obj as InvoiceDetailsService;
                 if (pxyInvoice.DeleteInvoiceDetails(invoiceDetails, Global.UserID))
                 {
                     UIHelper.ShowMessage("Data successfully deleted!");
                 }
             }
             else if (obj is ProductDetails)
             {
                 ProductDetails invoiceProduct = obj as ProductDetails;
                 if (pxyInvoice.DeleteInvoiceProduct(invoiceProduct, Global.UserID))
                 {
                     UIHelper.ShowMessage("Data successfully deleted!");
                 }
             }
             else if (obj is SettlementDetails)
             {
                 SettlementDetails invoiceSettlement = obj as SettlementDetails;
                 if (pxyInvoice.DeleteInvoiceSettlement(invoiceSettlement, Global.UserID))
                 {
                     UIHelper.ShowMessage("Data successfully deleted!");
                 }
             }
         }
         catch (FaultException ex)
         {
             UIHelper.ShowErrorMessage(ex.Message);
         }
     }
 }