public static Result <IEnumerable <PositionScheduleEvalDetail>, string> GetPositionValues(IEnumerable <ResultPair> results, ConfigCode termCode, ConfigCode dataCode, TargetHead headCode) { Result <IEnumerable <ResultPair>, string> termList = results .GetTypedResultsInListAndError <ArticleGeneralResult>( TargetFilters.TargetCodePlusHeadFunc(termCode, headCode)); Result <IEnumerable <ResultPair>, string> dataList = results .GetTypedResultsInListAndError <ArticleGeneralResult>( TargetFilters.TargetCodePlusHeadFunc(dataCode, headCode)); if (ResultMonadUtils.HaveAnyResultFailed(termList, dataList)) { return(Result.Fail <IEnumerable <PositionScheduleEvalDetail>, string>( ResultMonadUtils.FirstFailedResultError(termList, dataList))); } var zipsList = GetZip2Position(termList.Value, dataList.Value); if (zipsList.IsFailure) { return(Result.Fail <IEnumerable <PositionScheduleEvalDetail>, string>(zipsList.Error)); } var valsList = zipsList.Value.Select((tp) => (BuildItem(tp.Key, tp.Value.Item1, tp.Value.Item2))).ToList(); return(valsList.ToResultWithValueListAndError((tp) => (tp))); }
private Result <IEnumerable <PositionEvaluateSource>, string> GetPositionValues() { ConfigCode positionCode = (ConfigCode)ArticleCodeCz.FACT_POSITION_TERM; ConfigCode scheduleCode = (ConfigCode)ArticleCodeCz.FACT_POSITION_TIMESHEET; Result <IEnumerable <ResultPair>, string> positionList = InternalValues .GetTypedResultsInListAndError <ArticleGeneralResult>( TargetFilters.TargetCodePlusHeadFunc(positionCode, InternalTarget.Head())); Result <IEnumerable <ResultPair>, string> scheduleList = InternalValues .GetTypedResultsInListAndError <ArticleGeneralResult>( TargetFilters.TargetCodePlusHeadFunc(scheduleCode, InternalTarget.Head())); if (ResultMonadUtils.HaveAnyResultFailed(positionList, scheduleList)) { return(Result.Fail <IEnumerable <PositionEvaluateSource>, string>( ResultMonadUtils.FirstFailedResultError(positionList, scheduleList))); } var positionZips = GetZip2Position(positionList.Value, scheduleList.Value); if (positionZips.IsFailure) { return(Result.Fail <IEnumerable <PositionEvaluateSource>, string>(positionZips.Error)); } var positionStream = positionZips.Value.Select((tp) => (BuildItem(tp.Key, tp.Value.Item1, tp.Value.Item2))).ToList(); return(positionStream.ToResultWithValueListAndError((tp) => (tp))); }
private Result <IEnumerable <AbsenceEvaluateSource>, string> GetAbsenceValues() { ConfigCode filterCode = (ConfigCode)ArticleCodeCz.FACT_CONTRACT_ATTEND_ITEM; TargetHead filterHead = InternalTarget.Head(); Result <IEnumerable <AbsenceEvaluateSource>, string> absenceList = InternalValues .GetResultValuesInListAndError <ArticleGeneralResult, MonthAttendanceValue, AbsenceEvaluateSource>( TargetFilters.TargetCodePlusHeadFunc(filterCode, filterHead), ArticleFilters.SelectAllFunc, ResultFilters.MonthAttendanceFunc, BuildItem); return(absenceList); }