Instantly share code, notes, and snippets.

Embed
What would you like to do?
var exclusionList = new List<string>(new string[] { "projects-403",
"projects-547",
"projects-561",
"projects-562",
"projects-961",
"projects-645",
"projects-897",
"projects-643",
"projects-517",
"projects-518",
"projects-519",
"projects-515",
"projects-516",
"projects-514",
"projects-239",
"projects-612",
"projects-620"} );
var startingProjectId = 420;
var batchSize = 100;
var projectIdFormat = "projects-{0}";
this.Advanced.MaxNumberOfRequestsPerSession = 1024;
for (var i = startingProjectId; i <= (startingProjectId + batchSize); i++)
{
var projectId = String.Format(projectIdFormat, i);
if (!exclusionList.Contains(projectId))
{
Console.WriteLine("Project not in exclusionList, querying for project... " + projectId);
var releaseList = from r in Query<Release>()
where r.ProjectId.Equals(projectId)
select r;
foreach (var release in releaseList)
{
var currentProcessName = release.ProjectDeploymentProcessSnapshotId;
var splitProcessName = (currentProcessName.Split('-'));
var parsedProcessId = splitProcessName[4];
var updatedProcessId = (Int32.Parse(parsedProcessId)) + 1;
var updatedProcessName = splitProcessName[0] + "-" + splitProcessName[1] + "-" + splitProcessName[2] + "-" + splitProcessName[3] + "-" + updatedProcessId;
Console.WriteLine("currentProcessName = " + currentProcessName + ", updatedProcessName = " + updatedProcessName);
release.ProjectDeploymentProcessSnapshotId = updatedProcessName;
}
SaveChanges();
}
else
{
Console.WriteLine("Project in exclusionList, skipping project... " + projectId);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment