Esempio n. 1
0
        private void LoadTimeEntries(InvoiceListItemViewModel invoice)
        {
            if (invoice.InvoiceID == "Draft" && !invoice.IsCreditNote)
            {
                _dataService.GetInvoiceDataByInvoiceId(invoice.Id.GetValueOrDefault()).Subscribe(
                    re =>
                {
                    if (TimeEntries.Count > 0)
                    {
                        TimeEntries.Clear();
                    }

                    foreach (var timeEntry in re)
                    {
                        timeEntry.AcceptChanges();
                        TimeEntries.Add(new TimeEntryListItemViewModel(timeEntry, SelectedInvoice.Invoice,
                                                                       _userRepository, _dataService));
                    }
                });
            }
            else
            {
                _dataService.GetFinalizedInvoiceDataByInvoiceId(invoice.Id.GetValueOrDefault()).Subscribe(
                    re =>
                {
                    if (TimeEntries.Count > 0)
                    {
                        TimeEntries.Clear();
                    }

                    foreach (var timeEntry in re)
                    {
                        timeEntry.AcceptChanges();
                        TimeEntries.Add(new TimeEntryListItemViewModel(timeEntry, SelectedInvoice.Invoice,
                                                                       _userRepository, _dataService));
                    }
                });
            }
        }
Esempio n. 2
0
 public void RemoveInvoiceFromInvoicesList(InvoiceListItemViewModel obj)
 {
     Invoices.Remove(obj);
 }