Esempio n. 1
0
 protected virtual void ClearNavigationProperties()
 {
     Project = null;
     Tag     = null;
     User    = null;
     TimeEntries.Clear();
     Tasks1.Clear();
     Tasks.Clear();
 }
Esempio n. 2
0
 protected virtual void ClearNavigationProperties()
 {
     InvoiceFiles.Clear();
     InvoiceLines.Clear();
     TimeEntries.Clear();
     User = null;
     CustomerInvoiceGroup = null;
     CreditNote.Clear();
     InvoiceComments.Clear();
 }
Esempio n. 3
0
 protected virtual void ClearNavigationProperties()
 {
     Customers.Clear();
     Invoices.Clear();
     Projects.Clear();
     Tasks.Clear();
     TimeEntries.Clear();
     TimeEntries1.Clear();
     UsersCustomers.Clear();
     Projects1.Clear();
     Customers_1.Clear();
     InvoiceComments.Clear();
 }
Esempio n. 4
0
        private async Task reset()
        {
            TimeEntries.Clear();

            var timeEntries = await dataSource.TimeEntries.GetAll();

            timeEntries
            .Where(isNotRunning)
            .OrderByDescending(te => te.Start)
            .Select(te => new TimeEntryViewModel(te))
            .GroupBy(te => te.Start.LocalDateTime.Date)
            .Select(grouping => new TimeEntryViewModelCollection(grouping.Key, grouping))
            .ForEach(addTimeEntries);
        }
Esempio n. 5
0
        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;
            }
        }
Esempio n. 6
0
        private async Task fetchSectionedTimeEntries()
        {
            var timeEntries = await interactorFactory.GetAllNonDeletedTimeEntries().Execute();

            if (timeEntries == null)
            {
                TimeEntries.Clear();
                return;
            }

            var groupedEntries = timeEntries
                                 .Where(isNotRunning)
                                 .OrderByDescending(te => te.Start)
                                 .Select(te => new TimeEntryViewModel(te, durationFormat))
                                 .GroupBy(te => te.StartTime.LocalDateTime.Date)
                                 .Select(grouping => new TimeEntryViewModelCollection(grouping.Key, grouping, durationFormat));

            TimeEntries.ReplaceWith(groupedEntries);
        }
Esempio n. 7
0
        /// <summary>
        /// Update the entries on the page
        /// </summary>
        /// <returns></returns>
        private async Task UpdateEntries()
        {
            UpdateRunningTimeEntry();
            if (!App.Data.TimeEntries.Any())
            {
                await App.Data.Synchronice();
            }

            TimeEntries.Clear();
            foreach (TimeEntry entry in App.Data.TimeEntries)
            {
                TimeEntryByDateViewModel model = TimeEntries.Where(x => x.Date == entry.Start.Date).DefaultIfEmpty(new TimeEntryByDateViewModel(entry.Start.Date)).First();
                model.Entries.Add(entry);
                if (!TimeEntries.Contains(model))
                {
                    TimeEntries.Add(model);
                }
            }
            TimeEntries.OrderBy(x => x.Date);
        }
Esempio n. 8
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. 9
0
 protected virtual void ClearNavigationProperties()
 {
     Customer = null;
     TimeEntries.Clear();
 }
Esempio n. 10
0
 protected virtual void ClearNavigationProperties()
 {
     TimeEntries.Clear();
 }