internal static WizardPanel CreateCommandPanel(SqlDataSourceWizardForm wizard, DesignerDataConnection dataConnection, WizardPanel nextPanel) { IDataEnvironment service = null; IServiceProvider site = wizard.SqlDataSourceDesigner.Component.Site; if (site != null) { service = (IDataEnvironment)site.GetService(typeof(IDataEnvironment)); } bool flag = false; if (service != null) { try { IDesignerDataSchema connectionSchema = service.GetConnectionSchema(dataConnection); if (connectionSchema != null) { flag = connectionSchema.SupportsSchemaClass(DesignerDataSchemaClass.Tables); if (flag) { connectionSchema.GetSchemaItems(DesignerDataSchemaClass.Tables); } else { flag = connectionSchema.SupportsSchemaClass(DesignerDataSchemaClass.Views); connectionSchema.GetSchemaItems(DesignerDataSchemaClass.Views); } } } catch (Exception exception) { UIServiceHelper.ShowError(site, exception, System.Design.SR.GetString("SqlDataSourceConnectionPanel_CouldNotGetConnectionSchema")); return(null); } } if (nextPanel == null) { if (flag) { return(wizard.GetConfigureSelectPanel()); } return(CreateCustomCommandPanel(wizard, dataConnection)); } if (flag) { if (nextPanel is SqlDataSourceConfigureSelectPanel) { return(nextPanel); } return(wizard.GetConfigureSelectPanel()); } if (nextPanel is SqlDataSourceCustomCommandPanel) { return(nextPanel); } return(CreateCustomCommandPanel(wizard, dataConnection)); }
internal static WizardPanel CreateCommandPanel(SqlDataSourceWizardForm wizard, DesignerDataConnection dataConnection, WizardPanel nextPanel) { IDataEnvironment service = null; IServiceProvider site = wizard.SqlDataSourceDesigner.Component.Site; if (site != null) { service = (IDataEnvironment) site.GetService(typeof(IDataEnvironment)); } bool flag = false; if (service != null) { try { IDesignerDataSchema connectionSchema = service.GetConnectionSchema(dataConnection); if (connectionSchema != null) { flag = connectionSchema.SupportsSchemaClass(DesignerDataSchemaClass.Tables); if (flag) { connectionSchema.GetSchemaItems(DesignerDataSchemaClass.Tables); } else { flag = connectionSchema.SupportsSchemaClass(DesignerDataSchemaClass.Views); connectionSchema.GetSchemaItems(DesignerDataSchemaClass.Views); } } } catch (Exception exception) { UIServiceHelper.ShowError(site, exception, System.Design.SR.GetString("SqlDataSourceConnectionPanel_CouldNotGetConnectionSchema")); return null; } } if (nextPanel == null) { if (flag) { return wizard.GetConfigureSelectPanel(); } return CreateCustomCommandPanel(wizard, dataConnection); } if (flag) { if (nextPanel is SqlDataSourceConfigureSelectPanel) { return nextPanel; } return wizard.GetConfigureSelectPanel(); } if (nextPanel is SqlDataSourceCustomCommandPanel) { return nextPanel; } return CreateCustomCommandPanel(wizard, dataConnection); }
private bool ConfigureDataSourceChangeCallback(object context) { IServiceProvider site = base.Component.Site; IDataEnvironment service = (IDataEnvironment)site.GetService(typeof(IDataEnvironment)); if (service == null) { return(false); } IDataSourceViewSchema schema = this.GetView("DefaultView").Schema; bool flag = false; if (schema == null) { this._forceSchemaRetrieval = true; schema = this.GetView("DefaultView").Schema; this._forceSchemaRetrieval = false; if (schema != null) { flag = true; } } SqlDataSourceWizardForm form = this.CreateConfigureDataSourceWizardForm(site, service); if (UIServiceHelper.ShowDialog(site, form) != DialogResult.OK) { return(false); } this.OnComponentChanged(this, new ComponentChangedEventArgs(base.Component, null, null, null)); IDataSourceViewSchema schema2 = null; try { this._forceSchemaRetrieval = true; schema2 = this.GetView("DefaultView").Schema; } finally { this._forceSchemaRetrieval = false; } if (!flag && !DataSourceDesigner.ViewSchemasEquivalent(schema, schema2)) { this.OnSchemaRefreshed(EventArgs.Empty); } this.OnDataSourceChanged(EventArgs.Empty); return(true); }
private static WizardPanel CreateCustomCommandPanel(SqlDataSourceWizardForm wizard, DesignerDataConnection dataConnection) { SqlDataSource component = (SqlDataSource)wizard.SqlDataSourceDesigner.Component; ArrayList dest = new ArrayList(); ArrayList list2 = new ArrayList(); ArrayList list3 = new ArrayList(); ArrayList list4 = new ArrayList(); wizard.SqlDataSourceDesigner.CopyList(component.SelectParameters, dest); wizard.SqlDataSourceDesigner.CopyList(component.InsertParameters, list2); wizard.SqlDataSourceDesigner.CopyList(component.UpdateParameters, list3); wizard.SqlDataSourceDesigner.CopyList(component.DeleteParameters, list4); SqlDataSourceCustomCommandPanel customCommandPanel = wizard.GetCustomCommandPanel(); customCommandPanel.SetQueries(dataConnection, new SqlDataSourceQuery(component.SelectCommand, component.SelectCommandType, dest), new SqlDataSourceQuery(component.InsertCommand, component.InsertCommandType, list2), new SqlDataSourceQuery(component.UpdateCommand, component.UpdateCommandType, list3), new SqlDataSourceQuery(component.DeleteCommand, component.DeleteCommandType, list4)); return(customCommandPanel); }
private static WizardPanel CreateCustomCommandPanel(SqlDataSourceWizardForm wizard, DesignerDataConnection dataConnection) { SqlDataSource component = (SqlDataSource) wizard.SqlDataSourceDesigner.Component; ArrayList dest = new ArrayList(); ArrayList list2 = new ArrayList(); ArrayList list3 = new ArrayList(); ArrayList list4 = new ArrayList(); wizard.SqlDataSourceDesigner.CopyList(component.SelectParameters, dest); wizard.SqlDataSourceDesigner.CopyList(component.InsertParameters, list2); wizard.SqlDataSourceDesigner.CopyList(component.UpdateParameters, list3); wizard.SqlDataSourceDesigner.CopyList(component.DeleteParameters, list4); SqlDataSourceCustomCommandPanel customCommandPanel = wizard.GetCustomCommandPanel(); customCommandPanel.SetQueries(dataConnection, new SqlDataSourceQuery(component.SelectCommand, component.SelectCommandType, dest), new SqlDataSourceQuery(component.InsertCommand, component.InsertCommandType, list2), new SqlDataSourceQuery(component.UpdateCommand, component.UpdateCommandType, list3), new SqlDataSourceQuery(component.DeleteCommand, component.DeleteCommandType, list4)); return customCommandPanel; }