Пример #1
0
        public object MaxValue(string FieldName, string TableName,
                               string Conditions, object DefaultValue,
                               params FieldParam[] Parameters)
        {
            object _Value;
            string SqlSelect = string.Concat("SELECT ",
                                             Dp.GetSqlMax(), "(", FieldName, ") FROM ", TableName);

            if (Conditions.Length > 0)
            {
                SqlSelect = string.Concat(SqlSelect, " WHERE ", Conditions);
            }
            return(TryFindValue(SqlSelect, out _Value, Parameters) ?
                   _Value : DefaultValue);
        }
Пример #2
0
        public bool TryFindMaxValue <TEntity>(string FieldName,
                                              string Conditions, out object Value,
                                              params FieldParam[] Parameters)
            where TEntity : BaseEntity
        {
            TableDef        td = MetaData.GetTableDef(typeof(TEntity));
            DataPersistance Dp = td.GetDataPersistance(this.Dp);

            Dp.ValidateTableDef(td);

            string SqlSelect = string.Concat("SELECT ", Dp.GetSqlMax(),
                                             "(", GetFieldName(td, FieldName),
                                             ") FROM ", td.GetSqlHeaderView(Dp));

            if (Conditions.Length > 0)
            {
                SqlSelect = string.Concat(SqlSelect, " WHERE ", Conditions);
            }
            return(Dp.Find.TryFindValue(SqlSelect, out Value, Parameters));
        }