private void Init(TARGET_RECORD peTargetRecord, int pnTargetAttrId) { this.AlmostOperator = false; this.AroundOperator = false; this.TodayIndicator = false; this.MinValue = DateTime.MinValue; this.MinValueProps = new WonkaBizRuleValueProps() { IsLiteralValue = true }; this.MaxValue = DateTime.MaxValue; this.MaxValueProps = new WonkaBizRuleValueProps() { IsLiteralValue = true }; this.IsPassive = true; this.RecordOfInterest = peTargetRecord; if (pnTargetAttrId > 0) { this.TargetAttribute = WonkaRefEnvironment.GetInstance().GetAttributeByAttrId(pnTargetAttrId); } }
/// <summary> /// /// This method allows the caller to add a domain value to the set, whether it's a literal value or /// a referenced Attribute in the Transactional record. /// /// <param name="psDomainVal">The value to add to the set</param> /// <param name="pbIsLiteral">The indicator for whether the value is literal (i.e., '5') or an Attribute name (i.e., 'PubPrice')</param> /// <param name="peTargetRecord">The record with the Attribute value that we will add to the set (if the domain value is not literal)</param> /// <returns>None.</returns> /// </summary> public void AddDomainValue(string psDomainVal, bool pbIsLiteral, TARGET_RECORD peTargetRecord) { WonkaBreRuleValueProps oValueProps = new WonkaBreRuleValueProps() { IsLiteralValue = pbIsLiteral }; if (pbIsLiteral) { /* * NOTE: This is a bit of a hack...but since we must use commas to separate the domain values, we will require * that any rule value with an embedded comma must use ",", and that value will be replaced with an * actual comma here. My apologies. */ if (!String.IsNullOrEmpty(psDomainVal) && psDomainVal.Contains(",")) { psDomainVal = psDomainVal.Replace(",", ","); } DomainCache.Add(psDomainVal); } else { oValueProps.TargetRecord = peTargetRecord; oValueProps.AttributeInfo = WonkaRefEnvironment.GetInstance().GetAttributeByAttrName(psDomainVal); HasAttrIdTargets = true; } DomainValueProps[psDomainVal] = oValueProps; }
public ArithmeticLimitRule(int pnRuleId, TARGET_RECORD peTargetRecord, int pnTargetAttrId, double pnMinValue, double pnMaxValue, bool pbNotOp) : base(pnRuleId, RULE_TYPE.RT_ARITH_LIMIT) { Init(pnMinValue, pnMaxValue, peTargetRecord, pnTargetAttrId); NotOperator = pbNotOp; }
public DomainRule(int pnRuleID, TARGET_RECORD peTargetRecord, int pnTargetAttrId, bool bSearchAllRows) : base(pnRuleID, RULE_TYPE.RT_DOMAIN) { Init(peTargetRecord, pnTargetAttrId); this.SearchAllDataRows = bSearchAllRows; }
private void Init(double pnMinValue, double pnMaxValue, TARGET_RECORD peTargetRecord, int pnTargetAttrId) { this.IsPassive = true; this.RecordOfInterest = peTargetRecord; if (pnTargetAttrId > 0) { this.TargetAttribute = WonkaRefEnvironment.GetInstance().GetAttributeByAttrId(pnTargetAttrId); } this.BlockNumOperator = false; this.BlockNumDelegate = null; this.MinValue = pnMinValue; this.MinValueProps = new WonkaBreRuleValueProps() { IsLiteralValue = true }; this.MaxValue = pnMaxValue; this.MaxValueProps = new WonkaBreRuleValueProps() { IsLiteralValue = true }; }
public ArithmeticRule(int pnRuleID, TARGET_RECORD peTargetRecord, int pnTargetAttrId, ARITH_OP_TYPE poArithOpType, bool bSearchAllRows) : base(pnRuleID, RULE_TYPE.RT_ARITHMETIC) { Init(peTargetRecord, pnTargetAttrId, poArithOpType); this.SearchAllDataRows = bSearchAllRows; }
/// <summary> /// /// This method will use the provided value(s) to set the assign value of this rule. More importantly, /// it will assist with the initialization of the rule by interpreting the provided value(s) /// to detect which provided values are literal and which of them are Attribute names (which /// will be used to dynamically update the assign value using every processed pair of records). /// /// <param name="asAssignValues">The value(s) used for the assignment</param> /// <returns>None</returns> /// </summary> public void SetAssignValue(string[] asAssignValues) { if (asAssignValues.Count() > 0) { string sTempDomainVal = asAssignValues[0]; int nLiteralValueStartIdx = sTempDomainVal.IndexOf("'"); if (nLiteralValueStartIdx >= 0) { int nLiteralValueEndIdx = sTempDomainVal.LastIndexOf("'"); if (nLiteralValueEndIdx > nLiteralValueStartIdx) { string sLiteralValue = sTempDomainVal.Substring(nLiteralValueStartIdx + 1, nLiteralValueEndIdx - nLiteralValueStartIdx - 1); this.AssignValue = sLiteralValue; } } else { char[] acAttrNameDelim = new char[1] { '.' }; string sAttrName = sTempDomainVal; TARGET_RECORD eTargetRecord = TARGET_RECORD.TRID_NEW_RECORD; if (sTempDomainVal.Contains(acAttrNameDelim[0])) { string[] asAttrNameParts = sTempDomainVal.Split(acAttrNameDelim); if (asAttrNameParts.Length > 1) { string sTargetRecord = asAttrNameParts[0]; sAttrName = asAttrNameParts[1]; if (sTargetRecord == "O") { eTargetRecord = TARGET_RECORD.TRID_OLD_RECORD; } } } else { sAttrName = sTempDomainVal; } this.AssignValue = sAttrName; this.AssignValueProps.IsLiteralValue = false; this.AssignValueProps.TargetRecord = eTargetRecord; this.AssignValueProps.AttributeInfo = WonkaRefEnvironment.GetInstance().GetAttributeByAttrName(sAttrName); } } }
public WonkaEthCustomOpRule(int pnRuleID, TARGET_RECORD peTargetRecord, int pnTargetAttrId, string psCustomOpName, WonkaBizRulesXmlReader.ExecuteCustomOperator poCustomOpDelegate, WonkaBizSource poCustomOpSource) : base(pnRuleID, peTargetRecord, pnTargetAttrId, psCustomOpName, poCustomOpDelegate, poCustomOpSource) { }
private void Init(TARGET_RECORD peTargetRecord, int pnTargetAttrId) { this.IsPassive = true; this.RecordOfInterest = peTargetRecord; if (pnTargetAttrId > 0) { this.TargetAttribute = WonkaRefEnvironment.GetInstance().GetAttributeByAttrId(pnTargetAttrId); } }
/// <summary> /// /// This method will use the provided values to set the domain of this rule. More importantly, /// it will assist with the initialization of the rule by interpreting the provided values /// to detect which provided values are literal and which of them are Attribute names (which /// will be used to dynamically update the domain on every processed pair of records). /// /// <param name="asDomainValues">The set of values that are the domain for this particular rule</param> /// <returns>None</returns> /// </summary> public void SetDomain(string[] asDomainValues) { DomainCache.Clear(); DomainValueProps.Clear(); foreach (string sTempDomainVal in asDomainValues) { int nLiteralValueStartIdx = sTempDomainVal.IndexOf("'"); if (nLiteralValueStartIdx >= 0) { int nLiteralValueEndIdx = sTempDomainVal.LastIndexOf("'"); if (nLiteralValueEndIdx > nLiteralValueStartIdx) { string sLiteralValue = sTempDomainVal.Substring(nLiteralValueStartIdx + 1, nLiteralValueEndIdx - nLiteralValueStartIdx - 1); AddDomainValue(sLiteralValue, true, TARGET_RECORD.TRID_NONE); } } else { char[] acAttrNameDelim = new char[1] { '.' }; string sAttrName = sTempDomainVal; TARGET_RECORD eTargetRecord = TARGET_RECORD.TRID_NEW_RECORD; if (sTempDomainVal.Contains(acAttrNameDelim[0])) { string[] asAttrNameParts = sTempDomainVal.Split(acAttrNameDelim); if (asAttrNameParts.Length > 1) { string sTargetRecord = asAttrNameParts[0]; sAttrName = asAttrNameParts[1]; if (sTargetRecord == "O") { eTargetRecord = TARGET_RECORD.TRID_OLD_RECORD; } } } else { sAttrName = sTempDomainVal; } AddDomainValue(sAttrName, false, eTargetRecord); } } }
public AssignmentRule(int pnRuleID, TARGET_RECORD peTargetRecord, int pnTargetAttrId, string psAssignValue) : base(pnRuleID, RULE_TYPE.RT_ASSIGNMENT) { Init(peTargetRecord, pnTargetAttrId, psAssignValue); this.AssignValueProps = new WonkaBreRuleValueProps() { IsLiteralValue = true, TargetRecord = TARGET_RECORD.TRID_NONE, AttributeInfo = WonkaRefEnvironment.GetInstance().GetAttributeByAttrId(pnTargetAttrId) }; }
public AssignmentRule(int pnRuleID, TARGET_RECORD peTargetRecord, int pnTargetAttrId, TARGET_RECORD peAssignRecord, string psAssignAttrName) : base(pnRuleID, RULE_TYPE.RT_ASSIGNMENT) { Init(peTargetRecord, pnTargetAttrId, psAssignAttrName); this.AssignValueProps = new WonkaBizRuleValueProps() { IsLiteralValue = false, TargetRecord = peAssignRecord, AttributeInfo = WonkaRefEnvironment.GetInstance().GetAttributeByAttrName(psAssignAttrName) }; }
public CustomOperatorRule(int pnRuleID, TARGET_RECORD peTargetRecord, int pnTargetAttrId, string psCustomOpName, WonkaBizRulesXmlReader.ExecuteCustomOperator poCustomOpDelegate, WonkaBizSource poCustomOpSource) : base(pnRuleID, RULE_TYPE.RT_CUSTOM_OP) { Init(peTargetRecord, pnTargetAttrId, null); CustomOpName = psCustomOpName; CustomOpDelegate = poCustomOpDelegate; CustomOpSource = poCustomOpSource; }
private void Init(TARGET_RECORD peTargetRecord, int pnTargetAttrId, string psAssignValue) { this.IsPassive = false; this.RecordOfInterest = peTargetRecord; if (pnTargetAttrId > 0) { this.TargetAttribute = WonkaRefEnvironment.GetInstance().GetAttributeByAttrId(pnTargetAttrId); } this.AssignValue = psAssignValue; this.AssignValueProps = new WonkaBizRuleValueProps(); }
protected void Init(TARGET_RECORD peTargetRecord, int pnTargetAttrId, string psAssignValue) { this.IsPassive = false; this.HasAttrIdTargets = false; DomainCache = new List <string>(); DomainValueProps = new Dictionary <string, WonkaBizRuleValueProps>(); CustomOpPropArgs = new List <string>(); this.RecordOfInterest = peTargetRecord; if (pnTargetAttrId > 0) { this.TargetAttribute = WonkaRefEnvironment.GetInstance().GetAttributeByAttrId(pnTargetAttrId); } }
private void Init(TARGET_RECORD peTargetRecord, int pnTargetAttrId) { this.IsPassive = true; this.RecordOfInterest = peTargetRecord; if (pnTargetAttrId > 0) { this.TargetAttribute = WonkaRefEnvironment.GetInstance().GetAttributeByAttrId(pnTargetAttrId); } this.HasAttrIdTargets = false; this.SearchAllDataRows = false; DomainCache = new HashSet <string>(); DomainValueProps = new Dictionary <string, WonkaBizRuleValueProps>(); }
/// <summary> /// /// This method allows the caller to add a domain value to the set, whether it's a literal value or /// a referenced Attribute in the Transactional record. /// /// <param name="psDomainVal">The value to add to the set</param> /// <param name="pbIsLiteral">The indicator for whether the value is literal (i.e., '5') or an Attribute name (i.e., 'PubPrice')</param> /// <param name="peTargetRecord">The record with the Attribute value that we will add to the set (if the domain value is not literal)</param> /// <returns>None.</returns> /// </summary> public void AddDomainValue(string psDomainVal, bool pbIsLiteral, TARGET_RECORD peTargetRecord) { WonkaBizRuleValueProps oValueProps = new WonkaBizRuleValueProps() { IsLiteralValue = pbIsLiteral }; if (pbIsLiteral) { /* * NOTE: This is a bit of a hack...but since we must use commas and parantheses to separate the domain values, * we will require that any rule value with certain embeddeded delimiters use HTML chars instead, so that * the value will be replaced with the correct equivalent here. My apologies. */ if (!string.IsNullOrEmpty(psDomainVal) && psDomainVal.Contains(",")) { psDomainVal = psDomainVal.Replace(",", ","); } if (!string.IsNullOrEmpty(psDomainVal) && psDomainVal.Contains("(")) { psDomainVal = psDomainVal.Replace("(", "("); } if (!string.IsNullOrEmpty(psDomainVal) && psDomainVal.Contains(")")) { psDomainVal = psDomainVal.Replace(")", ")"); } DomainCache.Add(psDomainVal); } else { oValueProps.TargetRecord = peTargetRecord; oValueProps.AttributeInfo = WonkaRefEnvironment.GetInstance().GetAttributeByAttrName(psDomainVal); HasAttrIdTargets = true; } DomainValueProps[psDomainVal] = oValueProps; }
/// <summary> /// /// This method allows the caller to add a value to the set for the arithmetic operation, whether it's a literal value or /// a referenced Attribute in the Transactional record. /// /// <param name="psDomainVal">The value to add to the set</param> /// <param name="pbIsLiteral">The indicator for whether the value is literal (i.e., '5') or an Attribute name (i.e., 'PubPrice')</param> /// <param name="peTargetRecord">The record with the Attribute value that we will add to the set (if the domain value is not literal)</param> /// <returns>None.</returns> /// </summary> public void AddDomainValue(string psDomainVal, bool pbIsLiteral, TARGET_RECORD peTargetRecord) { WonkaBizRuleValueProps oValueProps = new WonkaBizRuleValueProps() { IsLiteralValue = pbIsLiteral }; if (pbIsLiteral) { DomainCache.Add(psDomainVal); } else { oValueProps.TargetRecord = peTargetRecord; oValueProps.AttributeInfo = WonkaRefEnvironment.GetInstance().GetAttributeByAttrName(psDomainVal); HasAttrIdTargets = true; } DomainValueProps[psDomainVal] = oValueProps; }
public PopulatedRule(int pnRuleID, TARGET_RECORD peTargetRecord, int pnTargetAttrId) : base(pnRuleID, RULE_TYPE.RT_POPULATED) { Init(peTargetRecord, pnTargetAttrId); }