Esempio n. 1
0
    public void testOject()
    {
        Wilson.ORMapper.ObjectQuery oq = new Wilson.ORMapper.ObjectQuery(typeof(C2.CtmJob), "", "");
        Wilson.ORMapper.ObjectSet   os = C2.Manager.ORManager.GetObjectSet(oq);
        string context = Common.ObjectToJson(os);

        Common.WriteJsonP(true, context);
    }
Esempio n. 2
0
		internal ObjectReader(Internals.Context context, ObjectQuery objectQuery, bool firstLevel) {
			this.context = context;
			this.firstLevel = firstLevel;
			this.objectType = objectQuery.ObjectType;
			this.pageIndex = objectQuery.PageIndex;
			this.hasEvents = context.Mappings[this.objectType.ToString()].HasEvents;

			Internals.Commands commands = context.Mappings.Commands(this.objectType.ToString());
			if (objectQuery.PageSize > 0 && !objectQuery.SkipCounts) {
				string selectCount = commands.RecordCount(objectQuery.WhereClause);
				this.totalCount = int.Parse(context.Connection.GetScalarValue(this.objectType, CommandInfo.GetCount, selectCount).ToString());
				double pages = (double) (1 + (this.totalCount - 1) / objectQuery.PageSize);
				this.pageCount = int.Parse(Math.Floor(pages).ToString());
			}
			this.data = context.Connection.GetDataReader(this.objectType, CommandInfo.Select, commands.Select(objectQuery));
			this.firstRead = true;
			if (this.data != null) this.hasObjects = this.data.Read();
			if (!this.hasObjects) this.Close();
		}
Esempio n. 3
0
 /// <summary>
 ///     Get a Raw DataSet with custom Fields
 /// </summary>
 /// <param name="dataSet">
 ///     The typed dataset to populate with the resultset
 /// </param>
 /// <param name="objectQuery" type="Wilson.ORMapper.ObjectQuery">
 ///     The ObjectQuery instance used to generate the SQL where clause
 /// </param>
 /// <param name="selectFields" type="string[]">
 ///     An array of fields to select
 /// </param>
 /// <returns>
 ///     A System.Data.DataSet object instance
 /// </returns>
 public DataSet GetDataSet(DataSet dataSet, ObjectQuery objectQuery, string[] selectFields)
 {
     string sortClause = (objectQuery.SortClause.Length > 0 ? objectQuery.SortClause
         : this.context.Mappings[objectQuery.ObjectType.ToString()].SortOrder);
     ObjectQuery query = new ObjectQuery(objectQuery.ObjectType,	objectQuery.WhereClause,
         sortClause, objectQuery.PageSize, objectQuery.PageIndex);
     Commands commands = this.context.Mappings.Commands(query.ObjectType.ToString());
     return this.context.Connection.TransactionDataSet(this.id, objectQuery.ObjectType, CommandInfo.DataSet, this.transaction, dataSet, commands.Select(query, selectFields));
 }
Esempio n. 4
0
 /// <summary>
 ///     Get a Raw DataSet with custom Fields
 /// </summary>
 /// <param name="dataSet">
 ///     The typed dataset to populate with the resultset
 /// </param>
 /// <param name="objectType" type="System.Type">
 ///     The type of object to retrieve
 /// </param>
 /// <param name="whereClause" type="string">
 ///     The SQL where clause to use when retrieving data
 /// </param>
 /// <param name="selectFields" type="string[]">
 ///     An array of fields to select
 /// </param>
 /// <returns>
 ///     A System.Data.DataSet object instance
 /// </returns>
 public DataSet GetDataSet(DataSet dataSet, Type objectType, string whereClause, string[] selectFields)
 {
     ObjectQuery query = new ObjectQuery(objectType, whereClause, String.Empty);
     return this.GetDataSet(dataSet, query, selectFields);
 }
Esempio n. 5
0
 /// <summary>
 ///     Get a Raw DataSet with custom Fields
 /// </summary>
 /// <param name="objectQuery" type="Wilson.ORMapper.ObjectQuery">
 ///     The ObjectQuery instance used to generate the SQL where clause
 /// </param>
 /// <param name="selectFields" type="string[]">
 ///     An array of fields to select
 /// </param>
 /// <returns>
 ///     A System.Data.DataSet object instance
 /// </returns>
 public DataSet GetDataSet(ObjectQuery objectQuery, string[] selectFields)
 {
     string sortClause = (objectQuery.SortClause.Length > 0 ? objectQuery.SortClause
         : this.context.Mappings[objectQuery.ObjectType.ToString()].SortOrder);
     ObjectQuery query = new ObjectQuery(objectQuery.ObjectType,	objectQuery.WhereClause,
         sortClause, objectQuery.PageSize, objectQuery.PageIndex);
     return this.GetDataSet(null, query, selectFields);
 }
Esempio n. 6
0
 /// <summary>
 ///     Get a Raw DataSet where may be Needed
 /// </summary>
 /// <param name="objectType" type="System.Type">
 ///     The type of object to retrieve
 /// </param>
 /// <param name="whereClause" type="string">
 ///     The SQL where clause to use when retrieving data
 /// </param>
 /// <returns>
 ///     A System.Data.DataSet object instance
 /// </returns>
 public DataSet GetDataSet(Type objectType, string whereClause)
 {
     ObjectQuery query = new ObjectQuery(objectType, whereClause, String.Empty);
     return this.GetDataSet(query);
 }
Esempio n. 7
0
 internal ObjectList(Internals.Context context, ObjectQuery objectQuery)
 {
     this.context = context;
     this.type = objectQuery.ObjectType;
     this.query = objectQuery;
 }