/// <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); }
public void Drop(IDropInfo dropInfo) { var sourceItem = dropInfo.Data as RedmineTimeEntry; //var targetItem = dropInfo.TargetItem as DayActivity; if (sourceItem == null || TimeEntries.Contains(sourceItem)) { return; } var timeEntryCopy = new TimeEntry { User = new IdentifiableName { Id = _user.Id }, Project = new IdentifiableName { Id = _project.ProjectInfo.Id }, Issue = new IdentifiableName { Id = sourceItem.TimeEntryInfo.Issue.Id, Name = sourceItem.TimeEntryInfo.Issue.Name }, Activity = new IdentifiableName { Id = sourceItem.TimeEntryInfo.Activity.Id, Name = sourceItem.TimeEntryInfo.Activity.Name }, SpentOn = Day, Hours = sourceItem.TimeEntryInfo.Hours, Comments = sourceItem.TimeEntryInfo.Comments, CreatedOn = DateTime.Now }; var entry = new RedmineTimeEntry(TimeEntryOrigin.NewInLogger, timeEntryCopy); Messenger.Default.Send(new AddNewTimeEntryMessage(entry)); }