/// <summary> /// Results for value. /// </summary> /// <param name="value">The value.</param> /// <returns>the result value</returns> public bool ResultForValue(string value) { if (string.IsNullOrEmpty(this.FieldValue)) { return(false); } if (this.FieldValue.StartsWith("$cur") || this.FieldValue.StartsWith("$par")) { var replaceValues = UPConditionValueReplacement.SessionParameterReplacements().ValueOrDefault(this.FieldValue); if (replaceValues != null && replaceValues.Count > 0) { return(this.ResultForValuePattern(value, replaceValues[0])); } if (!this.FieldValue.StartsWith("$cur")) { return(this.ResultForValuePattern(value, this.FieldValue)); } var replacedDate = this.FieldValue.ReplaceDateVariables(); if (replacedDate != this.FieldValue) { return(this.ResultForValuePattern(value, replacedDate)); } } else if (this.FieldValue.StartsWith("$")) { var replacedDate = this.FieldValue.ReplaceDateVariables(); if (!replacedDate.StartsWith("$")) { return(this.ResultForValuePattern(value, replacedDate)); } } return(this.ResultForValuePattern(value, this.FieldValue)); }
/// <summary> /// Initializes a new instance of the <see cref="UPConfigExpandConditionForQuery"/> class. /// </summary> /// <param name="condition">The condition.</param> /// <param name="crmQuery">The CRM query.</param> /// <param name="alternate">The alternate.</param> public UPConfigExpandConditionForQuery(UPConfigExpandCondition condition, UPContainerMetaInfo crmQuery, UPConfigExpandAlternate alternate) : base(condition, alternate) { this.ResultPosition = crmQuery?.PositionForField(this.Field) ?? 0; if (!this.FieldValue.StartsWith("$cur") && !this.FieldValue.StartsWith("$par")) { return; } var dateFieldValue = this.FieldValue.ReplaceDateVariables(); if (dateFieldValue.StartsWith("$")) { var replaceValues = UPConditionValueReplacement.SessionParameterReplacements().ValueOrDefault(this.FieldValue); if (replaceValues != null && replaceValues.Count > 0) { this.FieldValue = replaceValues[0]; } } else { this.FieldValue = dateFieldValue; } }