예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TextContains" /> class.
        /// </summary>
        public TextContains(RuleArguments ruleArguments)
            : base(ruleArguments)
        {
            if (ruleArguments.Operands.Count < 3) throw new ConfigurationErrorsException("TextContains rule requires 3 operands");

            Option = (TextContainsOptions)Operands[1].IntegralValue();
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UpdateCellDateValue"/> class.
        /// </summary>
        /// <param name="ruleArguments"></param>
        public UpdateCellDateValue(RuleArguments ruleArguments) : base(ruleArguments)
        {
            if (ruleArguments.Operands.Count < 5)
                throw new ConfigurationErrorsException("UpdateCellDateValue rule requires 5 operands");

            if (!ruleArguments.Operands[0].IsWriteable()) throw new ConfigurationErrorsException("The target column for transform rule is not writeable");
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SetCellValue"/> class.
        /// </summary>
        /// <param name="ruleArguments">The arguments whith which to initialize the rule</param>
        public AppendValue(RuleArguments ruleArguments)
            : base(ruleArguments)
        {
            if (ruleArguments.Operands.Count < 3) throw new ConfigurationErrorsException("TextEqual rule requires 2 operands");
            if (!ruleArguments.Operands[0].IsWriteable()) throw new ConfigurationErrorsException("The target column for transform rule is not writeable");

            Option = (AppendValueOptions)Operands[1].IntegralValue();
        }
예제 #4
0
 /// <summary>
 /// Base constructor for rules.
 /// </summary>
 /// <param name="ruleArguments"></param>
 protected BaseRule(RuleArguments ruleArguments)
 {
     Id = ruleArguments.RuleId;
     Operands = ruleArguments.Operands;
     Children = ruleArguments.ChildRules;
     LogicType = ruleArguments.LogicType;
     Mode = ruleArguments.Mode;
     FailureCode = ruleArguments.FailureCode;
 }
예제 #5
0
        /// <summary>
        /// DateWindow Constructor
        /// </summary>
        /// <param name="ruleArguments"></param>
        public DateWindow(RuleArguments ruleArguments)
            : base(ruleArguments)
        {
            if (ruleArguments.Operands.Count < 5)
                throw new ConfigurationErrorsException("DateWindow rule requires 5 operands");

            UnitOption = (DateWindowUnitOptions)Operands[2].IntegralValue();
            PeriodOption = (DateWindowPeriodOptions)Operands[3].IntegralValue();
        }
예제 #6
0
 /// <summary>
 /// Base constructor for rules.
 /// </summary>
 /// <param name="ruleArguments"></param>
 protected BaseRule(RuleArguments ruleArguments)
 {
     Id          = ruleArguments.RuleId;
     DataType    = ruleArguments.DataType;
     Description = ruleArguments.Description;
     Operands    = ruleArguments.Operands;
     Children    = ruleArguments.ChildRules;
     LogicType   = ruleArguments.LogicType;
     Mode        = ruleArguments.Mode;
     FailureCode = ruleArguments.FailureCode;
 }
예제 #7
0
        private static IRule TestRule(Type ruleType, IEnumerable<IOperand> cells, IEnumerable<object> operands)
        {
            var allOperands = new List<IOperand> (cells);
            if (operands != null)
            {
                allOperands.AddRange(from operand in operands select new ConstantOperand(operand.ToString()));
            }

            const string failureCode = "fail";

            var ruleArguments = new RuleArguments(Guid.NewGuid(), allOperands, null, LogicType.And, EvaluationMode.Active, failureCode);
            return Activator.CreateInstance(ruleType, ruleArguments) as IRule;
        }
예제 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DateNotInList" /> class.
 /// </summary>
 /// <param name="ruleArguments"></param>
 public DateNotInList(RuleArguments ruleArguments)
     : base(ruleArguments)
 {
     if (ruleArguments.Operands.Count < 3) throw new ConfigurationErrorsException("DateInList rule requires at least 3 operands");
 }
예제 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="YearEquals" /> class.
 /// </summary>
 /// <param name="ruleArguments"></param>
 public YearEquals(RuleArguments ruleArguments)
     : base(ruleArguments)
 {
     if (ruleArguments.Operands.Count != 2) throw new ConfigurationErrorsException("YearEquals rule requires 2 operands");
 }
예제 #10
0
 /// <summary>
 /// Calendar Range Inclusive Constructor
 /// </summary>
 /// <param name="ruleArguments"></param>
 public CalendarRange(RuleArguments ruleArguments)
     : base(ruleArguments)
 {
     if (ruleArguments.Operands.Count < 4)
         throw new ConfigurationErrorsException("CalendarRange rule requires 4 operands");
 }
예제 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NumberInList" /> class.
 /// </summary>
 public NumberInList(RuleArguments ruleArguments)
     : base(ruleArguments)
 {
     if (ruleArguments.Operands.Count < 2) throw new ConfigurationErrorsException("NumberInList rule requires at least 2 operands");
 }
예제 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NumberGreaterThan" /> class.
 /// </summary>
 public NumberGreaterThan(RuleArguments ruleArguments)
     : base(ruleArguments)
 {
     if (ruleArguments.Operands.Count != 2)
         throw new ConfigurationErrorsException("NumberGreaterThan rule requires 2 operands");
 }
예제 #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NumberRangeInclusive" /> class.
 /// </summary>
 public NumberRangeInclusive(RuleArguments ruleArguments)
     : base(ruleArguments)
 {
     if (ruleArguments.Operands.Count != 3)
         throw new ConfigurationErrorsException("Number Range rule requires 3 operands");
 }
예제 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DateIsValid" /> class.
 /// </summary>
 /// <param name="ruleArguments"></param>
 public DateIsValid(RuleArguments ruleArguments)
     : base(ruleArguments)
 {
     if (ruleArguments.Operands.Count < 2) throw new ConfigurationErrorsException("DateIsValid rule requires 3 operands");
 }
예제 #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DateNotGreaterThan" /> class.
 /// </summary>
 /// <param name="ruleArguments"></param>
 public DateNotGreaterThan(RuleArguments ruleArguments)
     : base(ruleArguments)
 {
     if (ruleArguments.Operands.Count < 3)
         throw new ConfigurationErrorsException("DateNotGreaterThan rule requires 3 operands");
 }
예제 #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TextEndsWith" /> class.
 /// </summary>
 public TextEndsWith(RuleArguments ruleArguments)
     : base(ruleArguments)
 {
     if (ruleArguments.Operands.Count != 2) throw new ConfigurationErrorsException("TextEndsWith rule requires 2 operands");
 }
예제 #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CopyCellValue"/> class.
 /// </summary>
 /// <param name="ruleArguments">The arguments whith which to initialize the rule</param>
 public CopyCellValue(RuleArguments ruleArguments)
     : base(ruleArguments)
 {
     if (ruleArguments.Operands.Count < 2) throw new ConfigurationErrorsException("CopyCellValue rule requires 2 operands");
     if (!ruleArguments.Operands[1].IsWriteable()) throw new ConfigurationErrorsException("The target column for transform rule is not writeable");
 }
예제 #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SetCellDateFormat"/> class.
 /// </summary>
 /// <param name="ruleArguments"></param>
 public SetCellDateFormat(RuleArguments ruleArguments) : base(ruleArguments)
 {
     if (ruleArguments.Operands.Count < 3) throw new ConfigurationErrorsException("SetCellDateFormat rule requires 3 operands");
     if (!ruleArguments.Operands[0].IsWriteable()) throw new ConfigurationErrorsException("The target column for transform rule is not writeable");
 }
예제 #19
0
 /// <summary>
 /// Do nothing rule constructor
 /// </summary>
 public DoNothingRule(RuleArguments ruleArguments)
     : base(ruleArguments)
 {
 }