public IActionResult Create(SubmissionModel model) { if (!this.User.IsAuthenticated) { return(this.RedirectToLogin()); } if (!this.IsValidModel(model)) { this.ShowError(ErrorConstants.SubmissionCodeError); return(this.View()); } BuildResultType type = BuildResultType.BuildFailed; Random random = new Random(); int randomType = random.Next(0, 101); if (randomType > 70) { type = BuildResultType.BuildSuccess; } this.submissionService.Create(model.Code, model.Contest, this.Profile.Id, type); return(this.Redirect("/submissions/all")); }
public BuildResult( BuildResultType type, Action <DocX>[] buildActions) { Type = type; BuildActions = buildActions; }
public static IEnvLocalFeed GetFeed(this IEnvLocalFeedProvider @this, BuildResultType type) { switch (type) { case BuildResultType.Local: return(@this.Local); case BuildResultType.CI: return(@this.CI); case BuildResultType.Release: return(@this.Release); } return(null); }
public static string ToFriendlyName(this BuildResultType type) { switch (type) { case BuildResultType.BuildFailed: return("Build Failed"); case BuildResultType.BuildSuccess: return("Build Success"); default: throw new InvalidOperationException($"Invalid position type {type}."); } }
public static string SetTypeColor(this BuildResultType type) { switch (type) { case BuildResultType.BuildFailed: return("danger"); case BuildResultType.BuildSuccess: return("success"); default: throw new InvalidOperationException($"Invalid log type {type}."); } }
protected Builder( ZeroBuilder zeroBuilder, BuildResultType type, ArtifactCenter artifacts, IEnvLocalFeedProvider localFeedProvider, IWorldSolutionContext ctx) { ZeroBuilder = zeroBuilder ?? throw new ArgumentNullException(nameof(zeroBuilder)); _type = type; _artifacts = artifacts ?? throw new ArgumentNullException(nameof(artifacts)); _localFeedProvider = localFeedProvider ?? throw new ArgumentNullException(nameof(localFeedProvider)); DependentSolutionContext = ctx ?? throw new ArgumentNullException(nameof(ctx)); _packagesVersion = new Dictionary <Artifact, SVersion>(); _upgrades = new List <UpdatePackageInfo> [ctx.Solutions.Count]; _targetVersions = new SVersion[ctx.Solutions.Count]; }
public void Create(string code, string contest, int userId, BuildResultType type) { int?contestId = this.database.Contests.Where(c => c.Name == contest).FirstOrDefault().Id; if (contestId == null) { return; } Submission submission = new Submission { Code = code, ContestId = contestId.Value, UserId = userId, BuildResultType = type }; this.database.Submissions.Add(submission); this.database.SaveChanges(); }
public BuildResult( BuildResultType Type ) { this.Type = Type; }
BuildResult( BuildResultType type, IReadOnlyList <(ArtifactInstance Artifact, string SolutionName, string TargetName)> g,
/// <summary> /// Initializes a new instance of the <see cref="EmailSubject" /> class. /// </summary> /// <param name="result">The result.</param> /// <param name="value">The value.</param> /// <remarks></remarks> public EmailSubject(BuildResultType result, string value) { Value = value; BuildResult = result; }
public JobsStatusCommand(Guid jobId, BuildResultType jobStatusType) { _jobStatus = new JobStatus(jobId, jobStatusType); _serializer = new JavaScriptSerializer(); }
public static string ToHtml(this BuildResultType type) { return($@"<li class=""list-group-item list-group-item-{type.SetTypeColor()}"">{type.ToFriendlyName()}</li>"); }
/// <summary> /// Initializes a new instance of the <see cref="EmailSubject" /> class. /// </summary> /// <param name="result">The result.</param> /// <param name="value">The value.</param> /// <remarks></remarks> public EmailSubject(BuildResultType result, string value ) { Value = value; BuildResult = result; }
public JobStatus(Guid jobID, BuildResultType jobStatusType) { JobID = jobID; JobStatusType = jobStatusType; }