public override object Execute() { m_invoiceToDelete.DeleteItem(); m_invoiceToDelete.DeleteDatabaseRecord(); m_invoices.Remove(m_invoiceToDelete); return(null); }
/// <summary> /// Удаление элемента накладной /// </summary> private void DoDeleteItem_Execute(object sender, ExecutedRoutedEventArgs e) { InvoiceItem item = dataGrid.SelectedItem as InvoiceItem; if (item != null) { if (Dialog.QuestionMessage(this, "Удалить позицию " + item.Product.ProductCode + "?", "Внимание!") != MessageBoxResult.Yes) { return; } Mouse.OverrideCursor = Cursors.Wait; if (InvoiceItem.DeleteItem(item.ID, CurrentInvoice.IsPurchase)) { CurrentInvoice.Items.Remove(item); GetFreeProductList(); CurrentInvoice.Calc(); CurrentInvoice.EditInvoice(); dataGrid.Items.Refresh(); Dialog.TransparentMessage(this, "Операция выполнена"); } Mouse.OverrideCursor = null; } }