Пример #1
0
 public IObservable <Unit> Execute()
 => interactorFactory.GetTimeEntryById(id)
 .Execute()
 .Select(TimeEntry.DirtyDeleted)
 .Select(te => te.UpdatedAt(timeService.CurrentDateTime))
 .SelectMany(dataSource.Update)
 .SelectUnit();
Пример #2
0
 private IObservable <IThreadSafeTimeEntry> continueTimeEntry(ContinueTimeEntryInfo continueInfo)
 {
     return(interactorFactory.GetTimeEntryById(continueInfo.Id).Execute()
            .SubscribeOn(schedulerProvider.BackgroundScheduler)
            .Select(timeEntry => timeEntry.AsTimeEntryPrototype())
            .SelectMany(prototype =>
                        interactorFactory.ContinueTimeEntryFromMainLog(
                            prototype,
                            continueInfo.ContinueMode,
                            continueInfo.IndexInLog,
                            continueInfo.DayInLog,
                            continueInfo.DaysInThePast).Execute())
            .Do(_ => OnboardingStorage.SetTimeEntryContinued()));
 }
Пример #3
0
        public static async Task Update(this DeeplinkUpdateTimeEntryParameters parameters, IInteractorFactory interactorFactory, ITimeService timeService)
        {
            var timeEntryId = parameters.TimeEntryId;
            var workspaceId = parameters.WorkspaceId;
            var startTime   = parameters.StartTime ?? timeService.CurrentDateTime;
            var stopTime    = parameters.StopTime;
            var description = parameters.Description;
            var projectId   = parameters.ProjectId;
            var taskId      = parameters.TaskId;
            var tagIds      = parameters.TagIds;
            var isBillable  = parameters.IsBillable ?? false;

            var timeEntryToUpdate = await interactorFactory.GetTimeEntryById(timeEntryId).Execute();

            if (!workspaceId.HasValue)
            {
                var defaultWorkspace = await interactorFactory.GetDefaultWorkspace().Execute();

                workspaceId = defaultWorkspace.Id;
            }

            var newWorkspaceId = parameters.HasWorkspaceId ? workspaceId.Value : timeEntryToUpdate.WorkspaceId;
            var newStartTime   = parameters.HasStartTime ? startTime : timeEntryToUpdate.Start;
            var newStopTime    = parameters.HasStopTime ? stopTime : timeEntryToUpdate.StopTime();
            var newDescription = parameters.HasDescription ? description : timeEntryToUpdate.Description;
            var newProjectId   = parameters.HasProjectId ? projectId : timeEntryToUpdate.ProjectId;
            var newTaskId      = parameters.HasTaskId ? taskId : timeEntryToUpdate.TaskId;
            var newTagIds      = parameters.HasTagIds ? tagIds : timeEntryToUpdate.TagIds;
            var newIsBillable  = parameters.HasIsBillable ? isBillable : timeEntryToUpdate.Billable;

            var editTimeEntryDto = new EditTimeEntryDto
            {
                Id          = timeEntryId,
                WorkspaceId = newWorkspaceId,
                StartTime   = newStartTime,
                StopTime    = newStopTime,
                Description = newDescription,
                ProjectId   = newProjectId,
                TaskId      = newTaskId,
                TagIds      = newTagIds,
                Billable    = newIsBillable,
            };

            await interactorFactory.UpdateTimeEntry(editTimeEntryDto).Execute();
        }
 public IObservable <IThreadSafeTimeEntry> Execute()
 => interactorFactory.GetTimeEntryById(dto.Id)
 .Execute()
 .Select(createUpdatedTimeEntry)
 .SelectMany(dataSource.TimeEntries.Update)
 .Do(dataSource.SyncManager.InitiatePushSync);