示例#1
0
 /// <summary>
 /// Instantiate the object.
 /// </summary>
 /// <param name="columnName">Column name on which to order results.</param>
 /// <param name="direction">Direction by which results should be returned.</param>
 public DbResultOrder(string columnName, DbOrderDirection direction)
 {
     if (String.IsNullOrEmpty(columnName))
     {
         throw new ArgumentNullException(nameof(columnName));
     }
     ColumnName = columnName;
     Direction  = direction;
 }
示例#2
0
 public SqlOrderColumn(IDbSelectable selectable, DbOrderDirection direction = DbOrderDirection.Asc)
 {
     DbSelectable = selectable;
     Direction    = direction;
 }
 public IDbOrderByColumn BuildOrderByColumn(IDbSelectable selectable, DbOrderDirection direction = DbOrderDirection.Asc)
 {
     return(new SqlOrderColumn(selectable, direction));
 }
示例#4
0
        public DbResult <Track> FindAll(
            string searchString = "",
            bool doPaging       = false, int pageNo = 1, int pageSize = 25,
            string orderBy      = "id", DbOrderDirection orderDirection = DbOrderDirection.ASC)
        {
            IEnumerable <Track> entities = null;
            var count = 0;

            using (IDbConnection conn = factory.GetConnection())
            {
                #region Criteria

                if (!String.IsNullOrEmpty(searchString))
                {
                    throw new NotImplementedException();
                }

                #endregion

                #region Sql Ordering

                var sqlOrderBy = String.Empty;

                if (!String.IsNullOrEmpty(orderBy) || orderSetting[orderBy] == null)
                {
                    orderBy = "id";
                }

                if (orderSetting[orderBy] != null)
                {
                    sqlOrderBy = "order by " + orderSetting[orderBy];

                    if (orderDirection == DbOrderDirection.ASC)
                    {
                        sqlOrderBy = sqlOrderBy + " asc";
                    }
                    else
                    {
                        sqlOrderBy = sqlOrderBy + " desc";
                    }
                }

                #endregion

                #region Find Count

                var sqlCount = "select count(*) from Track";
                conn.Open();
                count = conn.Query <int>(sqlCount, new { searchString = searchString }).FirstOrDefault <int>();
                conn.Close();

                #endregion

                #region Paging

                if (doPaging)
                {
                    throw new NotImplementedException();
                }

                #endregion

                var sql = String.Empty;
                sql = "select TrackId as Id, Name from Track";

                conn.Open();
                entities = conn.Query <Track>(sql);
            }

            return(new DbResult <Track>()
            {
                Items = entities, Count = count
            });
        }
示例#5
0
 /// <summary>
 /// Instantiate the object.
 /// </summary>
 public DbResultOrder()
 {
     ColumnName = null;
     Direction  = DbOrderDirection.Ascending;
 }