如何解决如何通过规则编辑器设置动态消息?
我需要根据规则编辑器中的参数字段值设置动态消息。 例如 如果A C,则将Message设置为A值应该在C和D之间
解决方法
已更新:
具有这样的源对象:
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
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。