Esempio n. 1
0
        public SettingsViewModel(IAppSettings appSettings, IUserWlanSettingsService userWlanSettingsService,
                                 ITimeEntryTypeRepository timeEntryTypeRepository,
                                 IConnectivityService connectivityService,
                                 ITimeEntryRepository timeEntryRepository, ISelectTaskViewModel selectTaskViewModel,
                                 ITaskRepository taskRepository)
        {
            _appSettings             = appSettings;
            _userWlanSettingsService = userWlanSettingsService;
            _timeEntryTypeRepository = timeEntryTypeRepository;
            _connectivityService     = connectivityService;
            _timeEntryRepository     = timeEntryRepository;
            _taskRepository          = taskRepository;
            SelectTaskViewModel      = selectTaskViewModel;


            SaveCommand             = new DelegateCommand <object>(ExecuteSave);
            CancelCommand           = new DelegateCommand <object>(ExecuteCancel);
            Resync                  = new DelegateCommand <object>(ExecuteResync);
            ResetActiveTaskLayout   = new DelegateCommand <object>(ResetActiveTaskLayoutExecute);
            ResetInactiveTaskLayout = new DelegateCommand <object>(ResetInactiveTaskLayoutExecute);
            DeleteLocalData         = new DelegateCommand <object>(DeleteLocalDataExecute);
            ShowDataLocationFolder  = new DelegateCommand <object>(ShowDataLocationFolderExecute);
            DeleteFavoriteTask      = new DelegateCommand <TaskListViewModel>(DeleteFavoriteTaskExecute);

            favoriteTaskSelectedCommand = new DelegateCommand <Task>(FavoriteTaskSeleced);
            TaskCommands.TaskSelectCompleted.RegisterCommand(favoriteTaskSelectedCommand);
            FavoriteTasks = new ObservableCollection <TaskListViewModel>();
            FavoriteTasks.CollectionChanged += FavoriteTasksOnCollectionChanged;
            GetFavoriteTasks();
        }
Esempio n. 2
0
        public SaveTaskDialogViewModel(TimeEntry timeEntry,
                                       ITimeEntryTypeRepository timeEntryTypeRepository,
                                       ITimeEntryRepository timeEntryRepository,
                                       ITaskSearchService taskSearchService,
                                       IUserSession userSession,
                                       IAppSettings appSettings,
                                       IUserWlanSettingsService userWlanSettingsService, bool isEditing, ITaskRepository taskRepository)
        {
            _timeEntry = timeEntry;
            _timeEntryTypeRepository = timeEntryTypeRepository;
            _timeEntryRepository     = timeEntryRepository;
            _appSettings             = appSettings;
            _userWlanSettingsService = userWlanSettingsService;
            _isEditing = isEditing;

            SaveTask = new DelegateCommand <object>(ExecuteSaveTask, CanSaveTask);
            executeSelectTaskCommand = new DelegateCommand <Task>(ExecuteSelectTask);
            taskStoppedCommand       = new DelegateCommand <object>(TaskStopped);
            CloseCommand             = new DelegateCommand <object>(ExecuteClose);

            TaskCommands.TaskIdle.RegisterCommand(taskStoppedCommand);
            TaskCommands.TaskSelectCompleted.RegisterCommand(executeSelectTaskCommand);

            SelectTaskViewModel = new SelectTaskViewModel(taskSearchService, userSession, appSettings, taskRepository);

            LoadTimeEntryTypes();
            _isInSelectionMode = _timeEntry.Task == null;
            MinSelectedDate    = appSettings.MinTimeEntryDate;
        }
