Exemplo n.º 1
0
        public SqlOrderByCollection OrderBy(
            Context context,
            SiteSettings ss,
            SqlOrderByCollection orderBy = null,
            int pageSize = 0)
        {
            orderBy = orderBy ?? new SqlOrderByCollection();
            if (ColumnSorterHash?.Any() == true)
            {
                ColumnSorterHash?.ForEach(data =>
                {
                    switch (data.Key)
                    {
                    case "ItemTitle":
                        orderBy.Add(new SqlOrderBy(
                                        columnBracket: "[Title]",
                                        orderType: data.Value,
                                        tableName: "Items"));
                        break;

                    default:
                        orderBy.Add(
                            column: ss.GetColumn(context: context, columnName: data.Key),
                            orderType: data.Value);
                        break;
                    }
                });
            }
            return(pageSize > 0 && orderBy?.Any() != true
                ? new SqlOrderByCollection().Add(
                       tableName: ss.ReferenceType,
                       columnBracket: "[UpdatedTime]",
                       orderType: SqlOrderBy.Types.desc)
                : orderBy);
        }
Exemplo n.º 2
0
 public SqlOrderByCollection OrderBy(SiteSettings ss, SqlOrderByCollection orderBy = null)
 {
     orderBy = orderBy ?? new SqlOrderByCollection();
     if (ColumnSorterHash?.Any() == true)
     {
         ColumnSorterHash?.ForEach(data =>
                                   orderBy.Add(ss.GetColumn(data.Key), data.Value));
     }
     return(orderBy);
 }
Exemplo n.º 3
0
 public SqlOrderByCollection OrderBy(
     SiteSettings ss, SqlOrderByCollection orderBy = null, int pageSize = 0)
 {
     orderBy = orderBy ?? new SqlOrderByCollection();
     if (ColumnSorterHash?.Any() == true)
     {
         ColumnSorterHash?.ForEach(data =>
                                   orderBy.Add(ss.GetColumn(data.Key), data.Value));
     }
     return(pageSize > 0 && orderBy?.Any() != true
         ? new SqlOrderByCollection().Add(
                tableName: ss.ReferenceType,
                columnBracket: "[UpdatedTime]",
                orderType: SqlOrderBy.Types.desc)
         : orderBy);
 }