public TransferResult Evaluate(TransferApplication transfer)
        {
            if (!_physicalExamination.IsMedicalRoomAvailable)
            {
                return(TransferResult.Postponed);
            }

            var isHealthy = _physicalExamination
                            .IsHealthy(transfer.PlayerAge, transfer.PlayerStrength, transfer.PlayerSpeed);

            if (!isHealthy)
            {
                return(TransferResult.Rejected);
            }

            var totalTransferFee = transfer.TransferFee + transfer.ContractYears * transfer.AnnualSalary;

            if (RemainingTotalBudget < totalTransferFee)
            {
                return(TransferResult.Rejected);
            }
            if (transfer.PlayerAge < 30)
            {
                return(TransferResult.Approved);
            }
            if (transfer.IsSuperStar)
            {
                return(TransferResult.ReferredToBoss);
            }
            return(TransferResult.Rejected);
        }
Ejemplo n.º 2
0
        public TransferResult Evaluate(TransferApplication transfer)
        {
            if (!_transferPolicyEvaluator.IsInTransferPeriod())
            {
                return(TransferResult.Postponed);
            }

            if (_physicalExamination.MediacalRoom.Status.IsAvailable == "停用")
            {
                return(TransferResult.Postponed);
            }

            bool isHealthy;

            try
            {
                isHealthy = _physicalExamination
                            .IsHealthy(transfer.PlayerAge, transfer.PlayerStrength, transfer.PlayerSpeed);
            }
            catch (Exception)
            {
                return(TransferResult.Postponed);
            }

            if (!isHealthy)
            {
                _physicalExamination.PhysicalGrade = PhysicalGrade.Failed;
                return(TransferResult.Rejected);
            }
            else
            {
                if (transfer.PlayerAge < 25)
                {
                    _physicalExamination.PhysicalGrade = PhysicalGrade.Superb;
                }
                else
                {
                    _physicalExamination.PhysicalGrade = PhysicalGrade.Passed;
                }
            }

            var totalTransferFee = transfer.TransferFee + transfer.ContractYears * transfer.AnnualSalary;

            if (RemainingTotalBudget < totalTransferFee)
            {
                return(TransferResult.Rejected);
            }
            if (transfer.PlayerAge < 30)
            {
                return(TransferResult.Approved);
            }
            if (transfer.IsSuperStar)
            {
                return(TransferResult.ReferredToBoss);
            }
            return(TransferResult.Rejected);
        }