コード例 #1
0
    /// <summary>
    /// This is a shared function that can be used to get an array of PhotoClubsRecord records using a where and order by clause clause with pagination.
    /// </summary>
    public static ArrayList PostGetRecordList(SqlBuilderColumnSelection requestedSelection, SqlBuilderColumnSelection workingSelection, SqlBuilderColumnSelection distinctSelection,
            BaseFilter join, BaseFilter filter, GroupBy groupBy, OrderBy sortOrder, int startIndex, int count, ref int totalCount, Boolean fromDataSource, 
			KeylessVirtualTable table = null, Boolean isGetColumnValues = false)
    {
        ArrayList recList = null;
        if (table == null)
        {
            recList = PhotoClubsTable.Instance.GetRecordListResponseForPost(PhotoClubsTable.Instance.TableDefinition, requestedSelection, workingSelection, distinctSelection,
                                                                join, filter, groupBy, sortOrder, startIndex, count, ref totalCount, fromDataSource, isGetColumnValues);
        }
        else if (table != null)
        {
            recList = table.GetDataSourceResponseForPost(requestedSelection, workingSelection, distinctSelection, join, filter, 
                groupBy, sortOrder, startIndex, count, ref totalCount, true);
        }

		return recList;
    }
コード例 #2
0
        public static void ConstructDataSourceObjectFromPostRequest(JSONDataSource jsonDS, ref SqlBuilderColumnSelection requestedCols, ref SqlBuilderColumnSelection workingSelCols,
                                                                    ref SqlBuilderColumnSelection distinctSelCols, ref OrderBy orderBy, ref KeylessVirtualTable table)
        {
            DataSource ds = new DataSource();

            ds.Initialize(jsonDS.Name, DatabaseObjects.GetTableObject(jsonDS.Table), jsonDS.PageSize, jsonDS.PageIndex, jsonDS.GenerateTotal);

            if ((jsonDS.JSelectItems != null))
            {
                foreach (JDataSourceSelectItem jsonSItem in jsonDS.JSelectItems)
                {
                    ds.AddSelectItem(ConstructSelectItemFromPostRequest(jsonSItem));
                }
            }

            requestedCols   = new SqlBuilderColumnSelection(jsonDS.ExpandForeignKeyColumns, jsonDS.IsDistinct);
            workingSelCols  = new SqlBuilderColumnSelection(jsonDS.ExpandForeignKeyColumns, jsonDS.IsDistinct);
            distinctSelCols = new SqlBuilderColumnSelection(jsonDS.ExpandForeignKeyColumns, jsonDS.IsDistinct);

            List <BaseColumn> columnsList = null;

            if (jsonDS.isTotalRecordArray)
            {
                columnsList = ds.CreateColumnSelectionsForTotal(ref requestedCols, ref workingSelCols, ref distinctSelCols);
            }
            else
            {
                columnsList = ds.CreateColumnSelections(ref requestedCols, ref workingSelCols, ref distinctSelCols);
            }
            table = ds.CreateVirtualTable(columnsList.ToArray());

            if ((jsonDS.JOrderByList != null))
            {
                foreach (JOrderBy jsonOrderBy in jsonDS.JOrderByList)
                {
                    ds.AddAggregateOrderBy(jsonOrderBy.ColumnName, OrderByItem.ToOrderDir(jsonOrderBy.OrderDirection));
                }
            }
            ds.UpdateOrderBy(columnsList);
            orderBy = ds.OrderBy;
        }
コード例 #3
0
 public static void ParseData(List <KeyValuePair <string, string> > values, ref SqlBuilderColumnSelection requestedCols, ref SqlBuilderColumnSelection workingSelCols,
                              ref SqlBuilderColumnSelection distinctSelCols, ref OrderBy orderBy, ref KeylessVirtualTable table)
 {
     foreach (KeyValuePair <string, string> value in values)
     {
         switch (value.Key)
         {
         case "SelectColumns":
             JSONDataSource jsonDS = JsonConvert.DeserializeObject <JSONDataSource>(value.Value);
             ConstructDataSourceObjectFromPostRequest(jsonDS, ref requestedCols, ref workingSelCols, ref distinctSelCols, ref orderBy, ref table);
             break;
         }
     }
 }