本文整理汇总了C#中CriteriaOperator类的典型用法代码示例。如果您正苦于以下问题:C# CriteriaOperator类的具体用法?C# CriteriaOperator怎么用?C# CriteriaOperator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CriteriaOperator类属于命名空间,在下文中一共展示了CriteriaOperator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TranslateCriteriaOperator
public static string TranslateCriteriaOperator(CriteriaOperator criteriaOperator)
{
if (criteriaOperator == CriteriaOperator.Equal)
return "=";
if (criteriaOperator == CriteriaOperator.NotEqual)
return "<>";
if (criteriaOperator == CriteriaOperator.GreaterThan)
return ">";
if (criteriaOperator == CriteriaOperator.GreaterThanOrEqual)
return ">=";
if (criteriaOperator == CriteriaOperator.LesserThan)
return "<";
if (criteriaOperator == CriteriaOperator.LesserThanOrEqual)
return "<=";
if (criteriaOperator == CriteriaOperator.Like)
return " LIKE ";
if (criteriaOperator == CriteriaOperator.NotLike)
return " NOT LIKE ";
if (criteriaOperator == CriteriaOperator.IsNull)
return " IS NULL ";
if (criteriaOperator == CriteriaOperator.IsNotNull)
return " IS NOT NULL ";
throw new ArgumentException("CriteriaOperator not supported", "criteriaOperator");
}
示例2: Criteria
public Criteria(String propertyName, String value, CriteriaOperator criteriaOperator, LogicalOperation logicalOperation = Core.Query.LogicalOperation.And)
{
this.PropertyName = propertyName;
this.Value = value;
this.Operator = criteriaOperator;
this.LogicalOperation = logicalOperation;
}
示例3: Criterion
public Criterion(string fieldName, string parameterName, object parameterValue, CriteriaOperator criterriaOperator)
{
_fieldName = fieldName;
_parameterName = parameterName;
_parameterValue = parameterValue;
_criteriaOperator = criterriaOperator;
}
示例4: ApplyCustomFilter
private void ApplyCustomFilter()
{
if (Frame.View == null)
return;
switch (Frame.View.Id)
{
case "WHHistory_ListView_ThisMonth":
DateTime thisMonth;
thisMonth = DateTime.Today;
thisMonth = thisMonth.AddDays((thisMonth.Day -1) * -1);
criteria = CriteriaOperator.Parse(string.Format("Date >= '{0}'", thisMonth));
break;
case "WHHistory_ListView_ThisWeek":
criteria = CriteriaOperator.Parse(string.Format("Date >= '{0}'", DateTime.Today.AddDays(-7)));
break;
case "WHHistory_ListView_ThisYear":
DateTime thisYear;
thisYear = DateTime.Today;
thisYear = thisYear.AddMonths((thisYear.Month - 1) * -1);
thisYear = thisYear.AddDays((thisYear.Day -1 )* -1);
criteria = CriteriaOperator.Parse(string.Format("Date >= '{0}'", thisYear));
break;
case "WHHistory_ListView":
criteria = null;
break;
}
((ListView)Frame.View).CollectionSource.Criteria["MyFilter"] = criteria;
}
示例5: CreateFilterCriteria
CriteriaOperator CreateFilterCriteria()
{
if (!Filter_words)
{ // точное совпадение
CriteriaOperator[] operators = new CriteriaOperator[_View.VisibleColumns.Count];
for (int i = 0; i < _View.VisibleColumns.Count; i++)
{
if (Filter_Plus)
operators[i] = new BinaryOperator(_View.VisibleColumns[i].FieldName, String.Format("%{0}%", _ActiveFilter), BinaryOperatorType.Like);
else
operators[i] = new BinaryOperator(_View.VisibleColumns[i].FieldName, String.Format("{0}%", _ActiveFilter), BinaryOperatorType.Like);
}
return new GroupOperator(GroupOperatorType.Or, operators);
}
else
{ // любое слово
CriteriaOperator[] levels = new CriteriaOperator[FilterText.Length];
for (int i = 0; i < FilterText.Length; i++)
{
CriteriaOperator[] operators = new CriteriaOperator[_View.VisibleColumns.Count + 1]; // Тэги + 1
for (int j = 0; j < _View.VisibleColumns.Count; j++)
{
operators[j] = new BinaryOperator(_View.VisibleColumns[j].FieldName, String.Format("%{0}%", FilterText[i]), BinaryOperatorType.Like);
}
// Тэги
operators[_View.VisibleColumns.Count] = new BinaryOperator("TagComments", String.Format("%{0}%", FilterText[i]), BinaryOperatorType.Like);
levels[i] = new GroupOperator(GroupOperatorType.Or, operators);
}
return new GroupOperator(GroupOperatorType.And, levels);
}
}
示例6: MasterDetailRuleInfo
public MasterDetailRuleInfo(IModelListView childListView, IModelMember collectionMember, ITypeInfo typeInfo, CriteriaOperator criteria, bool synchronizeActions) {
ChildListView = childListView;
CollectionMember = collectionMember;
TypeInfo = typeInfo;
_criteria = criteria;
_synchronizeActions = synchronizeActions;
}
示例7: PrepareCriteria
public CriteriaOperator PrepareCriteria(CriteriaOperator op)
{
if (op is FunctionOperator)
{
var funcOp = new FunctionOperator();
for (int i = 0; i < (op as FunctionOperator).Operands.Count; i++)
funcOp.Operands.Add(PrepareCriteria((op as FunctionOperator).Operands[i]));
return funcOp;
}
else if (op is ConstantValue)
{
var cnst = new ConstantValue((op as ConstantValue).Value);
if (String.Concat((op as ConstantValue).Value).ToLower().IndexOf("@this") > -1)
{
IMemberInfo info;
cnst.Value = ObjectFormatValues.GetValueRecursive((op as ConstantValue).Value.ToString().Replace("@This.", "").Replace("@This", "").Replace("@this.", "").Replace("@this", ""), CurrentObject, out info);
}
return cnst;
}
else if (op is BinaryOperator)
{
var binary = new BinaryOperator();
binary.LeftOperand = PrepareCriteria((op as BinaryOperator).LeftOperand);
binary.RightOperand = PrepareCriteria((op as BinaryOperator).RightOperand);
return binary;
}
else
{
return op;
}
}
示例8: Criterion
/// <summary>
/// Initializes a new instance of the Idiorm.Criterion class that uses the property name, the value and the operator of the new Idiorm.Criterion.
/// </summary>
/// <param name="propertyName">The name of the property to map.</param>
/// <param name="operator">The operator of the new Idiorm.Criterion object.</param>
/// <param name="value">The value of the new Idiorm.Criterion object.</param>
public Criterion(string propertyName, CriteriaOperator @operator, object value)
: this()
{
this.propertyName = propertyName;
this.value = value;
[email protected] = @operator;
}
示例9: getGroupOperator
private static BinaryOperator getGroupOperator(out BinaryOperator binaryOperator2,
out CriteriaOperator groupOperator)
{
var binaryOperator = new BinaryOperator("dfs", 324);
binaryOperator2 = new BinaryOperator("sdfs", 3455);
groupOperator = new GroupOperator(binaryOperator, binaryOperator2);
return binaryOperator;
}
示例10: IsFullIndexed
private bool IsFullIndexed(CriteriaOperator theOperator){
var queryOperand = theOperator as QueryOperand;
if (!ReferenceEquals(queryOperand, null)){
return IsFullIndexedCore(queryOperand.ColumnName);
}
var operandProperty = theOperator as OperandProperty;
return !ReferenceEquals(operandProperty, null) && IsFullIndexedCore(operandProperty.PropertyName);
}
示例11: Replace
public void Replace(ref CriteriaOperator criteriaOperator, string matchString, CriteriaOperator replaceOperator)
{
if (criteriaOperator.ToString() == matchString)
{
criteriaOperator = replaceOperator;
return;
}
Extract(criteriaOperator, matchString, replaceOperator);
}
示例12: Remove
public void Remove(ref CriteriaOperator criteriaOperator, string removeString)
{
if (criteriaOperator.ToString() == removeString)
{
criteriaOperator = null;
return;
}
Extract(criteriaOperator, removeString);
}
示例13: GetExpressionEvaluator
private ExpressionEvaluator GetExpressionEvaluator(CriteriaOperator criteria)
{
if (criteria.ToString() == lastCriteria)
return lastEvaluator;
lastCriteria = criteria.ToString();
PropertyDescriptorCollection pdc = ((ITypedList)_View.DataSource).GetItemProperties(null);
lastEvaluator = new ExpressionEvaluator(pdc, criteria, false);
return lastEvaluator;
}
示例14: Extract
private CriteriaOperator Extract(CriteriaOperator criteriaOperator, string matchString,
CriteriaOperator replaceOperator)
{
if (criteriaOperator is BinaryOperator)
{
var binaryOperator = (BinaryOperator) criteriaOperator;
binaryOperators.Add(binaryOperator);
return binaryOperator;
}
if (criteriaOperator is NullOperator)
{
nullOperators.Add((NullOperator) criteriaOperator);
return criteriaOperator;
}
if (criteriaOperator is NotOperator)
{
var notOperator = (NotOperator) criteriaOperator;
notOperators.Add(notOperator);
Extract(notOperator.Operand);
}
else if (criteriaOperator is UnaryOperator)
{
unaryOperators.Add((UnaryOperator) criteriaOperator);
return criteriaOperator;
}
else if (criteriaOperator is GroupOperator)
{
var groupOperator = (GroupOperator) criteriaOperator;
CriteriaOperatorCollection operands = groupOperator.Operands;
var indexesToremove = new List<int>();
for (int i = 0; i < operands.Count; i++){
CriteriaOperator operand = operands[i];
if (operand.ToString() == matchString){
if (ReferenceEquals(replaceOperator,null))
indexesToremove.Add(i);
else
operands[i] = replaceOperator;
}
else{
CriteriaOperator extract = Extract(operand);
operands.RemoveAt(i);
operands.Insert(i, extract);
}
}
foreach (int i in indexesToremove)
operands.RemoveAt(i);
}
else if (criteriaOperator is ContainsOperator)
{
var containsOperator = (ContainsOperator) criteriaOperator;
CriteriaOperator condition = containsOperator.Condition;
Extract(condition);
}
return criteriaOperator;
}
示例15: Process
public void Process(CriteriaOperator operand, bool mustBeLogical)
{
if (ReferenceEquals(operand, null)) return;
if (mustBeLogical) {
if ((BooleanCriteriaState)operand.Accept(this) == BooleanCriteriaState.Value) throw new ArgumentException(MustBeLogical);
} else {
if ((BooleanCriteriaState)operand.Accept(this) == BooleanCriteriaState.Logical) throw new ArgumentException(MustBeArithmetical);
}
}