private void addTimeEntries(TimeEntryViewModelCollection collection) { IsWelcome = false; TimeEntries.Add(collection); RaisePropertyChanged(nameof(IsEmpty)); }
/// <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); }
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)); } }); } }
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(); }
public void AddTimeEntry(TimeEntry timeEntry) { TimeEntries.Add(timeEntry); }
public void Start() { TimeEntries.Add(new TimeEntry()); TimeEntries[TimeEntries.Count - 1].Start = DateTime.Now; IsActive = true; }