示例#1
0
 protected object TryConvertToLikeString(object value, QueryConditionOperatorType type)
 {
     if (value != null && value.GetType().Equals(typeof(string)) && !ConditionConstructor.IsStringNullOrEmpty(value.ToString()))
     {
         if (type == QueryConditionOperatorType.Like)
         {
             return("%" + value.ToString() + "%");
         }
         else if (type == QueryConditionOperatorType.LeftLike)
         {
             return(value.ToString() + "%");
         }
         else if (type == QueryConditionOperatorType.RightLike)
         {
             return("%" + value.ToString());
         }
     }
     return(value);
 }
示例#2
0
 public ConditionConstructor AddSubQueryCondition(QueryConditionRelationType conditionRelationType,
                                                  string filedName, QueryConditionOperatorType conditionOperatorType, string subQuerySQLTemplate)
 {
     if (!IsStringNullOrEmpty(subQuerySQLTemplate))
     {
         SubQueryCondition condition = new SubQueryCondition()
         {
             ConditionRelationType = conditionRelationType,
             FieldName             = filedName,
             OperatorType          = conditionOperatorType,
             SubQuerySQLTemplate   = subQuerySQLTemplate,
             SubQueryConditions    = new List <Condition>()
         };
         m_conditions.Add(condition);
         ConditionConstructor result = new ConditionConstructor(condition.SubQueryConditions);
         return(result);
     }
     return(null);
 }