コード例 #1
0
        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"));
        }
コード例 #2
0
 public BuildResult(
     BuildResultType type,
     Action <DocX>[] buildActions)
 {
     Type         = type;
     BuildActions = buildActions;
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        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}.");
            }
        }
コード例 #5
0
        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}.");
            }
        }
コード例 #6
0
ファイル: Builder.cs プロジェクト: fairyfingers/CKli
 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];
 }
コード例 #7
0
        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();
        }
コード例 #8
0
ファイル: Build.cs プロジェクト: VarocalCross/Varocal
 public BuildResult( BuildResultType Type )
 {
     this.Type = Type;
 }
コード例 #9
0
 BuildResult(
     BuildResultType type,
     IReadOnlyList <(ArtifactInstance Artifact, string SolutionName, string TargetName)> g,
コード例 #10
0
 /// <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;
 }
コード例 #11
0
 public JobsStatusCommand(Guid jobId, BuildResultType jobStatusType)
 {
     _jobStatus  = new JobStatus(jobId, jobStatusType);
     _serializer = new JavaScriptSerializer();
 }
コード例 #12
0
 public static string ToHtml(this BuildResultType type)
 {
     return($@"<li class=""list-group-item list-group-item-{type.SetTypeColor()}"">{type.ToFriendlyName()}</li>");
 }
コード例 #13
0
        /// <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;
		}
コード例 #14
0
 public JobStatus(Guid jobID, BuildResultType jobStatusType)
 {
     JobID         = jobID;
     JobStatusType = jobStatusType;
 }