Пример #1
0
    private void ScriptBtn_Click(object sender, EventArgs e)
    {
        var name = _manager.NewScript();

        _manager.SetItemData(name, new ScriptNotebookItemRecord {
            Name = name, Sql = _query,
        });
        _manager.OpenItem(new NotebookItem(NotebookItemType.Script, name));
    }
Пример #2
0
    public void Save()
    {
        var blockControls =
            _flow.Controls.Cast <BlockControl>()
            .Where(x => x is TextBlockControl || x is QueryBlockControl)
            .ToList();

        PageNotebookItemRecord pageRecord = new() { Name = ItemName, Blocks = new() };

        foreach (var control in blockControls)
        {
            PageBlockRecord blockRecord =
                control switch {
                TextBlockControl textBlock => textBlock.SaveToRecord(),
                QueryBlockControl queryBlock => queryBlock.SaveToRecord(),
                     _ => throw new NotImplementedException()
            };
            pageRecord.Blocks.Add(blockRecord);
        }

        _manager.SetItemData(ItemName, pageRecord);
    }
Пример #3
0
 public void Save()
 {
     _manager.SetItemData(ItemName, new ScriptNotebookItemRecord {
         Name = ItemName, Sql = _queryControl.SqlText
     });
 }