Exemple #1
0
 public DbTerm(string tableName, string columnName, DbSymbol dbSymbol, object value)
 {
     TableName  = tableName;
     ColumnName = columnName;
     DbSymbol   = dbSymbol;
     Value      = value;
 }
Exemple #2
0
 public DbTerm2(string tableName, string columnName, DbSymbol dbSymbol, string tableName2, string columnName2)
 {
     TableName   = tableName;
     TableName2  = tableName2;
     ColumnName  = columnName;
     DbSymbol    = dbSymbol;
     ColumnName2 = columnName2;
 }
Exemple #3
0
        /// <summary>
        /// 创建条件
        /// </summary>
        /// <param name="obProperty">属性</param>
        /// <param name="dbSymbol">条件符号</param>
        /// <param name="obProperty2">属性2</param>
        /// <returns></returns>
        public static ObParameterBase Create(ObProperty obProperty, DbSymbol dbSymbol, ObProperty obProperty2)
        {
            Type t          = Assembly.Load(ASSEMBLY_STRING).GetType(CLASS_NAME);
            var  parameters = new object[]
            {
                obProperty,
                dbSymbol,
                obProperty2
            };

            return((ObParameterBase)Activator.CreateInstance(t, parameters));
        }
Exemple #4
0
        /// <summary>
        /// 创建带符号参数
        /// </summary>
        /// <param name="tableName">对象类型名(表名)</param>
        /// <param name="columnName">属性名(字段名)</param>
        /// <param name="dbSymbol">符号</param>
        /// <param name="tableName2">对象类型名(表名)</param>
        /// <param name="columnName2">属性名(字段名)</param>
        public ObParameter(string tableName, string columnName, DbSymbol dbSymbol, string tableName2, string columnName2)
        {
            var dbTrem = new DbTerm2(tableName, columnName, dbSymbol, tableName2, columnName2);

            Value = dbTrem;
        }
Exemple #5
0
        /// <summary>
        /// 创建带符号参数
        /// </summary>
        /// <param name="tableName">对象类型名(表名)</param>
        /// <param name="columnName">属性名(字段名)</param>
        /// <param name="dbSymbol">符号</param>
        /// <param name="value">值</param>
        public ObParameter(string tableName, string columnName, DbSymbol dbSymbol, object value)
        {
            var dbTrem = new DbTerm(tableName, columnName, dbSymbol, value);

            Value = dbTrem;
        }
Exemple #6
0
        /// <summary>
        /// 创建带符号参数
        /// </summary>
        /// <param name="srcValue"></param>
        /// <param name="dbSymbol"></param>
        /// <param name="dstValue"></param>
        public ObParameter(IObProperty srcValue, DbSymbol dbSymbol, object dstValue)
        {
            var dbTrem = new DbTerm3(srcValue, dbSymbol, dstValue);

            Value = dbTrem;
        }
Exemple #7
0
 public DbTerm3(IObProperty srcValue, DbSymbol dbSymbol, object dstValue)
 {
     SrcValue = srcValue;
     DbSymbol = dbSymbol;
     DstValue = dstValue;
 }
Exemple #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="symbolString"></param>
        /// <param name="value"></param>
        /// <param name="symbol"></param>
        /// <param name="dbValue"></param>
        /// <returns>0失败 1正常 2is null或is not null</returns>
        private static int SymbolTryParse(string symbolString, object value, out DbSymbol symbol, out DbValue dbValue)
        {
            var ret = 1;

            dbValue = DbValue.IsNull;
            switch (symbolString)
            {
            case "==":
                symbol = DbSymbol.Equal;
                if (value == null)
                {
                    ret     = 2;
                    dbValue = DbValue.IsNull;
                }
                break;

            case ">":
                symbol = DbSymbol.Than;
                break;

            case "<":
                symbol = DbSymbol.Less;
                break;

            case ">=":
                symbol = DbSymbol.ThanEqual;
                break;

            case "<=":
                symbol = DbSymbol.LessEqual;
                break;

            case "!=":
                symbol = DbSymbol.NotEqual;
                if (value == null)
                {
                    ret     = 2;
                    dbValue = DbValue.IsNotNull;
                }
                break;

            default:
                if (Enum.TryParse(symbolString, true, out symbol))
                {
                    switch (symbol)
                    {
                    case DbSymbol.Equal:
                        if (value == null)
                        {
                            ret     = 2;
                            dbValue = DbValue.IsNull;
                        }
                        break;

                    case DbSymbol.NotEqual:
                        if (value == null)
                        {
                            ret     = 2;
                            dbValue = DbValue.IsNotNull;
                        }
                        break;

                    case DbSymbol.Like:
                    case DbSymbol.LikeLeft:
                    case DbSymbol.LikeRight:
                        if (value == null || value.ToString() == "")
                        {
                            ret = 0;
                        }
                        break;
                    }
                }
                else
                {
                    ret = 0;
                }
                break;
            }
            return(ret);
        }