예제 #1
0
        public override async Task Initialize(long[] timeEntryIds)
        {
            await base.Initialize(timeEntryIds);

            if (timeEntryIds == null || timeEntryIds.Length == 0)
            {
                throw new ArgumentException("Edit view has no Time Entries to edit.");
            }

            TimeEntryIds = timeEntryIds;

            var timeEntries = await interactorFactory.GetMultipleTimeEntriesById(TimeEntryIds).Execute();

            var timeEntry = timeEntries.First();

            originalTimeEntry = timeEntry;

            projectId = timeEntry.Project?.Id;
            taskId    = timeEntry.Task?.Id;
            workspaceIdSubject.OnNext(timeEntry.WorkspaceId);

            Description.Accept(timeEntry.Description);

            projectClientTaskSubject.OnNext(new ProjectClientTaskInfo(
                                                timeEntry.Project?.DisplayName(),
                                                timeEntry.Project?.DisplayColor(),
                                                timeEntry.Project?.Client?.Name,
                                                timeEntry.Task?.Name,
                                                timeEntry.Project?.IsPlaceholder() ?? false,
                                                timeEntry.Task?.IsPlaceholder() ?? false));

            isBillableSubject.OnNext(timeEntry.Billable);

            startTimeSubject.OnNext(timeEntry.Start);

            durationSubject.OnNext(timeEntry.TimeSpanDuration());

            GroupDuration = timeEntries.Sum(entry => entry.TimeSpanDuration());

            tagsSubject.OnNext(timeEntry.Tags?.ToImmutableList() ?? ImmutableList <IThreadSafeTag> .Empty);

            isInaccessibleSubject.OnNext(timeEntry.IsInaccessible);

            setupSyncError(timeEntries);
        }
예제 #2
0
        public override async Task Initialize()
        {
            stopwatchFromCalendar = stopwatchProvider.Get(MeasuredOperation.EditTimeEntryFromCalendar);
            stopwatchProvider.Remove(MeasuredOperation.EditTimeEntryFromCalendar);
            stopwatchFromMainLog = stopwatchProvider.Get(MeasuredOperation.EditTimeEntryFromMainLog);
            stopwatchProvider.Remove(MeasuredOperation.EditTimeEntryFromMainLog);

            var timeEntries = await interactorFactory.GetMultipleTimeEntriesById(TimeEntryIds).Execute();

            var timeEntry = timeEntries.First();

            originalTimeEntry = timeEntry;

            projectId = timeEntry.Project?.Id;
            taskId    = timeEntry.Task?.Id;
            workspaceIdSubject.OnNext(timeEntry.WorkspaceId);

            Description.Accept(timeEntry.Description);

            projectClientTaskSubject.OnNext(new ProjectClientTaskInfo(
                                                timeEntry.Project?.DisplayName(),
                                                timeEntry.Project?.DisplayColor(),
                                                timeEntry.Project?.Client?.Name,
                                                timeEntry.Task?.Name));

            isBillableSubject.OnNext(timeEntry.Billable);

            startTimeSubject.OnNext(timeEntry.Start);

            durationSubject.OnNext(timeEntry.TimeSpanDuration());

            GroupDuration = timeEntries.Sum(entry => entry.TimeSpanDuration());

            tagsSubject.OnNext(timeEntry.Tags?.ToImmutableList() ?? ImmutableList <IThreadSafeTag> .Empty);

            isInaccessibleSubject.OnNext(timeEntry.IsInaccessible);

            setupSyncError(timeEntries);
        }