Exemplo n.º 1
0
        public static DialogResult ShowWizard(Model model, ProviderDataSource source)
        {
            var dialog = new ImportTablesWizard();

            //dialog.page1.Init(model);

            dialog.btnBack.Visible = false;
            dialog.btnNext.Visible = false;
            dialog.btnCancel.Left  = 654;

            dialog.page2.RowLimitClause    = source.GetRowLimitClause();
            dialog.page2.IdentifierQuoting = source.GetIdentifierQuoting();

            var tds = TypedDataSource.GetFromTabularDs(source);

            if (!dialog.page2.Init(tds))
            {
                return(DialogResult.Cancel);
            }
            dialog.CurrentPage = 2;
            var res = dialog.ShowDialog();

            if (res == DialogResult.OK)
            {
                DoImport(dialog.page1.Mode, model, dialog.page2.Source, dialog.page2.SelectedSchemas, dialog.page2.RowLimitClause, dialog.page2.IdentifierQuoting);
            }

            return(res);
        }
Exemplo n.º 2
0
        public static DialogResult ShowWizard(Model model)
        {
            var dialog = new ImportTablesWizard();

            dialog.Model = model;
            dialog.page1.Init(model);
            dialog.CurrentPage = 1;
            var res = dialog.ShowDialog();

            if (res == DialogResult.OK)
            {
                DoImport(dialog.page1.Mode, model, dialog.page2.Source, dialog.page2.SelectedSchemas, dialog.page2.RowLimitClause);
            }

            return(res);
        }
Exemplo n.º 3
0
        public static DialogResult ShowWizard(Model model, ProviderDataSource source)
        {
            var dialog = new ImportTablesWizard();

            dialog.page1.Init(model);
            var tds = TypedDataSource.GetFromTabularDs(source);

            if (!(tds is SqlDataSource) && int.TryParse(source.GetAnnotation("TabularEditor_RowLimitClause"), out int rlc))
            {
                dialog.page2.RowLimitClause = (RowLimitClause)rlc;
            }
            dialog.page2.Init(tds);
            dialog.CurrentPage = 2;
            var res = dialog.ShowDialog();

            if (res == DialogResult.OK)
            {
                DoImport(dialog.page1.Mode, model, dialog.page2.Source, dialog.page2.SelectedSchemas, dialog.page2.RowLimitClause);
            }

            return(res);
        }
Exemplo n.º 4
0
        public static DialogResult ShowWizard(Table table)
        {
            if (!(table.Partitions[0].DataSource is ProviderDataSource))
            {
                MessageBox.Show("This feature currently only supports tables using Legacy Data Sources.", "Unsupported Data Source", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(DialogResult.Cancel);
            }

            var dialog = new ImportTablesWizard();

            dialog.Model                  = table.Model;
            dialog._currentPage           = 2;
            dialog.btnBack.Visible        = false;
            dialog.btnNext.Visible        = false;
            dialog.btnCancel.Left         = 654;
            dialog.page2.lblHeader.Text   = "Choose the table/view you want to use as a source for " + table.DaxObjectFullName + ":";
            dialog.btnImport.Text         = "OK";
            dialog.page2.SingleSelection  = true;
            dialog.page2.InitialSelection = table.GetTableSchema();

            dialog.page2.RowLimitClause    = table.GetRowLimitClause();
            dialog.page2.IdentifierQuoting = table.GetIdentifierQuoting();

            if (!dialog.page2.Init(TypedDataSource.GetFromTabularDs(table.Partitions[0].DataSource as ProviderDataSource)))
            {
                return(DialogResult.Cancel);
            }
            dialog.page2.Visible = true;

            // TODO:

            var res = dialog.ShowDialog();

            if (res == DialogResult.OK)
            {
                DoUpdate(table, dialog.page2.Source, dialog.page2.SelectedSchemas.First(), dialog.page2.RowLimitClause, dialog.page2.IdentifierQuoting);
            }
            return(res);
        }