private void addTimeEntries(TimeEntryViewModelCollection collection)
        {
            IsWelcome = false;

            TimeEntries.Add(collection);

            RaisePropertyChanged(nameof(IsEmpty));
        }
Exemple #2
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);
        }
Exemple #3
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));
                    }
                });
            }
        }
Exemple #4
0
        private void AddItem()
        {
            TimeEntry item = new TimeEntry().Default(Start);

            item.Task = new TagIdentifier()
            {
                Display = SelectedTask.Display,
                Id      = SelectedTask.Model.Id,
                Token   = SelectedTask.Status.Display
            };
            item.Activity = new TagIdentifier()
            {
                Display = SelectedActivity.Display,
                Id      = SelectedActivity.Id,
                Token   = SelectedActivity.Token
            };
            item.Minutes = Minutes;
            item.Comment = Comment;
            TimeEntryViewModel vm = new TimeEntryViewModel(item);

            TimeEntries.Add(vm);
            RefreshItem();
            Message = item.ToDisplay();
        }
Exemple #5
0
 public void AddTimeEntry(TimeEntry timeEntry)
 {
     TimeEntries.Add(timeEntry);
 }
Exemple #6
0
 public void Start()
 {
     TimeEntries.Add(new TimeEntry());
     TimeEntries[TimeEntries.Count - 1].Start = DateTime.Now;
     IsActive = true;
 }