Esempio n. 3
0
        public HistoryFeedViewModel(IUserSession userSession, ISyncService syncService, ITimeEntryRepository timeEntryRepository,
                                    ITimeEntryTypeRepository timeEntryTypeRepository,
                                    IUserWlanSettingsService userWlanSettingsService,
                                    IAppSettings appSettings)
        {
            _userSession             = userSession;
            _syncService             = syncService;
            _timeEntryRepository     = timeEntryRepository;
            _timeEntryTypeRepository = timeEntryTypeRepository;
            _userWlanSettingsService = userWlanSettingsService;
            _appSettings             = appSettings;


            TimeEntries = new ObservableCollection <HistoryFeedRowViewModel>();
            ApplicationCommands.SyncCompleted.RegisterCommand(new DelegateCommand <object>(SyncComplete));
            ApplicationCommands.SyncProgressChanged.RegisterCommand(new DelegateCommand <Tuple <int, string> >(SyncProgressChanged));
            ApplicationCommands.SyncStarted.RegisterCommand(new DelegateCommand <object>(SyncStarted));
            TaskCommands.SaveTaskCompleted.RegisterCommand(new DelegateCommand <object>(TaskSaved));
            SyncInProgress = _syncService.SyncInProgress;
            ApplicationCommands.SyncFailed.RegisterCommand(new DelegateCommand <string>(SyncFailedCommand));
            CloseErrorMessageCommand = new DelegateCommand <object>(ExecuteCloseErrorMessage);
            CancelChanges            = new DelegateCommand <object>(CancelChangesExecute);

            TimeEntryTypes = _timeEntryTypeRepository.GetGlobal();

            ApplicationCommands.PremiseSettingChanged.RegisterCommand(new DelegateCommand <object>(SetDefaultType));
        }
        public ReportScreenMasterViewModel(ITimeEntryService timeEntryService, IBusyService busyService, IConnectivityService connectivityService,
                                           ITimeEntryTypeRepository timeEntryTypeRepository, ITimeEntryRepository timeEntryRepository, IAppSettings appSettings)
        {
            _timeEntryService        = timeEntryService;
            _busyService             = busyService;
            _connectivityService     = connectivityService;
            _timeEntryTypeRepository = timeEntryTypeRepository;
            _timeEntryRepository     = timeEntryRepository;
            _appSettings             = appSettings;
            Search = new DelegateCommand <object>(ExecuteSearch);
            _busyService.ShowBusy(_reportscreenKey);
            LoadPredefinedSearchItems();
            SelectedPredefinedSearch = PredefinedSearchItems[1];
            EditTimeEntryCommand     = new DelegateCommand <object>(EditTimeEntry);
            SaveCommand = new DelegateCommand <object>(SaveCommandExecute);

            try
            {
                TimeEntryTypes = _timeEntryTypeRepository.GetGlobal();
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }

            TaskCommands.SaveTaskCompleted.RegisterCommand(new DelegateCommand(Reload));
            TaskCommands.SaveTaskCancelled.RegisterCommand(new DelegateCommand(Reload));

            ApplicationCommands.ConnectivityChanged.RegisterCommand(new DelegateCommand <object>(ConnectivityChangedExecute));
        }
Esempio n. 5
0
        public WeeklyOverviewViewmodel(ITimeEntryService timeEntryService, IBusyService busyService, ITimeEntryRepository timeEntryRepository,
                                       ITaskItemViewmodelFactory taskItemViewmodelFactory, ITimeEntryTypeRepository timeEntryTypeRepository,
                                       ISyncService syncService, ICommonDialogs commonDialogs)
        {
            _timeEntryService = timeEntryService;
            //_busyService = busyService;
            _timeEntryRepository      = timeEntryRepository;
            _taskItemViewmodelFactory = taskItemViewmodelFactory;
            _timeEntryTypeRepository  = timeEntryTypeRepository;
            _syncService                    = syncService;
            _commonDialogs                  = commonDialogs;
            _syncCompletedCommand           = new DelegateCommand <object>(SyncCompletedExecute);
            PreviousDateCommand             = new DelegateCommand <object>(a => StartDate = StartDate.AddDays(-7));
            NextDayCommand                  = new DelegateCommand <object>(a => StartDate = StartDate.AddDays(7));
            TodayCommand                    = new DelegateCommand <object>(a => TodayCommandExecute());
            SwitchToDayViewCommand          = new DelegateCommand <object>(SwitchToDayViewCommandExecute);
            CopyPreviousTasksToSelectedDate = new DelegateCommand <object>(CopyPreviousTasksToSelectedDateExecute);
            AddTaskCommand                  = new DelegateCommand <object>(AddTaskCommandExecute);
            SaveCommand     = new DelegateCommand <object>(SaveCommandExecute);
            DeleteTimeEntry = new DelegateCommand <object>(DeleteTimeEntryExecute);
            ApplicationCommands.SyncCompleted.RegisterCommand(_syncCompletedCommand);
            TaskCommands.TaskSelectCompleted.RegisterCommand(new DelegateCommand <Task>(TaskSelectCompleted));
            TaskCommands.SaveTaskCancelled.RegisterCommand(new DelegateCommand <TimeEntry>(TaskSelectCompleted));

            Rows                    = new ObservableItemCollection <TaskItemViewmodel>();
            Rows.ItemChanged       += TasksOnItemChanged;
            _deletedRows            = new List <TaskItemViewmodel>();
            _timeEntriesForThisWeek = new List <TimeEntry>();

            TimeEntryTypes = _timeEntryTypeRepository.GetGlobal();
            StartDate      = DateTime.Today.FirstDayOfWeek();
        }
