예제 #1
0
        public async Task <TimeEntry> LogTime(RedmineTimeEntry entry)
        {
            if (entry.Origin == TimeEntryOrigin.RedmineService)
            {
                throw new InvalidOperationException("Cannot log time entries originated from Redmine service");
            }
            var savedEntry = await LogTime(entry.TimeEntryInfo);

            return(savedEntry);
        }
예제 #2
0
        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));
        }