public ObjectDataSourceChooseMethodsPanel(ObjectDataSourceDesigner objectDataSourceDesigner) { this._objectDataSourceDesigner = objectDataSourceDesigner; this.InitializeComponent(); this.InitializeUI(); this._objectDataSource = (ObjectDataSource)this._objectDataSourceDesigner.Component; }
public ObjectDataSourceChooseMethodsPanel(ObjectDataSourceDesigner objectDataSourceDesigner) { this._objectDataSourceDesigner = objectDataSourceDesigner; this.InitializeComponent(); this.InitializeUI(); this._objectDataSource = (ObjectDataSource) this._objectDataSourceDesigner.Component; }
public void SetMethod(MethodInfo selectMethodInfo) { this._signatureTextBox.Text = ObjectDataSourceMethodEditor.GetMethodSignature(selectMethodInfo); Parameter[] parameters = ObjectDataSourceDesigner.MergeParameters(this._parameterEditorUserControl.GetParameters(), selectMethodInfo); this._parameterEditorUserControl.ClearParameters(); this._parameterEditorUserControl.AddParameters(parameters); }
public ObjectDataSourceConfigureParametersPanel(ObjectDataSourceDesigner objectDataSourceDesigner) { this._objectDataSourceDesigner = objectDataSourceDesigner; this._objectDataSource = (ObjectDataSource) this._objectDataSourceDesigner.Component; this.InitializeComponent(); this.InitializeUI(); this._parameterEditorUserControl.SetAllowCollectionChanges(false); }
public ObjectDataSourceConfigureParametersPanel(ObjectDataSourceDesigner objectDataSourceDesigner) { this._objectDataSourceDesigner = objectDataSourceDesigner; this._objectDataSource = (ObjectDataSource)this._objectDataSourceDesigner.Component; this.InitializeComponent(); this.InitializeUI(); this._parameterEditorUserControl.SetAllowCollectionChanges(false); }
public ObjectDataSourceWizardForm(IServiceProvider serviceProvider, ObjectDataSourceDesigner objectDataSourceDesigner) : base(serviceProvider) { base.Glyph = new Bitmap(typeof(SqlDataSourceWizardForm), "datasourcewizard.bmp"); this._objectDataSourceDesigner = objectDataSourceDesigner; this._objectDataSource = (ObjectDataSource) this._objectDataSourceDesigner.Component; this.Text = System.Design.SR.GetString("ConfigureDataSource_Title", new object[] { this._objectDataSource.ID }); ObjectDataSourceChooseTypePanel panel = new ObjectDataSourceChooseTypePanel(this._objectDataSourceDesigner); ObjectDataSourceChooseMethodsPanel panel2 = new ObjectDataSourceChooseMethodsPanel(this._objectDataSourceDesigner); base.SetPanels(new WizardPanel[] { panel, panel2 }); this._parametersPanel = new ObjectDataSourceConfigureParametersPanel(this._objectDataSourceDesigner); base.RegisterPanel(this._parametersPanel); base.Size += new Size(0, 40); this.MinimumSize = base.Size; }
public ObjectDataSourceWizardForm(IServiceProvider serviceProvider, ObjectDataSourceDesigner objectDataSourceDesigner) : base(serviceProvider) { base.Glyph = new Bitmap(typeof(SqlDataSourceWizardForm), "datasourcewizard.bmp"); this._objectDataSourceDesigner = objectDataSourceDesigner; this._objectDataSource = (ObjectDataSource)this._objectDataSourceDesigner.Component; this.Text = System.Design.SR.GetString("ConfigureDataSource_Title", new object[] { this._objectDataSource.ID }); ObjectDataSourceChooseTypePanel panel = new ObjectDataSourceChooseTypePanel(this._objectDataSourceDesigner); ObjectDataSourceChooseMethodsPanel panel2 = new ObjectDataSourceChooseMethodsPanel(this._objectDataSourceDesigner); base.SetPanels(new WizardPanel[] { panel, panel2 }); this._parametersPanel = new ObjectDataSourceConfigureParametersPanel(this._objectDataSourceDesigner); base.RegisterPanel(this._parametersPanel); base.Size += new Size(0, 40); this.MinimumSize = base.Size; }
public void SetType(System.Type type) { Cursor current = Cursor.Current; try { Cursor.Current = Cursors.WaitCursor; MethodInfo[] methods = GetMethods(type); this._methodsTabControl.SelectedIndex = 0; System.Type dataObjectType = ObjectDataSourceDesigner.GetType(base.ServiceProvider, this._objectDataSource.DataObjectTypeName, true); this._selectObjectDataSourceMethodEditor.SetMethodInformation(methods, this._objectDataSource.SelectMethod, this._objectDataSource.SelectParameters, DataObjectMethodType.Select, dataObjectType); this._insertObjectDataSourceMethodEditor.SetMethodInformation(methods, this._objectDataSource.InsertMethod, this._objectDataSource.InsertParameters, DataObjectMethodType.Insert, dataObjectType); this._updateObjectDataSourceMethodEditor.SetMethodInformation(methods, this._objectDataSource.UpdateMethod, this._objectDataSource.UpdateParameters, DataObjectMethodType.Update, dataObjectType); this._deleteObjectDataSourceMethodEditor.SetMethodInformation(methods, this._objectDataSource.DeleteMethod, this._objectDataSource.DeleteParameters, DataObjectMethodType.Delete, dataObjectType); } finally { Cursor.Current = current; } this.UpdateEnabledState(); }
public ObjectDataSourceChooseTypePanel(ObjectDataSourceDesigner objectDataSourceDesigner) { this._objectDataSourceDesigner = objectDataSourceDesigner; this._objectDataSource = (ObjectDataSource)this._objectDataSourceDesigner.Component; this.InitializeComponent(); this.InitializeUI(); ITypeDiscoveryService service = null; if (this._objectDataSource.Site != null) { service = (ITypeDiscoveryService)this._objectDataSource.Site.GetService(typeof(ITypeDiscoveryService)); } this._discoveryServiceMode = service != null; if (this._discoveryServiceMode) { this._typeNameTextBox.Visible = false; this._exampleLabel.Visible = false; Cursor current = Cursor.Current; try { Cursor.Current = Cursors.WaitCursor; ICollection is2 = DesignerUtils.FilterGenericTypes(service.GetTypes(typeof(object), true)); this._typeNameComboBox.BeginUpdate(); if (is2 != null) { StringCollection strings = new StringCollection(); strings.Add("My.MyApplication"); strings.Add("My.MyComputer"); strings.Add("My.MyProject"); strings.Add("My.MyUser"); this._typeItems = new List <TypeItem>(is2.Count); bool flag = false; foreach (System.Type type in is2) { if (!type.IsEnum && !type.IsInterface) { object[] customAttributes = type.GetCustomAttributes(typeof(DataObjectAttribute), true); if ((customAttributes.Length > 0) && ((DataObjectAttribute)customAttributes[0]).IsDataObject) { this._typeItems.Add(new TypeItem(type, true)); flag = true; } else if (!strings.Contains(type.FullName)) { this._typeItems.Add(new TypeItem(type, false)); } } } object showOnlyDataComponentsState = this._objectDataSourceDesigner.ShowOnlyDataComponentsState; if (showOnlyDataComponentsState == null) { this._filterCheckBox.Checked = flag; } else { this._filterCheckBox.Checked = (bool)showOnlyDataComponentsState; } this.UpdateTypeList(); } } finally { this._typeNameComboBox.EndUpdate(); Cursor.Current = current; } } else { this._typeNameComboBox.Visible = false; this._filterCheckBox.Visible = false; } this.TypeName = this._objectDataSource.TypeName; }
public ObjectDataSourceChooseTypePanel(ObjectDataSourceDesigner objectDataSourceDesigner) { this._objectDataSourceDesigner = objectDataSourceDesigner; this._objectDataSource = (ObjectDataSource) this._objectDataSourceDesigner.Component; this.InitializeComponent(); this.InitializeUI(); ITypeDiscoveryService service = null; if (this._objectDataSource.Site != null) { service = (ITypeDiscoveryService) this._objectDataSource.Site.GetService(typeof(ITypeDiscoveryService)); } this._discoveryServiceMode = service != null; if (this._discoveryServiceMode) { this._typeNameTextBox.Visible = false; this._exampleLabel.Visible = false; Cursor current = Cursor.Current; try { Cursor.Current = Cursors.WaitCursor; ICollection is2 = DesignerUtils.FilterGenericTypes(service.GetTypes(typeof(object), true)); this._typeNameComboBox.BeginUpdate(); if (is2 != null) { StringCollection strings = new StringCollection(); strings.Add("My.MyApplication"); strings.Add("My.MyComputer"); strings.Add("My.MyProject"); strings.Add("My.MyUser"); this._typeItems = new List<TypeItem>(is2.Count); bool flag = false; foreach (System.Type type in is2) { if (!type.IsEnum && !type.IsInterface) { object[] customAttributes = type.GetCustomAttributes(typeof(DataObjectAttribute), true); if ((customAttributes.Length > 0) && ((DataObjectAttribute) customAttributes[0]).IsDataObject) { this._typeItems.Add(new TypeItem(type, true)); flag = true; } else if (!strings.Contains(type.FullName)) { this._typeItems.Add(new TypeItem(type, false)); } } } object showOnlyDataComponentsState = this._objectDataSourceDesigner.ShowOnlyDataComponentsState; if (showOnlyDataComponentsState == null) { this._filterCheckBox.Checked = flag; } else { this._filterCheckBox.Checked = (bool) showOnlyDataComponentsState; } this.UpdateTypeList(); } } finally { this._typeNameComboBox.EndUpdate(); Cursor.Current = current; } } else { this._typeNameComboBox.Visible = false; this._filterCheckBox.Visible = false; } this.TypeName = this._objectDataSource.TypeName; }
public ObjectDesignerDataSourceView(ObjectDataSourceDesigner owner, string viewName) : base(owner, viewName) { this._owner = owner; }
public void SetMethodInformation(System.Reflection.MethodInfo[] methods, string selectedMethodName, ParameterCollection selectedParameters, DataObjectMethodType methodType, System.Type dataObjectType) { try { this._signatureTextBox.Text = string.Empty; switch (methodType) { case DataObjectMethodType.Select: this._helpLabel.Text = System.Design.SR.GetString("ObjectDataSourceMethodEditor_SelectHelpLabel"); break; case DataObjectMethodType.Update: this._helpLabel.Text = System.Design.SR.GetString("ObjectDataSourceMethodEditor_UpdateHelpLabel"); break; case DataObjectMethodType.Insert: this._helpLabel.Text = System.Design.SR.GetString("ObjectDataSourceMethodEditor_InsertHelpLabel"); break; case DataObjectMethodType.Delete: this._helpLabel.Text = System.Design.SR.GetString("ObjectDataSourceMethodEditor_DeleteHelpLabel"); break; } this._methodComboBox.BeginUpdate(); this._methodComboBox.Items.Clear(); MethodItem item = null; bool flag = false; foreach (System.Reflection.MethodInfo info in methods) { if (this.FilterMethod(info, methodType)) { bool flag2 = false; DataObjectMethodAttribute attribute = Attribute.GetCustomAttribute(info, typeof(DataObjectMethodAttribute), true) as DataObjectMethodAttribute; if ((attribute != null) && (attribute.MethodType == methodType)) { if (!flag) { this._methodComboBox.Items.Clear(); } flag = true; flag2 = true; } else if (!flag) { flag2 = true; } bool flag3 = ObjectDataSourceDesigner.IsMatchingMethod(info, selectedMethodName, selectedParameters, dataObjectType); if (flag2 || flag3) { MethodItem item2 = new MethodItem(info); this._methodComboBox.Items.Add(item2); if (flag3) { item = item2; } else if (((attribute != null) && (attribute.MethodType == methodType)) && (attribute.IsDefault && (selectedMethodName.Length == 0))) { item = item2; } } } } if (methodType != DataObjectMethodType.Select) { this._methodComboBox.Items.Insert(0, new MethodItem(null)); } this._methodComboBox.InvalidateDropDownWidth(); this._methodComboBox.SelectedItem = item; } finally { this._methodComboBox.EndUpdate(); } }
protected internal override void OnComplete() { PropertyDescriptor descriptor; MethodInfo deleteMethodInfo = this.DeleteMethodInfo; string str = (deleteMethodInfo == null) ? string.Empty : deleteMethodInfo.Name; if (this._objectDataSource.DeleteMethod != str) { descriptor = TypeDescriptor.GetProperties(this._objectDataSource)["DeleteMethod"]; descriptor.ResetValue(this._objectDataSource); descriptor.SetValue(this._objectDataSource, str); } deleteMethodInfo = this.InsertMethodInfo; str = (deleteMethodInfo == null) ? string.Empty : deleteMethodInfo.Name; if (this._objectDataSource.InsertMethod != str) { descriptor = TypeDescriptor.GetProperties(this._objectDataSource)["InsertMethod"]; descriptor.ResetValue(this._objectDataSource); descriptor.SetValue(this._objectDataSource, str); } deleteMethodInfo = this.SelectMethodInfo; str = (deleteMethodInfo == null) ? string.Empty : deleteMethodInfo.Name; if (this._objectDataSource.SelectMethod != str) { descriptor = TypeDescriptor.GetProperties(this._objectDataSource)["SelectMethod"]; descriptor.ResetValue(this._objectDataSource); descriptor.SetValue(this._objectDataSource, str); } deleteMethodInfo = this.UpdateMethodInfo; str = (deleteMethodInfo == null) ? string.Empty : deleteMethodInfo.Name; if (this._objectDataSource.UpdateMethod != str) { descriptor = TypeDescriptor.GetProperties(this._objectDataSource)["UpdateMethod"]; descriptor.ResetValue(this._objectDataSource); descriptor.SetValue(this._objectDataSource, str); } this._objectDataSource.SelectParameters.Clear(); deleteMethodInfo = this.SelectMethodInfo; try { IDataSourceSchema schema = new TypeSchema(deleteMethodInfo.ReturnType); if (schema != null) { IDataSourceViewSchema[] views = schema.GetViews(); if ((views != null) && (views.Length > 0)) { views[0].GetFields(); } } } catch (Exception) { } ObjectDataSourceDesigner.MergeParameters(this._objectDataSource.DeleteParameters, this.DeleteMethodInfo, this.DeleteMethodDataObjectType); ObjectDataSourceDesigner.MergeParameters(this._objectDataSource.InsertParameters, this.InsertMethodInfo, this.InsertMethodDataObjectType); ObjectDataSourceDesigner.MergeParameters(this._objectDataSource.UpdateParameters, this.UpdateMethodInfo, this.UpdateMethodDataObjectType); string fullName = string.Empty; if (this.DeleteMethodDataObjectType != null) { fullName = this.DeleteMethodDataObjectType.FullName; } else if (this.InsertMethodDataObjectType != null) { fullName = this.InsertMethodDataObjectType.FullName; } else if (this.UpdateMethodDataObjectType != null) { fullName = this.UpdateMethodDataObjectType.FullName; } if (this._objectDataSource.DataObjectTypeName != fullName) { descriptor = TypeDescriptor.GetProperties(this._objectDataSource)["DataObjectTypeName"]; descriptor.ResetValue(this._objectDataSource); descriptor.SetValue(this._objectDataSource, fullName); } if (deleteMethodInfo != null) { this._objectDataSourceDesigner.RefreshSchema(deleteMethodInfo.ReflectedType, deleteMethodInfo.Name, deleteMethodInfo.ReturnType, true); } }