protected virtual void ClearNavigationProperties() { InvoiceFiles.Clear(); InvoiceLines.Clear(); TimeEntries.Clear(); User = null; CustomerInvoiceGroup = null; CreditNote.Clear(); InvoiceComments.Clear(); }
private void ExecuteGetInvoicesFromMany(ObservableCollection <CustomersInvoiceView> t) { try { var tmp = new ObservableCollection <int>(); foreach (var customerInvoiceView in t) { tmp.Add(customerInvoiceView.CustomerID); } _dataService.GetInvoicesByCustomerId(tmp).Subscribe(i => { if (i != null) { Invoices = SeeAll == true ? TakeAll(i) : TakeOnlyNoneClosed(i); if (_lastInvoiceSelectedId != null && Invoices.Select(id => id.Id).Contains(_lastInvoiceSelectedId)) { SelectedInvoice = Invoices.First(x => x.Id == _lastInvoiceSelectedId); } if (SelectedInvoice != null && _lastInvoiceSelectedId != null) { LoadInvoiceLines(SelectedInvoice); LoadTimeEntries(SelectedInvoice); } else { TimeEntries.Clear(); InvoiceLines.Clear(); } } else { MessageBox.Show("Something went wrong in a call on the server", "Error", MessageBoxButton.OK); } }); } catch (Exception ex) { MessageBox.Show(ex.ToString()); throw; } }
public void LoadInvoiceLines(InvoiceListItemViewModel invoice) { if (invoice == null) { invoice = SelectedInvoice; } _dataService.GetInvoiceLinesByInvoiceID((int)invoice.Id).Subscribe( re => { if (InvoiceLines.Count > 0) { InvoiceLines.Clear(); } foreach (var invoiceLine in re) { invoiceLine.AcceptChanges(); InvoiceLines.Add(new InvoiceLineListItemViewModel(invoiceLine, _dataService)); } AddDummyInvoiceLines(); }); }