Esempio n. 6
0
 public TimeEntryService(IUserSession userSession, ITimeEntryRepository timeEntryRepository,
                         ITaskRepository taskRepository, ITimeEntryTypeRepository timeEntryTypeRepository,
                         IServiceStackClient serviceStackClient, ServiceFactory serviceFactory)
 {
     _userSession             = userSession;
     _timeEntryRepository     = timeEntryRepository;
     _taskRepository          = taskRepository;
     _timeEntryTypeRepository = timeEntryTypeRepository;
     _serviceFactory          = serviceFactory;
     _serviceStackClient      = serviceStackClient;
 }
Esempio n. 7
0
 public TimeEntryService(ITimeEntryRepository timeEntryRepository,
                         IUserRepository userRepository,
                         ITimeEntryTypeRepository timeEntryTypeRepository,
                         IPriceService priceService,
                         ITaskRepository taskRepository,
                         ITimeEntryFactory timeEntryFactory)
 {
     _timeEntryRepository     = timeEntryRepository;
     _userRepository          = userRepository;
     _timeEntryTypeRepository = timeEntryTypeRepository;
     _priceService            = priceService;
     _taskRepository          = taskRepository;
     _timeEntryFactory        = timeEntryFactory;
 }
Esempio n. 8
0
 public TrexSLService(IUserSession userSession, IUserRepository userRepository, IUserManagementService userManagementService,
                      IPermissionService permissionService, ITimeEntryRepository timeEntryRepository, ITaskRepository taskRepository, ITimeEntryFactory timeEntryFactory,
                      ITimeEntryTypeRepository timeEntryTypeRepository, IPriceService priceService, ITaskFactory taskFactory, IProjectRepository projectRepository,
                      ICustomerRepository customerRepository, IRoleManagementService roleManagementService, IMembershipProvider membershipProvider)
 {
     _userSession             = userSession;
     _userRepository          = userRepository;
     _userManagementService   = userManagementService;
     _permissionService       = permissionService;
     _timeEntryRepository     = timeEntryRepository;
     _taskRepository          = taskRepository;
     _timeEntryFactory        = timeEntryFactory;
     _timeEntryTypeRepository = timeEntryTypeRepository;
     _priceService            = priceService;
     _taskFactory             = taskFactory;
     _projectRepository       = projectRepository;
     _customerRepository      = customerRepository;
     _roleManagementService   = roleManagementService;
     _membershipProvider      = membershipProvider;
 }
