Esempio n. 1
0
        private void SaveTimeEntry(TimeEntry obj)
        {
            //Clear the object graph, in order to save bandwidth
            var task = TimeEntry.Task;

            TimeEntry.Task = null;
            TimeEntry.ChangeTracker.OriginalValues.Clear();

            _dataService.SaveTimeEntry(TimeEntry).Subscribe(
                timeEntry =>
            {
                if (_isNew)
                {
                    TimeEntry.TimeEntryID = timeEntry.TimeEntryID;
                    TimeEntry.CreateDate  = timeEntry.CreateDate;
                    TimeEntry.ChangeDate  = timeEntry.ChangeDate;
                    TimeEntry.Task        = task;
                    TimeEntry.AcceptChanges();
                    InternalCommands.TimeEntryAddCompleted.Execute(TimeEntry);
                }
                else
                {
                    TimeEntry.ChangeDate = timeEntry.ChangeDate;
                    TimeEntry.Task       = task;
                    TimeEntry.AcceptChanges();

                    InternalCommands.TimeEntryEditCompleted.Execute(TimeEntry);
                }

                _dataService.UpdateTimeEntryPrice(TimeEntry.Task.ProjectID).Subscribe();
            }


                );
        }
Esempio n. 2
0
        private void TimeEntryDeleteStart(TimeEntry obj)
        {
            var confirmBox = MessageBox.Show(TextResources.ConfirmDeleteTimeEntryLabel,
                                             TextResources.ConfirmDeleteBoxTitle,
                                             MessageBoxButton.OKCancel);

            if (confirmBox == MessageBoxResult.OK)
            {
                obj.MarkAsDeleted();
                obj.ChangeTracker.ChangeTrackingEnabled = false;
                obj.ChangeTracker.OriginalValues.Clear();
                obj.Task = null;
                _dataService.DeleteTimeEntry(obj).Subscribe(
                    timeEntryId =>
                {
                    obj.AcceptChanges();
                    InternalCommands.TimeEntryDeleteCompleted.Execute(obj.TimeEntryID);
                }
                    );
            }
        }