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)); }
public void SetQueries(DesignerDataConnection dataConnection, SqlDataSourceQuery selectQuery, SqlDataSourceQuery insertQuery, SqlDataSourceQuery updateQuery, SqlDataSourceQuery deleteQuery) { DesignerDataConnection connection = dataConnection; if (!SqlDataSourceDesigner.ConnectionsEqual(this._dataConnection, connection)) { this._dataConnection = connection; Cursor current = Cursor.Current; ArrayList storedProcedures = null; try { Cursor.Current = Cursors.WaitCursor; IDataEnvironment service = (IDataEnvironment)this._sqlDataSourceDesigner.Component.Site.GetService(typeof(IDataEnvironment)); if (service != null) { IDesignerDataSchema connectionSchema = service.GetConnectionSchema(this._dataConnection); if ((connectionSchema != null) && connectionSchema.SupportsSchemaClass(DesignerDataSchemaClass.StoredProcedures)) { ICollection schemaItems = connectionSchema.GetSchemaItems(DesignerDataSchemaClass.StoredProcedures); if ((schemaItems != null) && (schemaItems.Count > 0)) { storedProcedures = new ArrayList(); foreach (DesignerDataStoredProcedure procedure in schemaItems) { if (!procedure.Name.ToLowerInvariant().StartsWith("AspNet_".ToLowerInvariant(), StringComparison.Ordinal)) { storedProcedures.Add(procedure); } } } } } } catch (Exception exception) { UIServiceHelper.ShowError(base.ServiceProvider, exception, System.Design.SR.GetString("SqlDataSourceConnectionPanel_CouldNotGetConnectionSchema")); } finally { Cursor.Current = current; } this._selectCommandEditor.SetConnection(this._dataConnection); this._selectCommandEditor.SetStoredProcedures(storedProcedures); this._insertCommandEditor.SetConnection(this._dataConnection); this._insertCommandEditor.SetStoredProcedures(storedProcedures); this._updateCommandEditor.SetConnection(this._dataConnection); this._updateCommandEditor.SetStoredProcedures(storedProcedures); this._deleteCommandEditor.SetConnection(this._dataConnection); this._deleteCommandEditor.SetStoredProcedures(storedProcedures); this._selectCommandEditor.SetQuery(selectQuery); this._insertCommandEditor.SetQuery(insertQuery); this._updateCommandEditor.SetQuery(updateQuery); this._deleteCommandEditor.SetQuery(deleteQuery); } }