Esempio n. 9
0
        public SyncService(IConnectivityService connectivityService, ICompanyService companyService, IProjectRepository projectRepository, ICompanyRepository companyRepository, IProjectService projectService,
                           ITaskService taskService, ITaskRepository taskRepository, ITimeEntryService timeEntryService, IUserSession userSession, IUserService userService, ITimeEntryTypeService timeEntryTypeService,
                           ITimeEntryTypeRepository timeEntryTypeRepository, IAppSettings appSettings, ITimeEntryRepository timeEntryRepository,
                           IBusyService busyService)
        {
            _dispatcherTimer            = new DispatcherTimer(DispatcherPriority.Normal);
            _dispatcherTimer.Tick      += DispatcherTimerTick;
            _connectivityService        = connectivityService;
            _timeEntryRepository        = timeEntryRepository;
            _busyService                = busyService;
            AppSettings                 = appSettings;
            TimeEntryTypeRepository     = timeEntryTypeRepository;
            TimeEntryTypeService        = timeEntryTypeService;
            UserService                 = userService;
            UserSession                 = userSession;
            TimeEntryService            = timeEntryService;
            TaskRepository              = taskRepository;
            TaskService                 = taskService;
            ProjectService              = projectService;
            CompanyRepository           = companyRepository;
            ProjectRepository           = projectRepository;
            CompanyService              = companyService;
            _startSyncCommand           = new DelegateCommand <object>(StartSync);
            _connectionChangedCommand   = new DelegateCommand <object>(ConnectionChanged);
            _resyncCommand              = new DelegateCommand <object>(Resync);
            _userLoggedInCommand        = new DelegateCommand <object>(UserLoggedIn);
            _userLoggedOutCommand       = new DelegateCommand <object>(UserLoggedOut);
            _synchronizenewTasksCommand = new DelegateCommand <object>(SynchronizeNewTasks);

            ApplicationCommands.StartSync.RegisterCommand(_startSyncCommand);
            ApplicationCommands.Resync.RegisterCommand(_resyncCommand);
            ApplicationCommands.LoginSucceeded.RegisterCommand(_userLoggedInCommand);
            ApplicationCommands.UserLoggedOut.RegisterCommand(_userLoggedOutCommand);
            ApplicationCommands.GetLatestTasks.RegisterCommand(_synchronizenewTasksCommand);
            ApplicationCommands.ConnectivityChanged.RegisterCommand(_connectionChangedCommand);
        }
Esempio n. 10
0
        private async Task <List <TimeEntry> > ConvertTimeEntriesFromServiceToModel(List <Common.DataTransferObjects.TimeEntryDto> timeentriesDtos,
                                                                                    ITaskRepository taskRepository, ITimeEntryTypeRepository timeEntryTypeRepository)
        {
            var timeEntries = new List <TimeEntry>();

            var inactiveTasksWithTimeEntriesInPeriod = await _serviceStackClient.PostAsync(new GetTasksByIdRequest
            {
                TaskIds = timeentriesDtos.Where(x => x.TaskIsInactive).Select(x => x.TaskId).ToList()
            });

            foreach (var timeEntryDtos in timeentriesDtos.GroupBy(x => x.TaskGuid))
            {
                Core.Model.Task localTask;

                var taskIsInactive = timeEntryDtos.Select(x => x.TaskIsInactive).First();
                if (taskIsInactive)
                {
                    var fullTaskDto = inactiveTasksWithTimeEntriesInPeriod.Tasks.Single(x => x.Guid == timeEntryDtos.Key);
                    localTask = CreateLocalTask(fullTaskDto);
                }
                else
                {
                    localTask = taskRepository.GetByGuid(timeEntryDtos.Key);
                }

                foreach (var timeEntryDto in timeEntryDtos)
                {
                    var timeEntryType = timeEntryTypeRepository.GetById(timeEntryDto.TimeEntryTypeId);
                    if (localTask != null)
                    {
                        timeEntries.Add(Create(timeEntryDto, localTask, timeEntryType));
                    }
                    else
                    {
                        throw new MissingHieracleDataException(string.Format("Could not find task {0} for timeEntry '{1} ({2})'",
                                                                             timeEntryDto.TaskGuid, timeEntryDto.TaskName, timeEntryDto.Id));
                    }
                }
            }
            return(timeEntries);
        }
Esempio n. 11
0
 public TaskItemViewmodelFactory(ITimeEntryTypeRepository timeEntryTypeRepository)
 {
     _timeEntryTypeRepository = timeEntryTypeRepository;
 }
Esempio n. 12
0
 public ClientTimeEntryRepository(ITaskRepository taskRepository, ITimeEntryTypeRepository timeEntryTypeRepository, DataSetWrapper dataSetWrapper)
 {
     _dataWrapper             = dataSetWrapper;
     _taskRepository          = taskRepository;
     _timeEntryTypeRepository = timeEntryTypeRepository;
 }