Exemplo n.º 1
0
                public override EvaluateSource GetNewValues(EvaluateSource initValues)
                {
                    Result <MoneyAmountSum, string> generalBaseResult = GetGeneralBase(InternalValues, InternalTarget);
                    Result <MoneyAmountSum, string> healthsPartResult = GetHealthsPart(InternalValues, InternalTarget);
                    Result <MoneyAmountSum, string> socialsPartResult = GetSocialsPart(InternalValues, InternalTarget);

                    if (ResultMonadUtils.HaveAnyResultFailed(generalBaseResult, healthsPartResult, socialsPartResult))
                    {
                        return(ReturnFailureAndError(initValues,
                                                     ResultMonadUtils.FirstFailedResultError(generalBaseResult, healthsPartResult, socialsPartResult)));
                    }

                    MoneyAmountSum generalBaseValues = generalBaseResult.Value;
                    MoneyAmountSum healthsPartValues = healthsPartResult.Value;
                    MoneyAmountSum socialsPartValues = socialsPartResult.Value;

                    return(new EvaluateSource
                    {
                        // PROPERTIES SET
                        GeneralBaseAmount = generalBaseValues.Balance(),
                        HealthsPartAmount = healthsPartValues.Balance(),
                        SocialsPartAmount = socialsPartValues.Balance(),
                        // PROPERTIES SET
                    });
                }
                public override EvaluateSource GetNewValues(EvaluateSource initValues)
                {
                    Result <MoneyAmountSum, string> taxableIncome = GetTaxableIncome(InternalValues, InternalTarget);

                    if (ResultMonadUtils.HaveAnyResultFailed(taxableIncome))
                    {
                        return(ReturnFailureAndError(initValues, taxableIncome.Error));
                    }

                    MoneyAmountSum taxableValues = taxableIncome.Value;

                    return(new EvaluateSource
                    {
                        // PROPERTIES SET
                        IncomeWithhold = taxableValues.Balance(),
                        // PROPERTIES SET
                    });
                }