public override EvaluateSource GetNewValues(EvaluateSource initValues)
                {
                    ConfigCode termCode = (ConfigCode)ArticleCodeCz.FACT_POSITION_TERM;

                    Result <MonthFromStopValue, string> termFindResult = InternalValues
                                                                         .FindResultValue <ArticleGeneralResult, MonthFromStopValue>(
                        TargetFilters.TargetCodePlusHeadAndSeedFunc(termCode, InternalTarget.Head(), InternalTarget.Part()),
                        (x) => (x.IsMonthFromStopValue()));

                    if (termFindResult.IsFailure)
                    {
                        return(ReturnFailureAndError(initValues, termFindResult.Error));
                    }

                    MonthFromStopValue termPrepValues = termFindResult.Value;

                    var absenceValues = GetAbsenceValues();

                    if (absenceValues.IsFailure)
                    {
                        return(ReturnFailureAndError(initValues, absenceValues.Error));
                    }

                    var completeSorted = absenceValues.Value.OrderBy((p) => (p), new CompareAbsenceTerms());

                    return(new EvaluateSource
                    {
                        // PROPERTIES SET
                        DayPositionFrom = termPrepValues.PeriodDayFrom,
                        DayPositionStop = termPrepValues.PeriodDayStop,
                        AbsenceList = completeSorted.ToList(),
                        // PROPERTIES SET
                    });
                }
Exemple #2
0
                public override EvaluateSource GetNewValues(EvaluateSource initValues)
                {
                    ConfigCode workCode = (ConfigCode)ArticleCodeCz.FACT_POSITION_SCHEDULE;

                    Result <MonthScheduleValue, string> workFindResult = InternalValues
                                                                         .FindResultValue <ArticleGeneralResult, MonthScheduleValue>(
                        TargetFilters.TargetCodePlusPartFunc(workCode, InternalTarget.Head(), InternalTarget.Part()),
                        (x) => (x.IsRealMonthValue()));
                    MonthScheduleValue workValuesPrep = workFindResult.Value;

                    ConfigCode termCode = (ConfigCode)ArticleCodeCz.FACT_POSITION_TERM;

                    Result <MonthFromStopValue, string> termFindResult = InternalValues
                                                                         .FindResultValue <ArticleGeneralResult, MonthFromStopValue>(
                        TargetFilters.TargetCodePlusHeadAndSeedFunc(termCode, InternalTarget.Head(), InternalTarget.Part()),
                        (x) => (x.IsMonthFromStopValue()));

                    if (ResultMonadUtils.HaveAnyResultFailed(workFindResult, workFindResult))
                    {
                        return(ReturnFailureAndError(initValues,
                                                     ResultMonadUtils.FirstFailedResultError(workFindResult, workFindResult)));
                    }

                    MonthFromStopValue termValuesPrep = termFindResult.Value;

                    return(new EvaluateSource
                    {
                        // PROPERTIES SET
                        DayTermFrom = termValuesPrep.PeriodDayFrom,
                        DayTermStop = termValuesPrep.PeriodDayStop,
                        RealMonthHours = workValuesPrep.HoursMonth,
                        // PROPERTIES SET
                    });
                }