예제 #1
0
        internal IO.Item DBQuery(String ID)
        {
            IO.Item query = new IO.Item(this.ItemType.Name, "get");
            query.ID = ID;

            // Set Select
            if (String.IsNullOrEmpty(this.Select))
            {
                // Use default selection
                this.Select = "keyed_name";
            }

            query.Select = SystemProperties + "," + this.Select;

            foreach (PropertyTypes.Item proptype in this.SelectPropertyCache.Keys)
            {
                if (!proptype.Name.Equals("source_id"))
                {
                    IO.Item propquery = this.SelectPropertyCache[proptype].DBQuery();
                    query.SetPropertyItem(proptype.Name, propquery);
                }
            }

            foreach (Query relquery in this.Relationships)
            {
                query.AddRelationship(relquery.DBQuery());
            }

            return(query);
        }
예제 #2
0
        internal IO.Item DBQuery()
        {
            if (this.Condition != null)
            {
                IO.Item query = new IO.Item(this.ItemType.Name, "get");

                // Set Select
                if (String.IsNullOrEmpty(this.Select))
                {
                    // Use default selection
                    this.Select = "keyed_name";
                }

                query.OrderBy = this.OrderBy;

                query.Select = SystemProperties + "," + this.Select;

                // Set Where from Condtion
                query.Where = this.Condition.Where(this.ItemType);

                // Set Paging
                if (this.Paging)
                {
                    query.PageSize = this.PageSize;
                    query.Page     = this.Page;
                }

                foreach (PropertyTypes.Item proptype in this.SelectPropertyCache.Keys)
                {
                    if (!proptype.Name.Equals("source_id") && !proptype.Name.Equals("related_id"))
                    {
                        IO.Item propquery = this.SelectPropertyCache[proptype].DBQuery();
                        query.SetPropertyItem(proptype.Name, propquery);
                    }
                }

                foreach (Query relquery in this.Relationships)
                {
                    query.AddRelationship(relquery.DBQuery());
                }

                return(query);
            }
            else
            {
                return(null);
            }
        }