// called to retrieve data from database protected override void Fetch(CriteriaEx criteria) { this.RaiseListChangedEvents = false; SessionCode = criteria.SessionCode; Childs = criteria.Childs; try { if (nHMng.UseDirectSQL) { IDataReader reader = nHManager.Instance.SQLNativeSelect(criteria.Query, Session()); IsReadOnly = false; while (reader.Read()) { this.AddItem(AgenteInfo.Get(SessionCode, reader, Childs)); } IsReadOnly = true; if (criteria.PagingInfo != null) { reader = nHManager.Instance.SQLNativeSelect(Agente.SELECT_COUNT(criteria), criteria.Session); if (reader.Read()) { criteria.PagingInfo.TotalItems = Format.DataReader.GetInt32(reader, "TOTAL_ROWS"); } } } } catch (Exception ex) { iQExceptionHandler.TreatException(ex, new object[] { criteria.Query }); } this.RaiseListChangedEvents = true; }