Exemplo n.º 1
0
    public static string GetCount(
		BaseColumn col,
		WhereClause where,
		OrderBy orderBy,
		int pageIndex,
		int pageSize)
	{
        SqlBuilderColumnSelection colSel = new SqlBuilderColumnSelection(false, false);
        colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count);

        return PhotoClubsTable.Instance.GetColumnStatistics(colSel, null, where.GetFilter(), null, orderBy, pageIndex, pageSize);
    }
Exemplo n.º 2
0
        public static String[] GetValues(
            BaseColumn col,
            WhereClause where,
            OrderBy orderBy,
            int maxItems)
        {
            // Create the filter list.
            SqlBuilderColumnSelection retCol = new SqlBuilderColumnSelection(false, true);

            retCol.AddColumn(col);

            return(AreasTable.Instance.GetColumnValues(retCol, null, where.GetFilter(), null, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems));
        }
Exemplo n.º 3
0
        public static string GetSum(
            BaseColumn col,
            WhereClause where,
            OrderBy orderBy,
            int pageIndex,
            int pageSize)
        {
            SqlBuilderColumnSelection colSel = new SqlBuilderColumnSelection(false, false);

            colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum);

            return(View_StatsView.Instance.GetColumnStatistics(colSel, null, where.GetFilter(), null, orderBy, pageIndex, pageSize));
        }
Exemplo n.º 4
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;
         }
     }
 }
Exemplo n.º 5
0
        public static string GetSum(
            BaseColumn col,
            BaseFilter join,
            WhereClause where,
            OrderBy orderBy,
            int pageIndex,
            int pageSize)
        {
            SqlBuilderColumnSelection colSel = new SqlBuilderColumnSelection(false, false);

            colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum);

            return(AvailableWorkshopsTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), null, orderBy, pageIndex, pageSize));
        }
Exemplo n.º 6
0
        public static string GetCount(
            BaseColumn col,
            BaseFilter join,
            WhereClause where,
            OrderBy orderBy,
            int pageIndex,
            int pageSize)
        {
            SqlBuilderColumnSelection colSel = new SqlBuilderColumnSelection(false, false);

            colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count);

            return(View_FieldTripSelectionsView.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), null, orderBy, pageIndex, pageSize));
        }
Exemplo n.º 7
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;
    }
Exemplo n.º 8
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;
        }
Exemplo n.º 9
0
 /// <summary>
 /// This is a shared function that can be used to get total number of records that will be returned using the where clause.
 /// </summary>
 public static int PostGetRecordCount(SqlBuilderColumnSelection selectCols, BaseFilter join, BaseFilter finalFilter)
 {
     return((int)AreasTable.Instance.GetCountResponseForPost(AreasTable.Instance.TableDefinition, selectCols, join, finalFilter));
 }
Exemplo n.º 10
0
        public static String[] GetValues(
		BaseColumn col,
		BaseFilter join,
		WhereClause where,
		OrderBy orderBy,
		int maxItems)
        {
            // Create the filter list.
            SqlBuilderColumnSelection retCol = new SqlBuilderColumnSelection(false, true);
            retCol.AddColumn(col);

            return UsersTable.Instance.GetColumnValues(retCol, join, where.GetFilter(), null, orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems);
        }
Exemplo n.º 11
0
        public static string GetSum(
		BaseColumn col,
		BaseFilter join, 
		WhereClause where,
		OrderBy orderBy,
		int pageIndex,
		int pageSize)
        {
            SqlBuilderColumnSelection colSel = new SqlBuilderColumnSelection(false, false);
            colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum);

            return UsersTable.Instance.GetColumnStatistics(colSel, join, where.GetFilter(), null, orderBy, pageIndex, pageSize);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Return an array of values from the database.  The values returned are DISTINCT values.
        /// For example, GetColumnValues("Employees", "City") will return a list of all Cities
        /// from the Employees table. There will be no duplicates in the list.
        /// This function adds a Where Clause.  So you can say something like "Country = 'USA'" and in this
        /// case only cities in the US will be returned.
        /// You can use the IN operator to compare the values.  You can also use the resulting array to display
        /// such as String.Join(", ", GetColumnValues("Employees", "City", "Country = 'USA'")
        /// to display: New York, Chicago, Los Angeles, San Francisco
        /// </summary>
        /// <returns>An array of values for the given field as an Object.</returns>
        public static string[] GetColumnValues(string tableName, string fieldName, string whereStr)
        {
            // Find the
            PrimaryKeyTable bt = null;
            bt = (PrimaryKeyTable)DatabaseObjects.GetTableObject(tableName);
            if (bt == null)
            {
                throw new Exception("GETCOLUMNVALUES(" + tableName + ", " + fieldName + ", " + whereStr + "): " + Resource("Err:NoRecRetrieved"));
            }

            BaseColumn col = bt.TableDefinition.ColumnList.GetByCodeName(fieldName);
            if (col == null)
            {
                throw new Exception("GETCOLUMNVALUES(" + tableName + ", " + fieldName + ", " + whereStr + "): " + Resource("Err:NoRecRetrieved"));
            }

            string[] values = null;

            try
            {
                // Always start a transaction since we do not know if the calling function did.
                SqlBuilderColumnSelection sqlCol = new SqlBuilderColumnSelection(false, true);
                sqlCol.AddColumn(col);

                WhereClause wc = new WhereClause();
                if (!(whereStr == null) && whereStr.Trim().Length > 0)
                {
                    wc.iAND(whereStr);
                }
                BaseClasses.Data.BaseFilter join = null;
                values = bt.GetColumnValues(sqlCol, join, wc.GetFilter(), null, null, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE);
            }
            catch
            {
            }

            // The value can be null.  In this case, return an empty array since
            // that is an acceptable value.
            if (values == null)
            {
                values = new string[0];
            }

            return values;
        }
Exemplo n.º 13
0
        public static string GetCount(
		BaseColumn col,
		WhereClause where,
		OrderBy orderBy,
		int pageIndex,
		int pageSize)
        {
            SqlBuilderColumnSelection colSel = new SqlBuilderColumnSelection(false, false);
            colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count);

            return EstimateTable.Instance.GetColumnStatistics(colSel, null, where.GetFilter(), null, orderBy, pageIndex, pageSize);
        }
        public static string GetSum(
		BaseColumn col,
		WhereClause where,
		OrderBy orderBy,
		int pageIndex,
		int pageSize)
        {
            SqlBuilderColumnSelection colSel = new SqlBuilderColumnSelection(false, false);
            colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum);

            return VwPropSBondBudgetView.Instance.GetColumnStatistics(colSel, null, where.GetFilter(), null, orderBy, pageIndex, pageSize);
        }