예제 #1
0
        /// <summary>
        /// Carica oggetto a partire da un filtro custom
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="order"></param>
        internal void LoadByFilter(IFilter filter, OrderBy order)
        {
            IDataBase db = this.Slot.DbGet(this.mClassSchema);

            //SQL DIRETTO
            var sb = new StringBuilder(this.mClassSchema.TableDef.SQL_Select_Item);

            sb.Append(this.Slot.DbPrefixGetTableName(this.mClassSchema.TableDef));
            sb.Append(@" WHERE ");

            //Imposta parametri WHERE
            filter.AppendFilterSql(db, sb, 0);

            //Se valorizzato include l'order by
            if (order != null)
            {
                sb.Append(order.ToString());
            }

            //imposta query
            db.SQL = sb.ToString();

            //Imposta dati dopo query
            this.ExecQueryAndLoadObj(db);
        }
예제 #2
0
        /// <summary>
        /// Ricerca attraverso un filtro di colonna
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        internal protected DataListBase searchByColumn(IFilter filter)
        {
            //Imposta sql
            IDataBase db = this.Slot.DbGet(this.mObjSchema);
            //Inizia a preparare SQL
            StringBuilder sql = null;

            if (this.mLoadFullObjects)
            {
                sql = new StringBuilder(string.Intern(this.mObjSchema.TableDef.SQL_Select_Item), this.mObjSchema.TableDef.SQL_Select_Item.Length + 300);
            }
            else
            {
                sql = new StringBuilder(string.Intern(this.mObjSchema.TableDef.SQL_Select_List), this.mObjSchema.TableDef.SQL_Select_List.Length + 300);
            }

            sql.Append(this.Slot.DbPrefixGetTableName(this.mObjSchema.TableDef));
            //Se fornito filtro
            if (filter != null)
            {
                //Imposta SQL filtro
                sql.Append(@" WHERE ");
                filter.AppendFilterSql(db, sql, 0);
            }

            db.SQL = sql.ToString();

            //Imposta provenienza ricerca
            this.mIsSearch = true;

            //Esegue e Ritorna se stesso
            return(this.doSearch());
        }