예제 #1
0
        public async Task PreliminaryAcceptenceCallForSpeechByUniqueIdShouldBeSuccess()
        {
            CreateCategoriesAsync();
            CreateJudgeAsync();

            CallForSpeechSubmitDoer callForSpeechSubmitDoer =
                new CallForSpeechSubmitDoer(_geekLemonContex, _mapper);

            var cfs = GivenCallForSpeech().WithCategory
                          (c => c.WithId(1))
                      .Build();

            var status = await callForSpeechSubmitDoer.Run(cfs);

            CallForSpeechSavePreliminaryAcceptenceDoer callForSpeechSavePreliminaryAcceptenceDoer =
                new CallForSpeechSavePreliminaryAcceptenceDoer(_geekLemonContex, _mapper);

            JudgeId judgeId = new JudgeId(1);

            var status2 = await callForSpeechSavePreliminaryAcceptenceDoer.Run(cfs.UniqueId, judgeId,
                                                                               Domain.ValueObjects.CallForSpeechStatus.AcceptedByJudge);

            status2.Success.Should().BeTrue();

            CallForSpeechGetByIdDoer callForSpeechGetByIdDoer =
                new CallForSpeechGetByIdDoer(_geekLemonContex, _mapper);

            var status3 = await callForSpeechGetByIdDoer.Run
                              (status.Value.UniqueId as CallForSpeechUniqueId);

            status3.Success.Should().BeTrue();

            status3.Value.Should().NotBeSameAs(cfs);
        }
예제 #2
0
        public async Task EvaluatedCallForSpeechByIdShouldBeSuccess()
        {
            CreateCategoriesAsync();
            CreateJudgeAsync();

            CallForSpeechSubmitDoer callForSpeechSubmitDoer =
                new CallForSpeechSubmitDoer(_geekLemonContex, _mapper);

            var cfs = GivenCallForSpeech().WithCategory
                          (c => c.WithId(1))
                      .Evaluated().Build();

            var status = await callForSpeechSubmitDoer.Run(cfs);

            CallForSpeechSaveEvaluatationDoer callForSpeechSaveEvaluatationDoer =
                new CallForSpeechSaveEvaluatationDoer(_geekLemonContex, _mapper);

            JudgeId judgeId = new JudgeId(1);

            var status2 = await callForSpeechSaveEvaluatationDoer.Run
                              (cfs.Id, cfs.ScoreResult, cfs.Status);

            status2.Success.Should().BeTrue();

            CallForSpeechGetByIdDoer callForSpeechGetByIdDoer =
                new CallForSpeechGetByIdDoer(_geekLemonContex, _mapper);

            var status3 = await callForSpeechGetByIdDoer.Run
                              (status.Value.CreatedId as CallForSpeechId);

            status3.Success.Should().BeTrue();

            status3.Value.Should().NotBeSameAs(cfs);
        }
예제 #3
0
        public async Task <ExecutionStatus> Run(CallForSpeechId id, JudgeId judge, CallForSpeechStatus status)
        {
            using var connection = new SqliteConnection(_geekLemonContext.ConnectionString);

            var q = @"UPDATE CallForSpeakes
                SET FinalDecision_DecisionBy = @JudgeId,
                FinalDecision_Date = @Date,
                Status = @Status
                WHERE Id = @Id;";

            try
            {
                var result = await connection.ExecuteAsync(q,
                                                           new
                {
                    @JudgeId = judge.Value,
                    @Date    = AppTime.Now().ToLongDateString(),
                    @Id      = id.Value,
                    @Status  = (int)status
                });

                return(ExecutionStatus.DbOk());
            }
            catch (Exception ex)
            {
                if (ExecutionFlow.Options.ThrowExceptions)
                {
                    throw;
                }

                return(ExecutionStatus.DbError(ex));
            }
        }
        public async Task <ExecutionStatus <Judge> > Run(JudgeId id)
        {
            using var connection = new SqliteConnection
                                       (_geekLemonContext.ConnectionString);

            var q = @$ "SELECT j.Id,j.Login,j.Password,j.BirthDate,j.Name_First, j.Name_Last,
                j.CategoryId ,j.UniqueId ,j.Version ,
                c.Name AS {nameof(JudgeTemp.Category_Name)},
예제 #5
0
        public async Task <ExecutionStatus> Run(JudgeId id)
        {
            using var connection = new SqliteConnection(_geekLemonContext.ConnectionString);

            var q = "DELETE FROM Judges WHERE Id=@Id;";

            try
            {
                var result = await connection.QueryAsync <int>(q,
                                                               new
                {
                    @Id = id.Value
                });

                return(ExecutionStatus.DbOk());
            }
            catch (Exception ex)
            {
                return(ExecutionStatus.DbError(ex.Message));
            }
        }
예제 #6
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ RoundId;
         hashCode = (hashCode * 397) ^ (FighterId != null ? FighterId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (JudgeId != null ? JudgeId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Points;
         hashCode = (hashCode * 397) ^ FightId;
         hashCode = (hashCode * 397) ^ Cautions;
         hashCode = (hashCode * 397) ^ Warnings;
         hashCode = (hashCode * 397) ^ KnockDown;
         hashCode = (hashCode * 397) ^ J;
         hashCode = (hashCode * 397) ^ X;
         hashCode = (hashCode * 397) ^ (Injury != null ? Injury.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ InjuryTime.GetHashCode();
         hashCode = (hashCode * 397) ^ Accepted.GetHashCode();
         hashCode = (hashCode * 397) ^ (Fight != null ? Fight.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Judge != null ? Judge.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Fighter != null ? Fighter.GetHashCode() : 0);
         return(hashCode);
     }
 }
 public Task <ExecutionStatus> SavePreliminaryAcceptenceAsync(CallForSpeechUniqueId id, JudgeId judge, CallForSpeechStatus status)
 {
     return(_callForSpeechSavePreliminaryAcceptenceDoer.Run(id, judge, status));
 }
 public Task <ExecutionStatus> SaveRejectionAsync(CallForSpeechUniqueId id, JudgeId judge, CallForSpeechStatus status)
 {
     return(_callForSpeechSaveRejectionDoer.Run(id, judge, status));
 }
 public Task <ExecutionStatus <Judge> > GetByIdAsync(JudgeId id)
 {
     return(_judgeGetByIdDoer.Run(id));
 }
 public Task <ExecutionStatus> DeleteAsync(JudgeId entity)
 {
     return(_judgeDeleteDoer.Run(entity));
 }