我需要根据规则编辑器中的参数字段值设置动态消息。例如,如果 A < B 或 A > C 则将 Message 设置为 A 值应介于 C 和 D 之间
问问题
55 次
1 回答
0
更新:
有一个像这样的源对象:
public class Source
{
private const string template1 = "Age must be between {0} and {1}";
private const string template2 = "Student Age could be greater than {0}";
public int A, B, C;
public bool InvalidAge, StudentAge;
[ExcludeFromEvaluation]
public string MessageToEmployee;
public void Display()
{
if(InvalidAge)
this.MessageToEmployee =
string.Format(this.template1, this.B, this.C);
else if
this.MessageToEmployee =
string.Format(this.template2, this.B);
else
this.MessageToEmployee = "The validation has passed successfully";
}
}
...您可以像这样创建规则:
If
A is lower than B or
A is greater than C
then
set InvalidAge to True and
Display
Else If
A is lower than B
then
set StudentAge to True and
Display
Else
Display
于 2020-10-07T13:25:11.457 回答