private void SaveTimeSpends(ITimeEntry[] timeEntries)
        {
            TimeTrackingEngine timeTrackingEngine = _engineFactory.GetTimeTrackingEngine();

            foreach (var timeEntry in timeEntries)
            {
                try
                {
                    TimeSpend newTimeSpend = new TimeSpend()
                    {
                        Hours = (float)timeEntry.Hours,
                        Date  = timeEntry.Date,
                        Note  = timeEntry.Description,
                        Task  = new Task {
                            ID = timeEntry.ToDoItemID != -1 ? FindTask(timeEntry.ToDoItemID) : 0, Project = new Project {
                                ID = FindProject(timeEntry.ProjectID)
                            }
                        },
                        Person = FindUser(timeEntry.PersonID)
                    };

                    timeTrackingEngine.SaveOrUpdate(newTimeSpend, true);
                }
                catch (Exception e)
                {
                    Status.LogError(string.Format(SettingsResource.FailedToSaveTimeSpend, timeEntry.ID), e);
                    LogError(string.Format("time spend '{0}' failed", timeEntry.ID), e);
                }
            }
        }
Exemple #2
0
 protected TimeSpend SaveOrUpdate(TimeSpend timeSpend)
 {
     return(TimeTrackingEngine.SaveOrUpdate(timeSpend));
 }