Beispiel #1
0
        public int FindCount <T>(string WhereSql, DbParameter[] parameters) where T : new()
        {
            StringBuilder builder = DatabaseCommon.SelectCountSql <T>();

            builder.Append(WhereSql);
            return(Convert.ToInt32(DbHelper.ExecuteScalar(CommandType.Text, builder.ToString(), parameters)));
        }
Beispiel #2
0
        public int FindCount <T>(string propertyName, string propertyValue) where T : new()
        {
            StringBuilder builder = DatabaseCommon.SelectCountSql <T>();

            builder.Append(" AND " + propertyName + " = " + DbHelper.DbParmChar + propertyName);
            IList <DbParameter> source = new List <DbParameter> {
                DbFactory.CreateDbParameter(DbHelper.DbParmChar + propertyName, propertyValue)
            };

            return(Convert.ToInt32(DbHelper.ExecuteScalar(CommandType.Text, builder.ToString(), source.ToArray <DbParameter>())));
        }
Beispiel #3
0
        public int FindCount <T>() where T : new()
        {
            StringBuilder builder = DatabaseCommon.SelectCountSql <T>();

            return(Convert.ToInt32(DbHelper.ExecuteScalar(CommandType.Text, builder.ToString())));
        }