我正在尝试执行自定义 K2 智能对象的 Get List 方法,该方法查询 SQL 数据库对象(视图)。我在现有的 C# 项目中使用 API 来执行这些智能对象。我想将多个过滤器传递给这个 GetList 方法。
我正在使用下面的代码添加单个过滤器,但无法弄清楚传递多个过滤器的方法:
Dictionary<string, string>[] results = null;
if (!server.Connection.IsConnected) return results;
SmartObject smartObject = server.GetSmartObject(objectName);
SmartListMethod newList = smartObject.ListMethods["GetList"];
smartObject.MethodToExecute = methodName;
Contains myFilter = new Contains();
myFilter.Left = new PropertyExpression(filterPropertyName, PropertyType.Text);
myFilter.Right = new ValueExpression(filterValue, PropertyType.Text);
newList.Filter = myFilter;
SmartObjectList list = server.ExecuteList(smartObject);
results = new Dictionary<string, string>[list.SmartObjectsList.Count];
for (int i = 0; i < list.SmartObjectsList.Count; i++)
{
results[i] = new Dictionary<string, string>();
SmartObject smo = list.SmartObjectsList[i];
foreach (SmartProperty property in smo.Properties)
{
results[i].Add(property.Name, property.Value);
}
}
return results;
就像myFilter
上面的代码一样,我想传递多个这样的过滤器。