Esempio n. 1
0
        /// <summary>
        /// Execute SmallWorld search
        /// </summary>
        /// <param name="eqp"></param>

        void ExecuteSmallWorldSearch(
            ExecuteQueryParms eqp)
        {
            if (!SmallWorldDao.IsSmallWorldAvailable())
            {
                throw new UserQueryException("SmallWorld searching is not currently available.");
            }

            Query      q  = eqp.QueryTable.Query;
            QueryTable qt = eqp.QueryTable;

            SmallWorldPredefinedParameters swp = Pssc.SmallWorldParameters;
            string smiles = Pssc.Molecule.GetSmilesString();

            swp.Smiles = smiles;
            //swp.Database = "Corp";

            LastSwNonSqlBroker = null;     // debug - force new broker

            if (SwDao == null)             // if Dao not allocated then allocate & execute the search
            {
                if (LastSwNonSqlBroker != null && LastSwNonSqlBroker.Pssc != null && LastSwNonSqlBroker.Pssc.SmallWorldParameters != null &&
                    LastSwNonSqlBroker.Pssc.SmallWorldParameters.Serialize() == swp.Serialize())
                {
                    SwDao = LastSwNonSqlBroker.SwDao;                     // get rows from previous search
                    SwDao.BuildSwToQeColumnMap(SelectList);               // reset the column map for this broker instance
                }

                else
                {
                    SwDao = new SmallWorldDao();
                    SwDao.KeysToExclude = q.KeysToExclude;
                    SwDao.ExecuteSearch(swp);
                    SwDao.BuildSwToQeColumnMap(SelectList);        //
                    LastSwNonSqlBroker = this;                     // remember for future use
                }
            }

            BuildSmallWorldQueryEngineRows(eqp);             // build the QE row set (filtered) from the SW rowset

            return;
        }
Esempio n. 2
0
        private void SavePreferredSettings()
        {
            SmallWorldPredefinedParameters swp = new SmallWorldPredefinedParameters();

            if (!GetValues(out swp))
            {
                return;
            }

            swp.PresetName = CustomSettings.PresetName;
            string prefs = swp.Serialize();

            Preferences.Set("DefaultSmallWorldOptions", prefs);

            OptionPresets[CustomSettings.PresetName] = swp;
            CustomSettings = swp;

            if (FindStandardPresetMatchingCustomSettings() == null)
            {
                PresetsComboBox.Text = "Custom";
            }
        }