Skip to content

Instantly share code, notes, and snippets.

@fnbk
Last active September 22, 2022 13:23
Show Gist options
  • Save fnbk/46a239e477234a69a19f70a08af7ab96 to your computer and use it in GitHub Desktop.
Save fnbk/46a239e477234a69a19f70a08af7ab96 to your computer and use it in GitHub Desktop.
dirty
private async Task<Job> CreateJob(order order)
{
Job job = new Job
{
ActivationTime = order.ClientLocalStartTime,
ComputerName = order.ComputerName,
orderId = order.Id,
Status = "created"
};
if (ValidateComputer(order, null, _serverSecret))
{
Computer computer = GetComputer(order.ComputerName, order.CustomerId);
string serverAddress = GetServerAddress(order.ComputerName, computer.CustomerId);
if (!string.IsNullOrWhiteSpace(serverAddress))
{
List<JobAction> actions = await CheckForReleaseAndCreateActionAsync(order, computer);
if (!actions.Any())
{
actions = await CheckForBundleAndCreateActionsAsync(order, computer);
}
if (!actions.Any())
{
actions = await CheckForCollectionAndCreateActionsAsync(order, computer);
}
if (!actions.Any())
{
actions = await CheckForApplicationAndCreateActionsAsync(order, computer);
}
foreach (JobAction action in actions)
{
action.SiteServer = serverAddress;
}
job.JobActions = actions;
}
else
{
job.Status = "Failed, site server not found.";
}
}
return job;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment