Skip to content

Instantly share code, notes, and snippets.

@nicwise
Created November 4, 2011 08:34
Show Gist options
  • Save nicwise/1338923 to your computer and use it in GitHub Desktop.
Save nicwise/1338923 to your computer and use it in GitHub Desktop.
public bool UploadProjects(BaseSyncProgress syncProgress)
{
// then map the pending TS's, and insert
bool res = true;
try
{
List<PendingProject> projects = new List<PendingProject>();
Util.Log("Creating pending contacts");
int count = 1;
foreach(var project in PendingProjects)
{
syncProgress.UpdateProgress("Sending project changes", string.Format("{0}", project.UpdateDescription));
count++;
if (freeAgentService.CreateProject(project))
{
projects.Add(project);
Util.Log("Created project:{0} ", project.UpdateDescription);
} else {
Util.Log("Failed to create project:{0} ", project.UpdateDescription);
res = false;
}
syncProgress.ShouldSync = true;
}
Util.Log("Clearing Pending projects");
ClearPendingItems<PendingProject>(projects);
} finally {
}
return res;
}
public void ClearPendingItems<T>(IEnumerable<T> items)
{
foreach(var item in items)
{
connection.Delete<T>(item);
}
}
// connection is a Sqlite-net (Frank K's cool micro-orm), so it's calling into an external LIB in there!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment