/// <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(); }
/// <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"); }
/// <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(); }
/// <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; }
/// <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(); }
/// <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; }
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; }
/// <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"); }
/// <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"); }
/// <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"); }
/// <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"); }
/// <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"); }
/// <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"); }
/// <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"); }
/// <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"); }
/// <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"); }
/// <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"); }
/// <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"); }
/// <summary> /// Do nothing rule constructor /// </summary> public DoNothingRule(RuleArguments ruleArguments) : base(ruleArguments) { }