public static LookupInfo CGetLookupInfo(this ITableSource table, string pkcolname, IEnumerable <string> keys, Action guiCallback) { LookupInfo lookup = table.CGetLookupInfo_NoFill(pkcolname, guiCallback); if (lookup == null) { return(null); } if (!lookup.CGetData(table, keys, guiCallback)) { return(null); } return(lookup); }
void LoadLists() { // sem se to dostane az kdyz je m_dispModel cely vyplnen !!! if (!m_settings.ShowLookupHint && !m_settings.ShowLookupSelection) { TabularData.Connection.Cache.EndRefresh(); return; } var dialect = TabularData.Dialect ?? GenericDialect.Instance; m_listDrawers.Clear(); m_lookupInfo.Clear(); for (int colindex = 0; colindex < m_dispModel.Count; colindex++) { var fk = m_dispModel[colindex].Reference; if (fk == null) { continue; } ITableSource dsttable = CurrentData.TableSource.Database.GetTable(fk.PrimaryKeyTable); DataTable listData; try { listData = dsttable.CGetListData(m_settings.ListRowLimit, LoadLookupData); if (listData == null) { continue; // pokud jeste data nejsou nactena, nic nevime } } catch { // data jsou moc velka listData = null; //if (listData.Rows.Count > TableDataSettings.Instance.ListRowLimit) listData = null; } string pkcolname = fk.PrimaryKeyColumns[0].ColumnName; if (m_table != null && m_settings.ShowLookupHint && !Core.IsMono && dialect.DialectCaps.OptimizedComplexConditions) { if (listData == null) { var pks = new Dictionary <string, bool>(); foreach (BedRow row in m_table.Rows) { string pkval = row[colindex].SafeToString(); if (pkval != null) { pks[pkval] = true; } } if (!m_listDrawers.ContainsKey(colindex) || m_listDrawers[colindex] != null) { try { LookupInfo lookup = dsttable.CGetLookupInfo(pkcolname, pks.Keys, LoadLookupData); if (lookup != null) { ColumnListDrawer cld = new ColumnListDrawer(lookup); m_listDrawers[colindex] = cld; } } catch (Exception) { m_listDrawers[colindex] = null; } } } else { try { LookupInfo lookup = new LookupInfo(pkcolname, listData); m_listDrawers[colindex] = new ColumnListDrawer(lookup); } catch (Exception) { m_listDrawers[colindex] = null; } } } if (m_settings.ShowLookupSelection && listData != null) { m_lookupInfo[colindex] = new DataLookupInfo { PkColIndex = listData.Columns.GetOrdinal(fk.PrimaryKeyColumns[0].ColumnName), Table = listData }; } } m_wantRepaint = true; TabularData.Connection.Cache.EndRefresh(); }
internal ColumnListDrawer(LookupInfo lookup) { m_lookup = lookup; }