Beispiel #1
0
        private void Initialize(TableDataFrame dataFrame)
        {
            m_dataFrame = dataFrame;
            int curhldindex = 0;
            int updindex    = -1;

            foreach (var holder in DataSqlGeneratorAddonType.Instance.CommonSpace.GetAllAddons())
            {
                var gen      = (IDataSqlGenerator)holder.CreateInstance();
                var tablegen = gen as TableDataSqlGeneratorBase;
                if (tablegen != null)
                {
                    if (dataFrame.TabularData.TableSource != null)
                    {
                        tablegen.FullTableName = dataFrame.TabularData.TableSource.FullName;
                    }
                    else
                    {
                        var ts = dataFrame.TabularData.GetStructure(null);
                        tablegen.FullTableName = ts.FullName;
                    }
                }
                if (gen is UpdateSqlGenerator)
                {
                    updindex = curhldindex;
                }
                lbxGenerator.Items.Add(gen);
                curhldindex++;
            }
            InitiDialects();

            addonSelectFrame1.Reload(false);

            foreach (var gen in dataFrame.GetSqlGens())
            {
                lbxGenerator.Items.Add(gen);
            }

            if (lbxGenerator.Items.Count > 0)
            {
                lbxGenerator.SelectedIndex       = updindex >= 0 ? updindex : 0;
                dataSqlGeneratorFrame1.Generator = (IDataSqlGenerator)lbxGenerator.SelectedItem;
            }
            //m_db = m_objs[0].FindDatabaseConnection(ConnPack);
            //Async.SafeOpen(m_db.Connection);

            lbxRows.Items.Add(new AllRowsExtractor(dataFrame));
            lbxRows.Items.Add(new FilteredRowsExtractor(dataFrame));
            lbxRows.Items.Add(new LoadedRowsExtractor(dataFrame));
            lbxRows.Items.Add(new SelectedRowsExtractor(dataFrame));
            lbxRows.SelectedIndex = 3;

            m_initialized = true;
            if (dataFrame.m_table != null)
            {
                dataSqlGeneratorFrame1.SetHintStructure(dataFrame.m_table.Structure, m_dataFrame.GetSelectedColumns());
            }
            btnSaveAsJob.Visible = false;
            RefreshPreview();
        }
Beispiel #2
0
        public static void Run(TableDataFrame dataFrame)
        {
            var win = new GenerateSqlForm();

            win.Initialize(dataFrame);
            win.ShowDialogEx();
        }
Beispiel #3
0
        public void OpenData()
        {
            string winid = TableKey + "#table_data";

            if (MainWindow.Instance.HasContent(winid))
            {
                var sett = TableSource.Database.Settings.Tree();
                if (sett.OpenTableDuplicateMode.ShouldReuse())
                {
                    MainWindow.Instance.ActivateContent(winid);
                    return;
                }
            }
            var tabdata = TableSource.GetTabularData();

            tabdata.CloneConnection();
            if (tabdata.TableSource != null)
            {
                tabdata.TableSource.Connection = tabdata.Connection;
            }
            if (tabdata.DatabaseSource != null)
            {
                tabdata.DatabaseSource.Connection = tabdata.Connection;
            }
            var content = new TableDataFrame(tabdata);

            content.WinId = winid;
            MainWindow.Instance.OpenContent(content);
        }
Beispiel #4
0
        public void OpenData()
        {
            var tabdata = GetTabularData();

            tabdata.CloneConnection();
            var content = new TableDataFrame(tabdata);

            MainWindow.Instance.OpenContent(content);
        }
Beispiel #5
0
 public GenerateDataSqlJobCommand(IDataSqlGenerator generator, IFilePlace place, ISqlDialect dialect, TableDataFrame dataFrame, DataFrameRowsExtractor rows, ConnectionPack connpack, SqlFormatProperties formatProps)
 {
     Generator   = generator;
     Place       = place;
     Dialect     = dialect;
     ConnPack    = connpack;
     m_rows      = rows;
     m_dataFrame = dataFrame;
     FormatProps = formatProps;
 }
Beispiel #6
0
 public void ReuseReleasedFrame(TableDataFrame frame)
 {
     foreach (var doc in dockPanel1.Contents)
     {
         var cw = doc as ContentWrapper;
         if (cw == null)
         {
             continue;
         }
         if (cw.Frame != null)
         {
             continue;
         }
         frame.m_parentFrame = this;
         cw.ReplaceContent(frame);
     }
 }
        public ReferencesTableDataFrame(TableDataFrame masterFrame, ReferenceViewDefinition refdef, BedRow masterRow)
        {
            InitializeComponent();
            //ParentFrame = parentFrame;
            //m_parentFrame = parentFrame;
            MasterFrame = masterFrame;
            m_baseView  = masterFrame.TabularData;
            m_refdef    = refdef;
            m_masterRow = masterRow;
            var src = m_baseView.DatabaseSource.GetTable(m_refdef.TableName);

            State = new TableRelatedState();
            DataStatePer.AdditionalCondition = m_refdef.GetCondition(m_masterRow);
            DataStatePer.TableData           = src.GetTabularData();

            //RefreshCurrentViewNoRedock();
            //MainWindow.Instance.RunInMainWindow(RefreshCurrentViewNoRedock);
            //btnReferences.Enabled = false;
            //TabularData = src.GetTabularDataAndReuse();
            //LoadDependendData();
        }
Beispiel #8
0
        public void OpenData()
        {
            string winid = TableKey + "#table_data#per#" + Path.GetFileNameWithoutExtension(FileName.ToLower());

            if (MainWindow.Instance.HasContent(winid))
            {
                var sett = TableSource.Database.Settings.Tree();
                if (sett.OpenTableDuplicateMode.ShouldReuse())
                {
                    MainWindow.Instance.ActivateContent(winid);
                    return;
                }
            }
            var tabdata = GetTabularData(ConnPack);

            tabdata.CloneConnection();
            var content = new TableDataFrame(tabdata);

            content.WinId = winid;
            MainWindow.Instance.OpenContent(content);
        }
 public DataFrameNoInputSqlGeneratorBase(TableDataFrame frame)
 {
     m_frame = frame;
 }
 public FilteredRowsExtractor(TableDataFrame frame)
     : base(frame)
 {
 }
 public LoadedRowsExtractor(TableDataFrame frame)
     : base(frame)
 {
 }
 public SelectedRowsExtractor(TableDataFrame frame)
     : base(frame)
 {
 }
 public DataFrameSaveChangesSqlGenerator(TableDataFrame frame)
     : base(frame)
 {
 }
 public DataFrameSelectSqlGenerator(TableDataFrame frame)
     : base(frame, TableDataScript.Select)
 {
 }
 public DataFrameRowsExtractor(TableDataFrame frame)
 {
     m_frame = frame;
 }
 public AllRowsExtractor(TableDataFrame frame)
     : base(frame)
 {
 }
Beispiel #17
0
 public static Job CreateDataJob(IDataSqlGenerator generator, IFilePlace place, ISqlDialect dialect, TableDataFrame dataFrame, DataFrameRowsExtractor rows, ConnectionPack connpack, SqlFormatProperties formatProps, JobProperties jobProps)
 {
     return(Job.FromCommand(new GenerateDataSqlJobCommand(generator, place, dialect, dataFrame, rows, connpack, formatProps), jobProps));
 }
 public DataFrameSqlScriptGenerator(TableDataFrame frame, TableDataScript script)
     : base(frame)
 {
     m_script = script;
 }
Beispiel #19
0
 public TableDataMainMenu(TableDataFrame frame)
 {
     m_frame = frame;
 }