コード例 #1
0
        private void CurrentSQLConnectionStore_EvntConfigChanged(object sender, BoolEventArgs args)
        {
            ISQLConnectionSettings oldSettings = currentSQLConnectionStore?.GetPrevious();
            ISQLConnectionSettings newSettings = currentSQLConnectionStore?.GetCurrent();

            if (!(string.IsNullOrWhiteSpace(newSettings?.Database)) && File.Exists(newSettings?.Database))
            {
                try { dBOperations.EvntInfoMessage -= AddLineAtTextBoxResultShow; } catch { }
                dBOperations = SQLSelector.SetConnector(newSettings);
                dBOperations.EvntInfoMessage += new SqlAbstractConnector.Message <TextEventArgs>(AddLineAtTextBoxResultShow);
            }

            if (oldSettings == null)
            {
                tableStore.Set(SQLSelector.GetTables(newSettings));
            }
            else
            {
                if (oldSettings.Name != newSettings.Name && oldSettings.Database != newSettings.Database)
                {
                    tableStore.Set(SQLSelector.GetTables(newSettings));
                }
            }

            if (!string.IsNullOrWhiteSpace(newSettings?.Database) && !string.IsNullOrWhiteSpace(newSettings?.Table))
            {
                SetAdminStatusLabelText($"Текущая база: {newSettings?.Database}, таблица: {newSettings?.Table}");
            }
        }
コード例 #2
0
        private void CurrentSQLConnectionStore_EvntConfigChanged(object sender, BoolEventArgs args)
        {
            ISQLConnectionSettings oldSettings = currentSQLConnectionStore?.GetPrevious();
            ISQLConnectionSettings newSettings = currentSQLConnectionStore?.GetCurrent();

            if (oldSettings != null)
            {
                if (oldSettings.Name == newSettings.Name)
                {
                    return;
                }
                if (oldSettings.Database == newSettings.Database)
                {
                    return;
                }
            }

            ModelCommonStringStore tables = SQLSelector.GetTables(currentSQLConnectionStore?.GetCurrent());

            tableStore.Set(tables);
        }
コード例 #3
0
        private async Task GetSample(string columnName)
        {
            ISQLConnectionSettings newSettings = currentSQLConnectionStore?.GetCurrent();
            ModelCommonStringStore models      = null;

            await Task.Run(() => models = SQLSelector.GetDataSample(newSettings, columnName));

            if (models?.ToList()?.Count > 0)
            {
                sampleStore.Set(models);
            }
            else
            {
                sampleStore.Reset();
                sampleStore.Add(new ModelCommon()
                {
                    Name = $"В таблице данные отсутствует в столбце '{columnName}'"
                });
            }
        }