View Article

Rules Helper methods

By Xelence Documentation posted 05-02-2025 08:57

  

using Sagitec.Rules.Core.Instance.Attributes;
using Sagitec.Rules.Core.Interface;
using Sagitec.Rules.Interface.Container.Entity;
 
namespace Sagitec.Rules.Interface.Helper.Execution
{
    /// <summary>
    /// Defines methods for executing the rules within the execution context.
    /// </summary>
 
    [SingletonInstance]
    public interface IExecutionRulesHelper : ICoreInstance, IExecutionContextHelper
    {
        #region Public Methods
 
        /// <summary>
        /// Evaluates a condition based on the provided condition ID and rule entity container.
        /// </summary>
        /// <param name="astrConditionID">The ID of the condition to evaluate.</param>
        /// <param name="aobjentRule">The entity container to use for condition evaluation.</param>
        /// <returns>True if the condition is met; otherwise false.</returns>
        bool EvaluateCondition(string astrConditionID, IRulesLanguageEntityContainer aobjentRule);
 
        /// <summary>
        /// Executes a rule and returns the result as an instance of the type <typeparamref name="T"/>.
        /// </summary>
        /// <typeparam name="T">The type of the result to return.</typeparam>
        /// <param name="astrRuleID">The ID of the rule to execute.</param>
        /// <param name="adtEffectiveDate">The effective date for the rule execution.</param>
        /// <param name="aobjentRule">The entity container to use for the rule execution.</param>
        /// <param name="arrParams">Optional parameters for the rule execution.</param>
        /// <returns>The result of the rule execution as an instance of the type <typeparamref name="T"/>.</returns>
        T ExecuteAnyRule<T>(string astrRuleID, DateTime adtEffectiveDate, IRulesLanguageEntityContainer aobjentRule, params object[] arrParams);
 
        /// <summary>
        /// Executes a rule and returns the result as a dictionary of output parameters.
        /// </summary>
        /// <param name="astrRuleID">The ID of the rule to execute.</param>
        /// <param name="adtEffectiveDate">The effective date for the rule execution.</param>
        /// <param name="aobjentRule">The entity container to use for the rule execution.</param>
        /// <param name="arrParams">Optional parameters for the rule execution.</param>
        /// <returns>A dictionary containing the output parameters of the rule execution.</returns>
        IDictionary<string, object> ExecuteANYRule(string astrRuleID, DateTime adtEffectiveDate, IRulesLanguageEntityContainer aobjentRule, params object[] arrParams);
 
        #endregion Public Methods
    }
}  


#Rules

0 comments
26 views