/// <summary> /// Populates the given <see cref="IResultStream{TDestination}" /> with the results, from the execution of /// the given <see cref="IQueryableFlowQuery" />, in a streamed fashion. /// </summary> /// <typeparam name="TSource"> /// The <see cref="System.Type" /> of the source entity. /// </typeparam> /// <typeparam name="TDestination"> /// The <see cref="System.Type" /> of the result. /// </typeparam> /// <param name="query"> /// The query. /// </param> /// <param name="resultStream"> /// The <see cref="IResultStream{TDestination}" /> to stream the results into. /// </param> public static void SelectStream <TSource, TDestination> ( IQueryableFlowQuery query, IResultStream <TDestination> resultStream ) { Func <object, TDestination> converter = null; if (query.Constructor != null) { converter = ConstructionHelper.GetObjectByExpressionConverter <TDestination>(query.Constructor); } if (converter == null) { converter = x => (TDestination)x; } var streamer = new ResultStreamer <TDestination>(resultStream, converter); ICriteriaBuilder criteriaBuilder = GetCriteriaBuilder(query); ICriteria criteria = criteriaBuilder.Build <TSource, TDestination>(query); criteria.List(streamer); resultStream.EndOfStream(); }
public void Should_Return_Valid_Result_Stream() { WorkRelationTerms TEST_CONTRACT_TYPE = WorkRelationTerms.WORKTERM_EMPLOYMENT_1; WorkHealthTerms TEST_HEALTH_TYPE = WorkHealthTerms.HEALTH_TERM_EMPLOYMENT; WorkSocialTerms TEST_SOCIAL_TYPE = WorkSocialTerms.SOCIAL_TERM_EMPLOYMENT; ITargetValues contractValues = TargetValueBuilder.CreateContractEmplTermValues( TEST_CONTRACT_TYPE, TEST_HEALTH_TYPE, TEST_SOCIAL_TYPE, null, null); ITargetValues positionValues = TargetValueBuilder.CreatePositionEmplTermValues(null, null); ITargetValues positionSalary = TargetValueBuilder.CreateSalaryBaseValues(10000m); ITargetValues emptyValues = TargetValueBuilder.CreateEmptyValues(); ITargetStream targets = TargetStream.CreateEmptyStream(). AddNewContractsTarget(ConfigSetCzArticleName.REF_CONTRACT_EMPL_TERM, contractValues, testConfig). AddNewPositionsTarget(ConfigSetCzArticleName.REF_POSITION_EMPL_TERM, positionValues, testConfig). AddTargetIntoPosition(ConfigSetCzArticleName.REF_SALARY_BASE, positionSalary, testConfig). AddTargetIntoPosition(ConfigSetCzArticleName.REF_INCOME_GROSS, emptyValues, testConfig); IEngineProfile testProfile = testEngine.BuildEngineProfile(testPeriod); IProcessService testModule = ProcessServiceModule.CreateModule(targets, testConfig, testProfile, serviceLog); IResultStream results = testModule.EvaluateTargetsToResults(); serviceLog.CloseLogStream(); Assert.AreEqual(0, results.Results().Keys.Count); }
public static void LogResultStream(IProcessServiceLogger logger, IResultStream results, string testName) { if (logger != null) { logger.LogResultStream(results, testName); } }
public static Int32[] GetShiftTimetable(IResultStream results, IBookParty position, uint articleCode) { var resultList = results.GetPositionPartyResultList(position, articleCode); var resultValue = resultList.Select(x => x.ShiftTimetable()).DefaultIfEmpty(ResultValues.NULL_TIME_TABLE).FirstOrDefault(); return(resultValue); }
public static Int32 GetAbsenceHours(IResultStream results, IBookParty position, uint articleCode) { var resultList = results.GetPositionPartyResultList(position, articleCode); var resultValue = resultList.Select(x => x.AbsenceCount()).DefaultIfEmpty(ResultValues.NULL_TIME_COUNTS).FirstOrDefault(); return(resultValue); }
/// <inheritdoc /> public virtual void Select(IResultStream <TSource> stream) { Constructor = null; Mappings = null; Projection = null; ResultTransformer = null; SelectStream(stream); }
private static IResultStream EvaluateTarget( IResultStream resultStream, IBookTarget target, IProcessConfig config, IEngineProfile engine) { var targetResults = target.Evaluate(config, engine, resultStream); var results = resultStream.AggregateResultList(targetResults); return(results); }
public static IResultStream EvaluateTargetsToResults(IDictionary <IBookIndex, IBookTarget> targets, IProcessConfig config, IEngineProfile engine) { IResultStream emptyResults = ResultStream.CreateEmptyStream(); var results = targets.Aggregate(emptyResults, (agr, target) => EvaluateTarget(agr, target.Value, config, engine)); return(results); }
/// <inheritdoc /> public virtual void Select ( IResultStream <TSource> stream, IProjection projection ) { Project(projection); SelectStream(stream); }
/// <inheritdoc /> public virtual void Select ( IResultStream <TSource> stream, params Expression <Func <TSource, object> >[] properties ) { Project(properties); SelectStream(stream); }
/// <inheritdoc /> public virtual void Select <TDestination> ( IResultStream <TDestination> stream, Expression <Func <TSource, TDestination> > projection ) { Project(projection); SelectStream(stream); }
public static Int32 GetSumAbsenceTimetable(IResultStream results, IBookParty position, uint articleCode) { var resultList = results.GetPositionPartyResultList(position, articleCode); var resultHours = resultList.Select(x => x.AbsenceTimetable()).DefaultIfEmpty(ResultValues.NULL_TIME_TABLE).FirstOrDefault(); var resultValue = resultHours.Aggregate(0, (agr, x) => (agr + x)); return(resultValue); }
/// <inheritdoc /> public virtual void Select <TDestination> ( IResultStream <TDestination> stream, ISelectSetup <TSource, TDestination> setup ) { Project(setup); SelectStream(stream); }
/// <inheritdoc /> /// <typeparam name="TDestination"> /// The <see cref="System.Type" /> of the selection. /// </typeparam> public virtual void Select <TDestination> ( IResultStream <TDestination> stream, IProjection projection ) { Project <TDestination>(projection); SelectStream(stream); }
public static decimal GetSummaryPaymentAmount(IResultStream results, ICodeIndex contract, uint articleCode) { var resultList = results.GetContractPartySummaryList(contract, articleCode); var resultAmounts = resultList.Select(x => x.AmountPayments()).ToArray(); var resultValue = resultAmounts.Aggregate(0m, (agr, x) => (decimal.Add(agr, x))); return(resultValue); }
/// <inheritdoc /> /// <typeparam name="TDestination"> /// The <see cref="System.Type" /> of the selection. /// </typeparam> public virtual void Select <TDestination> ( IResultStream <TDestination> stream, string property, params string[] properties ) { Project <TDestination>(property, properties); SelectStream(stream); }
/// <inheritdoc /> public virtual void Select ( IResultStream <TSource> stream, string property, params string[] properties ) { Project(property, properties); SelectStream(stream); }
public void LogResultStream(IResultStream results, string testName) { OpenLogStream(testName); using (StreamWriter logWriter = new StreamWriter(LogFileStream)) { string lineDefinition = "\n--- begin ---"; lineDefinition += ResultStreamLogger.LogResultStreamInfo(results.Results()); if (lineDefinition.Length > 0) { logWriter.WriteLine(lineDefinition); } logWriter.WriteLine("--- end ---"); } }
/// <summary> /// Initializes a new instance of the <see cref="ResultStreamer{T}" /> class. /// </summary> /// <param name="resultStream"> /// The <see cref="IResultStream{T}" /> into which this <see cref="ResultStreamer{T}" /> will stream each /// query result item. /// </param> /// <param name="converter"> /// The converter used to convert each query result item into the destination <see cref="System.Type" /> /// specified by <typeparamref name="T" />. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="resultStream" /> and/or <paramref name="converter" /> is null. /// </exception> public ResultStreamer ( IResultStream <T> resultStream, Func <object, T> converter ) { if (resultStream == null) { throw new ArgumentNullException("resultStream"); } if (converter == null) { throw new ArgumentNullException("converter"); } _resultStream = resultStream; _converter = converter; }
/// <inheritdoc /> public virtual void Select <TDestination> ( IResultStream <TDestination> stream, IPartialSelection <TSource, TDestination> combiner ) { if (combiner == null) { throw new ArgumentNullException("combiner"); } if (combiner.Count == 0) { throw new ArgumentException("No projection is made in ExpressionCombiner'2", "combiner"); } Expression <Func <TSource, TDestination> > expression = combiner.Compile(); Select(stream, expression); }
public static uint GetContractDayEnds(IResultStream results, ICodeIndex contract) { var contractResult = results.GetContractResult(contract); return(contractResult.PeriodDayEndsOrdinal()); }
public void LogResultStream(IResultStream results, string testName) { }
public override IBookResult[] CallEvaluate(IProcessConfig config, IEngineProfile engine, IPayrollArticle article, IBookIndex element, ITargetValues values, IResultStream results) { return(GeneralModule.EMPTY_RESULT_LIST); }
/// <summary> /// Populates the given <see cref="IResultStream{TDestination}" /> with the results of this query in a /// streamed fashion. /// </summary> /// <param name="stream"> /// The <see cref="IResultStream{TDestination}" /> to stream the results into. /// </param> /// <typeparam name="TDestination"> /// The <see cref="System.Type" /> of the selection. /// </typeparam> protected virtual void SelectStream <TDestination>(IResultStream <TDestination> stream) { SelectionHelper.SelectStream <TSource, TDestination>(QuerySelection.Create(this), stream); }
public virtual IBookResult[] CallEvaluate(IProcessConfig config, IEngineProfile engine, IPayrollArticle article, IBookIndex element, ITargetValues values, IResultStream results) { if (__evaluate != null) { return(__evaluate(this, config, engine, article, element, values, results)); } return(GeneralModule.EMPTY_RESULT_LIST); }
public IBookResult[] Evaluate(IProcessConfig config, IEngineProfile engine, IResultStream results) { return(__concept.CallEvaluate(config, engine, __article, __element, __values, results)); }
public static uint GetPositionDayEnds(IResultStream results, IBookParty position) { var positionResult = results.GetPositionResult(position); return(positionResult.PeriodDayEndsOrdinal()); }
public ResultCursor(IResultStream resultStream) { Throw.ArgumentNullException.IfNull(resultStream, nameof(resultStream)); _resultStream = resultStream; }