public static HarvestTimeSheetEntry CreateFromHarvestEntry(DateTime dateOfEntry, decimal hours, string userId, string projectId, string taskId, string notes, bool billable) { var result = new HarvestTimeSheetEntry(); result.UserId = userId; result.ProjectId = projectId; result.TaskId = taskId; result.Billable = billable; result.Notes = notes; result.DateOfEntry = dateOfEntry; result.Hours = hours; return result; }
private string GenerateLine( HarvestTimeSheetEntry entry, IEnumerable<HarvestProject> projects, IEnumerable<HarvestClient> clients, IEnumerable<HarvestPeople> people, IEnumerable<HarvestTask> tasks) { var project = projects.Single(p => p.ProjectId == entry.ProjectId); var client = clients.Single(c => c.ClientId == project.ClientId); var person = people.Single(p => p.PersonId == entry.UserId); var task = tasks.Single(t => t.TaskId == entry.TaskId); var result = new List<string>(); result.Add(entry.DateOfEntry.ToString("dd-MM-yyyy hh:mm:ss")); result.Add(entry.Hours.FormatAsTime()); result.Add(client.Address); result.Add(project.Notes); result.Add(task.Name); result.Add(person.FullName); result.Add(string.Empty); result.Add(task.IsBillable ? "true" : "false"); return BeginningOfLine + string.Join(Separator, result) + EndOfLine; }