public static int SelectCount(string tableName, string columnName, object value) { string query; if (value == null || value == DBNull.Value) { query = string.Format("select count(1) from {0} where {1} is null", tableName, columnName); } else { query = string.Format("select count(1) from {0} where {1} = '{2}'", tableName, columnName, value); } var count = ExecuteScalar(query); var result = -1; if (SupportUtils.IsNumber(count)) { if (count is int) { result = (int)count; } else { result = Convert.ToInt32(count); } } return(result); }
public static PatternItem getByType(Type type, int length) { if (SupportUtils.IsNumber(type)) { return(new PatternItem(SupportUtils.RangeString("#", length), "integer")); } return(null); }
private static string getRule(string columnName, Type dataType, bool isNotNull) { if (SupportUtils.IsNumber(dataType)) { return("isNumber"); } if (isNotNull) { return("isNotEmpty"); } return(string.Empty); }