private bool SchemaRefreshedCallback(object context) { IDataSourceViewSchema dataSourceSchema = this.GetDataSourceSchema(); if ((base.DataSourceID.Length > 0) && (dataSourceSchema != null)) { if (((((FormView)base.Component).DataKeyNames.Length > 0) || (((FormView)base.Component).ItemTemplate != null)) || (((FormView)base.Component).EditItemTemplate != null)) { if (DialogResult.Yes == UIServiceHelper.ShowMessage(base.Component.Site, System.Design.SR.GetString("FormView_SchemaRefreshedWarning"), System.Design.SR.GetString("FormView_SchemaRefreshedCaption", new object[] { ((FormView)base.Component).ID }), MessageBoxButtons.YesNo)) { ((FormView)base.Component).DataKeyNames = new string[0]; this.AddTemplatesAndKeys(dataSourceSchema); } } else { this.AddTemplatesAndKeys(dataSourceSchema); } } else if ((((((FormView)base.Component).DataKeyNames.Length > 0) || (((FormView)base.Component).ItemTemplate != null)) || (((FormView)base.Component).EditItemTemplate != null)) && (DialogResult.Yes == UIServiceHelper.ShowMessage(base.Component.Site, System.Design.SR.GetString("FormView_SchemaRefreshedWarningNoDataSource"), System.Design.SR.GetString("FormView_SchemaRefreshedCaption", new object[] { ((FormView)base.Component).ID }), MessageBoxButtons.YesNo))) { ((FormView)base.Component).DataKeyNames = new string[0]; ((FormView)base.Component).ItemTemplate = null; ((FormView)base.Component).InsertItemTemplate = null; ((FormView)base.Component).EditItemTemplate = null; } this.UpdateDesignTimeHtml(); return(true); }
private IDataSourceFieldSchema[] GetFieldSchemas() { if (this._fieldSchemas == null) { IDataSourceViewSchema schema = null; DesignerDataSourceView designerView = this._controlDesigner.DesignerView; if (designerView != null) { try { schema = designerView.Schema; } catch (Exception exception) { IComponentDesignerDebugService service = (IComponentDesignerDebugService)base.ServiceProvider.GetService(typeof(IComponentDesignerDebugService)); if (service != null) { service.Fail(System.Design.SR.GetString("DataSource_DebugService_FailedCall", new object[] { "DesignerDataSourceView.Schema", exception.Message })); } } } if (schema != null) { this._fieldSchemas = schema.GetFields(); } } return(this._fieldSchemas); }
private void OnPropertyGridPropertyValueChanged(object s, PropertyValueChangedEventArgs e) { this._applyButton.Enabled = true; if (e.ChangedItem.PropertyDescriptor.Name == "DataMember") { string viewName = (string)e.ChangedItem.Value; TreeNodeBinding binding = (TreeNodeBinding)this._bindingsListView.Items[this._bindingsListView.SelectedIndex]; this._bindingsListView.Items[this._bindingsListView.SelectedIndex] = binding; this._bindingsListView.Refresh(); IDataSourceViewSchema schema = this.FindViewSchema(viewName, binding.Depth); if (schema != null) { ((IDataSourceViewSchemaAccessor)binding).DataSourceViewSchema = schema; } this._propertyGrid.SelectedObject = binding; this._propertyGrid.Refresh(); } else if (e.ChangedItem.PropertyDescriptor.Name == "Depth") { int level = (int)e.ChangedItem.Value; TreeNodeBinding binding2 = (TreeNodeBinding)this._bindingsListView.Items[this._bindingsListView.SelectedIndex]; IDataSourceViewSchema schema2 = this.FindViewSchema(binding2.DataMember, level); if (schema2 != null) { ((IDataSourceViewSchemaAccessor)binding2).DataSourceViewSchema = schema2; } this._propertyGrid.SelectedObject = binding2; this._propertyGrid.Refresh(); } }
private bool RefreshSchemaCallback(object context) { DataList component = (DataList)base.Component; bool flag = (((component.ItemTemplate == null) && (component.EditItemTemplate == null)) && (component.AlternatingItemTemplate == null)) && (component.SelectedItemTemplate == null); IDataSourceViewSchema dataSourceSchema = this.GetDataSourceSchema(); if ((base.DataSourceID.Length > 0) && (dataSourceSchema != null)) { if (flag || (!flag && (DialogResult.Yes == UIServiceHelper.ShowMessage(base.Component.Site, System.Design.SR.GetString("DataList_RegenerateTemplates"), System.Design.SR.GetString("DataList_ClearTemplatesCaption"), MessageBoxButtons.YesNo)))) { component.ItemTemplate = null; component.EditItemTemplate = null; component.AlternatingItemTemplate = null; component.SelectedItemTemplate = null; component.DataKeyField = string.Empty; this.CreateDefaultTemplate(); this.UpdateDesignTimeHtml(); } } else if (flag || (!flag && (DialogResult.Yes == UIServiceHelper.ShowMessage(base.Component.Site, System.Design.SR.GetString("DataList_ClearTemplates"), System.Design.SR.GetString("DataList_ClearTemplatesCaption"), MessageBoxButtons.YesNo)))) { component.ItemTemplate = null; component.EditItemTemplate = null; component.AlternatingItemTemplate = null; component.SelectedItemTemplate = null; component.DataKeyField = string.Empty; this.UpdateDesignTimeHtml(); } return(true); }
/// <summary> /// Returns a single element array containing the /// schema for the CSLA .NET business object. /// </summary> public IDataSourceViewSchema[] GetViews() { IDataSourceViewSchema[] result; result = new IDataSourceViewSchema[] { new ObjectViewSchema(_typeAssemblyName, _typeName) }; return(result); }
public virtual TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context, Type typeFilter) { string[] destinationArray = null; if (context != null) { IDataSourceViewSchemaAccessor instance = context.Instance as IDataSourceViewSchemaAccessor; if (instance != null) { IDataSourceViewSchema dataSourceViewSchema = instance.DataSourceViewSchema as IDataSourceViewSchema; if (dataSourceViewSchema != null) { IDataSourceFieldSchema[] fields = dataSourceViewSchema.GetFields(); string[] sourceArray = new string[fields.Length]; int index = 0; for (int i = 0; i < fields.Length; i++) { if (((typeFilter != null) && (fields[i].DataType == typeFilter)) || (typeFilter == null)) { sourceArray[index] = fields[i].Name; index++; } } destinationArray = new string[index]; Array.Copy(sourceArray, destinationArray, index); } } if (destinationArray == null) { destinationArray = new string[0]; } Array.Sort(destinationArray, Comparer.Default); } return(new TypeConverter.StandardValuesCollection(destinationArray)); }
/// <summary> /// Returns a set of sample data used to populate /// controls at design time. /// </summary> /// <param name="minimumRows">Minimum number of sample rows /// to create.</param> /// <param name="isSampleData">Returns True if the data /// is sample data.</param> public override IEnumerable GetDesignTimeData(int minimumRows, out bool isSampleData) { IDataSourceViewSchema schema = this.Schema; DataTable result = new DataTable(); // create the columns foreach (IDataSourceFieldSchema item in schema.GetFields()) { result.Columns.Add(item.Name, item.DataType); } // create sample data for (int index = 1; index <= minimumRows; index++) { object[] values = new object[result.Columns.Count]; int colIndex = 0; foreach (DataColumn col in result.Columns) { if (col.DataType.Equals(typeof(string))) { values[colIndex] = "abc"; } else if (col.DataType.Equals(typeof(System.DateTime))) { values[colIndex] = System.DateTime.Today.ToShortDateString(); } else if (col.DataType.Equals(typeof(System.DateTimeOffset))) { values[colIndex] = System.DateTime.Today.ToShortDateString(); } else if (col.DataType.Equals(typeof(bool))) { values[colIndex] = false; } else if (col.DataType.IsPrimitive) { values[colIndex] = index; } else if (col.DataType.Equals(typeof(Guid))) { values[colIndex] = Guid.Empty; } else if (col.DataType.IsValueType) { values[colIndex] = Activator.CreateInstance(col.DataType); } else { values[colIndex] = null; } colIndex += 1; } result.LoadDataRow(values, LoadOption.OverwriteChanges); } isSampleData = true; return((IEnumerable)result.DefaultView); }
private bool SchemaRefreshedCallback(object context) { IDataSourceViewSchema dataSourceSchema = this.GetDataSourceSchema(); if (base.DataSourceID.Length > 0 && dataSourceSchema != null) { this.AddKeysAndBoundFields(dataSourceSchema); } return(true); }
private void CreateDefaultTemplate() { string text = string.Empty; StringBuilder builder = new StringBuilder(); DataList component = (DataList)base.Component; IDataSourceViewSchema dataSourceSchema = this.GetDataSourceSchema(); IDataSourceFieldSchema[] fields = null; if (dataSourceSchema != null) { fields = dataSourceSchema.GetFields(); } if ((fields != null) && (fields.Length > 0)) { foreach (IDataSourceFieldSchema schema2 in fields) { string name = schema2.Name; char[] chArray = new char[name.Length]; for (int i = 0; i < name.Length; i++) { char c = name[i]; if (char.IsLetterOrDigit(c) || (c == '_')) { chArray[i] = c; } else { chArray[i] = '_'; } } string str3 = new string(chArray); builder.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:Label Text='<%# {1} %>' runat=\"server\" id=\"{2}Label\"/><br />", new object[] { name, DesignTimeDataBinding.CreateEvalExpression(name, string.Empty), str3 })); builder.Append(Environment.NewLine); if (schema2.PrimaryKey && (component.DataKeyField.Length == 0)) { component.DataKeyField = name; } } builder.Append("<br />"); builder.Append(Environment.NewLine); text = builder.ToString(); } if ((text != null) && (text.Length > 0)) { try { component.ItemTemplate = base.GetTemplateFromText(text, component.ItemTemplate); } catch { } } }
private static DataTable[] ConvertSchemaToDataTables(TypeSchema schema) { if (schema == null) { return(null); } IDataSourceViewSchema[] views = schema.GetViews(); if (views == null) { return(null); } DataTable[] tableArray = new DataTable[views.Length]; for (int i = 0; i < views.Length; i++) { IDataSourceViewSchema schema2 = views[i]; tableArray[i] = new DataTable(schema2.Name); IDataSourceFieldSchema[] fields = schema2.GetFields(); if (fields != null) { List <DataColumn> list = new List <DataColumn>(); for (int j = 0; j < fields.Length; j++) { IDataSourceFieldSchema schema3 = fields[j]; DataColumn column = new DataColumn { AllowDBNull = schema3.Nullable, AutoIncrement = schema3.Identity, ColumnName = schema3.Name, DataType = schema3.DataType }; if (column.DataType == typeof(string)) { column.MaxLength = schema3.Length; } column.ReadOnly = schema3.IsReadOnly; column.Unique = schema3.IsUnique; tableArray[i].Columns.Add(column); if (schema3.PrimaryKey) { list.Add(column); } } if (list.Count > 0) { tableArray[i].PrimaryKey = list.ToArray(); } } } return(tableArray); }
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 void AddKeysAndBoundFields(IDataSourceViewSchema schema) { DataControlFieldCollection columns = ((GridView) base.Component).Columns; if (schema != null) { IDataSourceFieldSchema[] fields = schema.GetFields(); if ((fields != null) && (fields.Length > 0)) { ArrayList list = new ArrayList(); foreach (IDataSourceFieldSchema schema2 in fields) { if (((GridView) base.Component).IsBindableType(schema2.DataType)) { BoundField field; if ((schema2.DataType == typeof(bool)) || (schema2.DataType == typeof(bool?))) { field = new CheckBoxField(); } else { field = new BoundField(); } string name = schema2.Name; if (schema2.PrimaryKey) { list.Add(name); } field.DataField = name; field.HeaderText = name; field.SortExpression = name; field.ReadOnly = schema2.PrimaryKey || schema2.IsReadOnly; field.InsertVisible = !schema2.Identity; columns.Add(field); } } ((GridView) base.Component).AutoGenerateColumns = false; int count = list.Count; if (count > 0) { string[] array = new string[count]; list.CopyTo(array, 0); ((GridView) base.Component).DataKeyNames = array; } } } }
/// <summary> /// Indicates whether to allow events when refreshing the schema. /// </summary> /// <param name="preferSilent"><see langword=" true"/> to allow events when refreshing the schema; /// <see langword=" false"/> to disable the DataSourceChanged and SchemaRefreshed events when refreshing the schema.</param> public override void RefreshSchema(bool preferSilent) { try { base.SuppressDataSourceEvents(); Cursor cursor = Cursor.Current; try { Cursor.Current = Cursors.WaitCursor; Type type = GetType(base.Component.Site, DataObjectTypeName, preferSilent); if (type == null) { return; } IDataSourceViewSchema[] schemas = new TypeSchema(type).GetViews(); if ((schemas == null) || (schemas.Length == 0)) { DataSourceSchema = null; return; } IDataSourceViewSchema newSchema = schemas[0]; IDataSourceViewSchema oldSchema = DataSourceSchema; if (!ViewSchemasEquivalent(oldSchema, newSchema)) { DataSourceSchema = newSchema; OnSchemaRefreshed(EventArgs.Empty); } } catch (Exception ex) { DisplayErrorMessage(this.DataSourceControl.Site, String.Format(CultureInfo.CurrentCulture, Resources.CannotRefreshSchema, ex.Message)); } finally { Cursor.Current = cursor; } } finally { base.ResumeDataSourceEvents(); } }
public static bool ViewSchemasEquivalent(IDataSourceViewSchema viewSchema1, IDataSourceViewSchema viewSchema2) { if ((viewSchema1 == null) ^ (viewSchema2 == null)) { return(false); } if ((viewSchema1 != null) || (viewSchema2 != null)) { IDataSourceFieldSchema[] fields = viewSchema1.GetFields(); IDataSourceFieldSchema[] schemaArray2 = viewSchema2.GetFields(); if ((fields == null) ^ (schemaArray2 == null)) { return(false); } if ((fields == null) && (schemaArray2 == null)) { return(true); } int length = fields.Length; int num2 = schemaArray2.Length; if (length != num2) { return(false); } foreach (IDataSourceFieldSchema schema in fields) { bool flag = false; string name = schema.Name; Type dataType = schema.DataType; foreach (IDataSourceFieldSchema schema2 in schemaArray2) { if ((name == schema2.Name) && (dataType == schema2.DataType)) { flag = true; break; } } if (!flag) { return(false); } } } return(true); }
private void AddKeysAndBoundFields(IDataSourceViewSchema schema) { JQGridColumnCollection columns = ((JQGrid)base.Component).Columns; try { columns.Clear(); } catch (Exception) { } if (schema != null) { IDataSourceFieldSchema[] fields = schema.GetFields(); if (fields != null && fields.Length > 0) { new ArrayList(); IDataSourceFieldSchema[] array = fields; for (int i = 0; i < array.Length; i++) { IDataSourceFieldSchema dataSourceFieldSchema = array[i]; if (((JQGrid)base.Component).IsBindableType(dataSourceFieldSchema.DataType)) { JQGridColumn jQGridColumn; if (dataSourceFieldSchema.DataType == typeof(bool) || dataSourceFieldSchema.DataType == typeof(bool?)) { jQGridColumn = new JQGridColumn(); } else { jQGridColumn = new JQGridColumn(); } string name = dataSourceFieldSchema.Name; jQGridColumn.DataField = name; jQGridColumn.PrimaryKey = dataSourceFieldSchema.PrimaryKey; columns.Add(jQGridColumn); } } } } }
public override string GetDesignTimeHtml() { FormView viewControl = (FormView)base.ViewControl; bool flag = false; string[] dataKeyNames = null; if (this.CurrentModeTemplateExists) { bool flag2 = false; IDataSourceViewSchema dataSourceSchema = this.GetDataSourceSchema(); if (dataSourceSchema != null) { IDataSourceFieldSchema[] fields = dataSourceSchema.GetFields(); if ((fields != null) && (fields.Length > 0)) { flag2 = true; } } try { if (!flag2) { dataKeyNames = viewControl.DataKeyNames; viewControl.DataKeyNames = new string[0]; flag = true; } TypeDescriptor.Refresh(base.Component); return(base.GetDesignTimeHtml()); } finally { if (flag) { viewControl.DataKeyNames = dataKeyNames; } } } return(this.GetEmptyDesignTimeHtml()); }
internal static IDataSourceViewSchema FindViewSchemaRecursive(object schema, int depth, string viewName, int level, IDataSourceViewSchema bestBet) { if (!(schema is IDataSourceSchema) && !(schema is IDataSourceViewSchema)) { return(null); } IDataSourceViewSchema schema2 = schema as IDataSourceViewSchema; IDataSourceViewSchema[] schemaArray = (schema2 != null) ? schema2.GetChildren() : ((IDataSourceSchema)schema).GetViews(); if (schemaArray != null) { if (depth == level) { foreach (IDataSourceViewSchema schema3 in schemaArray) { if (string.Equals(schema3.Name, viewName, StringComparison.OrdinalIgnoreCase)) { return(schema3); } if (string.IsNullOrEmpty(schema3.Name) && (bestBet == null)) { bestBet = schema3; } bestBet = FindViewSchemaRecursive(schema3, depth + 1, viewName, level, bestBet); } return(bestBet); } foreach (IDataSourceViewSchema schema4 in schemaArray) { if (((level == -1) && string.Equals(schema4.Name, viewName, StringComparison.OrdinalIgnoreCase)) && (bestBet == null)) { return(schema4); } bestBet = FindViewSchemaRecursive(schema4, depth + 1, viewName, level, bestBet); } } return(bestBet); }
public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { object[] objArray1 = null; if (context != null) { IComponent component1 = context.Instance as IComponent; if (component1 != null) { ISite site1 = component1.Site; if (site1 != null) { IDesignerHost host1 = (IDesignerHost)site1.GetService(typeof(IDesignerHost)); if (host1 != null) { IDesigner designer1 = host1.GetDesigner(component1); DesignerDataSourceView view1 = this.GetView(designer1); if (view1 != null) { IDataSourceViewSchema schema1 = null; try { schema1 = view1.Schema; } catch (Exception exception1) { IComponentDesignerDebugService service1 = (IComponentDesignerDebugService)site1.GetService(typeof(IComponentDesignerDebugService)); if (service1 != null) { service1.Fail("DataSource DebugService FailedCall\r\n" + exception1.ToString()); } } if (schema1 != null) { IDataSourceFieldSchema[] schemaArray1 = schema1.GetFields(); if (schemaArray1 != null) { objArray1 = new object[schemaArray1.Length]; for (int num1 = 0; num1 < schemaArray1.Length; num1++) { objArray1[num1] = schemaArray1[num1].Name; } } } } if (((objArray1 == null) && (designer1 != null)) && (designer1 is IDataSourceProvider)) { IDataSourceProvider provider1 = designer1 as IDataSourceProvider; IEnumerable enumerable1 = null; if (provider1 != null) { enumerable1 = provider1.GetResolvedSelectedDataSource(); } if (enumerable1 != null) { PropertyDescriptorCollection collection1 = DesignTimeData.GetDataFields(enumerable1); if (collection1 != null) { ArrayList list1 = new ArrayList(); foreach (PropertyDescriptor descriptor1 in collection1) { list1.Add(descriptor1.Name); } objArray1 = list1.ToArray(); } } } } } } } return(new TypeConverter.StandardValuesCollection(objArray1)); }
public override void RefreshSchema(bool preferSilent) { try { this.SuppressDataSourceEvents(); bool flag = false; IServiceProvider site = this.SqlDataSource.Site; if (!this.CanRefreshSchema) { if (!preferSilent) { UIServiceHelper.ShowError(site, System.Design.SR.GetString("SqlDataSourceDesigner_RefreshSchemaRequiresSettings")); } } else { IDataSourceViewSchema schema = this.GetView("DefaultView").Schema; bool flag2 = false; if (schema == null) { this._forceSchemaRetrieval = true; schema = this.GetView("DefaultView").Schema; this._forceSchemaRetrieval = false; flag2 = true; } DesignerDataConnection connection = new DesignerDataConnection(string.Empty, this.ProviderName, this.ConnectionString); if (preferSilent) { flag = this.RefreshSchema(connection, this.SelectCommand, this.SqlDataSource.SelectCommandType, this.SqlDataSource.SelectParameters, true); } else { Parameter[] parameterArray = this.InferParameterNames(connection, this.SelectCommand, this.SqlDataSource.SelectCommandType); if (parameterArray == null) { return; } ParameterCollection parameters = new ParameterCollection(); ParameterCollection parameters2 = new ParameterCollection(); foreach (ICloneable cloneable in this.SqlDataSource.SelectParameters) { parameters2.Add((Parameter)cloneable.Clone()); } foreach (Parameter parameter in parameterArray) { if ((parameter.Direction == ParameterDirection.Input) || (parameter.Direction == ParameterDirection.InputOutput)) { Parameter parameter2 = parameters2[parameter.Name]; if (parameter2 != null) { parameter.DefaultValue = parameter2.DefaultValue; if ((parameter.DbType == DbType.Object) && (parameter.Type == TypeCode.Empty)) { parameter.DbType = parameter2.DbType; parameter.Type = parameter2.Type; } parameters2.Remove(parameter2); } parameters.Add(parameter); } } if (parameters.Count > 0) { SqlDataSourceRefreshSchemaForm form = new SqlDataSourceRefreshSchemaForm(site, this, parameters); flag = UIServiceHelper.ShowDialog(site, form) == DialogResult.OK; } else { flag = this.RefreshSchema(connection, this.SelectCommand, this.SqlDataSource.SelectCommandType, parameters, false); } } if (flag) { IDataSourceViewSchema schema2 = this.GetView("DefaultView").Schema; if (flag2 && DataSourceDesigner.ViewSchemasEquivalent(schema, schema2)) { this.OnDataSourceChanged(EventArgs.Empty); } else if (!DataSourceDesigner.ViewSchemasEquivalent(schema, schema2)) { this.OnSchemaRefreshed(EventArgs.Empty); } } } } finally { this.ResumeDataSourceEvents(); } }
private string[] GetControlDataFieldNames() { if (this._dataFields == null) { ITypeDescriptorContext context = this.editor.Context; IDataSourceFieldSchema[] fields = null; IDataSourceViewSchema dataSourceViewSchema = null; if ((context != null) && (context.Instance != null)) { System.Web.UI.Control instance = context.Instance as System.Web.UI.Control; if (instance != null) { ISite site = instance.Site; if (site != null) { IDesignerHost host = (IDesignerHost)site.GetService(typeof(IDesignerHost)); if (host != null) { DataBoundControlDesigner designer = host.GetDesigner(instance) as DataBoundControlDesigner; if (designer != null) { DesignerDataSourceView designerView = designer.DesignerView; if (designerView != null) { try { dataSourceViewSchema = designerView.Schema; } catch (Exception exception) { IComponentDesignerDebugService service = (IComponentDesignerDebugService)site.GetService(typeof(IComponentDesignerDebugService)); if (service != null) { service.Fail(System.Design.SR.GetString("DataSource_DebugService_FailedCall", new object[] { "DesignerDataSourceView.Schema", exception.Message })); } } } } } } } else { IDataSourceViewSchemaAccessor accessor = context.Instance as IDataSourceViewSchemaAccessor; if (accessor != null) { dataSourceViewSchema = accessor.DataSourceViewSchema as IDataSourceViewSchema; } } } if (dataSourceViewSchema != null) { fields = dataSourceViewSchema.GetFields(); if (fields != null) { int length = fields.Length; this._dataFields = new string[length]; for (int i = 0; i < length; i++) { this._dataFields[i] = fields[i].Name; } } } } return(this._dataFields); }
/// <summary> /// Returns a single element array containing the /// schema for the YYT .NET business object. /// </summary> public System.Web.UI.Design.IDataSourceViewSchema[] GetViews() { IDataSourceViewSchema[] result = null; result = new IDataSourceViewSchema[] { new ObjectViewSchema(_designer, _typeName) }; return(result); }
public StringCollection GetStandardValues(Component component) { StringCollection fields = new StringCollection(); if (component != null) { ISite site1 = component.Site; if (site1 != null) { IDesignerHost host1 = (IDesignerHost)site1.GetService(typeof(IDesignerHost)); if (host1 != null) { IDesigner designer1 = host1.GetDesigner(component); DesignerDataSourceView view1 = ((DataBoundControlDesigner)designer1).DesignerView; if (view1 != null) { IDataSourceViewSchema schema1 = null; try { schema1 = view1.Schema; } catch (Exception exception1) { IComponentDesignerDebugService service1 = (IComponentDesignerDebugService)site1.GetService(typeof(IComponentDesignerDebugService)); if (service1 != null) { service1.Fail("DataSource DebugService FailedCall\r\n" + exception1.ToString()); } } if (schema1 != null) { IDataSourceFieldSchema[] schemaArray1 = schema1.GetFields(); if (schemaArray1 != null) { for (int num1 = 0; num1 < schemaArray1.Length; num1++) { fields.Add(schemaArray1[num1].Name); } } } } if (((fields.Count == 0) && (designer1 != null)) && (designer1 is IDataSourceProvider)) { IDataSourceProvider provider1 = designer1 as IDataSourceProvider; IEnumerable enumerable1 = null; if (provider1 != null) { enumerable1 = provider1.GetResolvedSelectedDataSource(); } if (enumerable1 != null) { PropertyDescriptorCollection collection1 = DesignTimeData.GetDataFields(enumerable1); if (collection1 != null) { foreach (PropertyDescriptor descriptor1 in collection1) { fields.Add(descriptor1.Name); } } } } } } } return(fields); }
private void AddTemplatesAndKeys(IDataSourceViewSchema schema) { StringBuilder builder = new StringBuilder(); StringBuilder builder2 = new StringBuilder(); StringBuilder builder3 = new StringBuilder(); IDesignerHost service = (IDesignerHost)base.Component.Site.GetService(typeof(IDesignerHost)); if (schema != null) { IDataSourceFieldSchema[] fields = schema.GetFields(); if ((fields != null) && (fields.Length > 0)) { ArrayList list = new ArrayList(); foreach (IDataSourceFieldSchema schema2 in fields) { string name = schema2.Name; char[] chArray = new char[name.Length]; for (int i = 0; i < name.Length; i++) { char c = name[i]; if (char.IsLetterOrDigit(c) || (c == '_')) { chArray[i] = c; } else { chArray[i] = '_'; } } string str2 = new string(chArray); string str3 = DesignTimeDataBinding.CreateEvalExpression(name, string.Empty); string str4 = DesignTimeDataBinding.CreateBindExpression(name, string.Empty); if (schema2.PrimaryKey || schema2.Identity) { if (this.EnableDynamicData) { builder.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:DynamicControl DataField=\"{0}\" runat=\"server\" id=\"{2}DynamicControl\" Mode=\"{1}\" /><br />", new object[] { name, "ReadOnly", str2 })); builder2.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:DynamicControl DataField=\"{0}\" runat=\"server\" id=\"{2}DynamicControl\" Mode=\"{1}\" /><br />", new object[] { name, "ReadOnly", str2 })); } else { builder.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:Label Text='<%# {1} %>' runat=\"server\" id=\"{2}Label1\" /><br />", new object[] { name, str3, str2 })); builder2.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:Label Text='<%# {1} %>' runat=\"server\" id=\"{2}Label\" /><br />", new object[] { name, str3, str2 })); } if (!schema2.Identity) { if (this.EnableDynamicData) { builder3.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:DynamicControl DataField=\"{0}\" runat=\"server\" id=\"{1}DynamicControl\" Mode=\"Insert\" ValidationGroup=\"Insert\" /><br />", new object[] { name, str2 })); } else { builder3.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:TextBox Text='<%# {1} %>' runat=\"server\" id=\"{2}TextBox\" /><br />", new object[] { name, str4, str2 })); } } } else if (this.EnableDynamicData) { builder.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:DynamicControl DataField=\"{0}\" runat=\"server\" id=\"{2}DynamicControl\" Mode=\"{1}\" /><br />", new object[] { name, "Edit", str2 })); builder2.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:DynamicControl DataField=\"{0}\" runat=\"server\" id=\"{2}DynamicControl\" Mode=\"{1}\" /><br />", new object[] { name, "ReadOnly", str2 })); builder3.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:DynamicControl DataField=\"{0}\" runat=\"server\" id=\"{1}DynamicControl\" Mode=\"Insert\" ValidationGroup=\"Insert\" /><br />", new object[] { name, str2 })); } else if ((schema2.DataType == typeof(bool)) || (schema2.DataType == typeof(bool?))) { builder.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:CheckBox Checked='<%# {1} %>' runat=\"server\" id=\"{2}CheckBox\" /><br />", new object[] { name, str4, str2 })); builder2.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:CheckBox Checked='<%# {1} %>' runat=\"server\" id=\"{2}CheckBox\" Enabled=\"false\" /><br />", new object[] { name, str4, str2 })); builder3.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:CheckBox Checked='<%# {1} %>' runat=\"server\" id=\"{2}CheckBox\" /><br />", new object[] { name, str4, str2 })); } else { builder.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:TextBox Text='<%# {1} %>' runat=\"server\" id=\"{2}TextBox\" /><br />", new object[] { name, str4, str2 })); builder2.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:Label Text='<%# {1} %>' runat=\"server\" id=\"{2}Label\" /><br />", new object[] { name, str4, str2 })); builder3.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:TextBox Text='<%# {1} %>' runat=\"server\" id=\"{2}TextBox\" /><br />", new object[] { name, str4, str2 })); } builder.Append(Environment.NewLine); builder2.Append(Environment.NewLine); builder3.Append(Environment.NewLine); if (schema2.PrimaryKey) { list.Add(name); } } bool flag = true; if (base.DesignerView.CanUpdate) { builder2.Append(string.Format(CultureInfo.InvariantCulture, "<asp:LinkButton runat=\"server\" Text=\"{3}\" CommandName=\"{0}\" id=\"{1}{0}Button\" CausesValidation=\"{2}\" />", new object[] { "Edit", string.Empty, bool.FalseString, System.Design.SR.GetString("FormView_Edit") })); flag = false; } if (this.EnableDynamicData) { builder.Append(string.Format(CultureInfo.InvariantCulture, "<asp:LinkButton runat=\"server\" Text=\"{3}\" CommandName=\"{0}\" id=\"{1}{0}Button\" CausesValidation=\"{2}\" ValidationGroup=\"Insert\" />", new object[] { "Update", string.Empty, bool.TrueString, System.Design.SR.GetString("FormView_Update") })); } else { builder.Append(string.Format(CultureInfo.InvariantCulture, "<asp:LinkButton runat=\"server\" Text=\"{3}\" CommandName=\"{0}\" id=\"{1}{0}Button\" CausesValidation=\"{2}\" />", new object[] { "Update", string.Empty, bool.TrueString, System.Design.SR.GetString("FormView_Update") })); } builder.Append(" "); builder.Append(string.Format(CultureInfo.InvariantCulture, "<asp:LinkButton runat=\"server\" Text=\"{3}\" CommandName=\"{0}\" id=\"{1}{0}Button\" CausesValidation=\"{2}\" />", new object[] { "Cancel", "Update", bool.FalseString, System.Design.SR.GetString("FormView_Cancel") })); if (base.DesignerView.CanDelete) { if (!flag) { builder2.Append(" "); } builder2.Append(string.Format(CultureInfo.InvariantCulture, "<asp:LinkButton runat=\"server\" Text=\"{3}\" CommandName=\"{0}\" id=\"{1}{0}Button\" CausesValidation=\"{2}\" />", new object[] { "Delete", string.Empty, bool.FalseString, System.Design.SR.GetString("FormView_Delete") })); flag = false; } if (base.DesignerView.CanInsert) { if (!flag) { builder2.Append(" "); } builder2.Append(string.Format(CultureInfo.InvariantCulture, "<asp:LinkButton runat=\"server\" Text=\"{3}\" CommandName=\"{0}\" id=\"{1}{0}Button\" CausesValidation=\"{2}\" />", new object[] { "New", string.Empty, bool.FalseString, System.Design.SR.GetString("FormView_New") })); } if (this.EnableDynamicData) { builder3.Append(string.Format(CultureInfo.InvariantCulture, "<asp:LinkButton runat=\"server\" Text=\"{3}\" CommandName=\"{0}\" id=\"{1}{0}Button\" CausesValidation=\"{2}\" ValidationGroup=\"Insert\" />", new object[] { "Insert", string.Empty, bool.TrueString, System.Design.SR.GetString("FormView_Insert") })); } else { builder3.Append(string.Format(CultureInfo.InvariantCulture, "<asp:LinkButton runat=\"server\" Text=\"{3}\" CommandName=\"{0}\" id=\"{1}{0}Button\" CausesValidation=\"{2}\" />", new object[] { "Insert", string.Empty, bool.TrueString, System.Design.SR.GetString("FormView_Insert") })); } builder3.Append(" "); builder3.Append(string.Format(CultureInfo.InvariantCulture, "<asp:LinkButton runat=\"server\" Text=\"{3}\" CommandName=\"{0}\" id=\"{1}{0}Button\" CausesValidation=\"{2}\" />", new object[] { "Cancel", "Insert", bool.FalseString, System.Design.SR.GetString("FormView_Cancel") })); builder.Append(Environment.NewLine); builder2.Append(Environment.NewLine); builder3.Append(Environment.NewLine); try { ((FormView)base.Component).EditItemTemplate = ControlParser.ParseTemplate(service, builder.ToString()); ((FormView)base.Component).ItemTemplate = ControlParser.ParseTemplate(service, builder2.ToString()); ((FormView)base.Component).InsertItemTemplate = ControlParser.ParseTemplate(service, builder3.ToString()); } catch { } int count = list.Count; if (count > 0) { string[] array = new string[count]; list.CopyTo(array, 0); ((FormView)base.Component).DataKeyNames = array; } } } }
public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { object[] values = null; if (context != null) { IComponent instance = context.Instance as IComponent; if (instance != null) { ISite site = instance.Site; if (site != null) { IDesignerHost host = (IDesignerHost)site.GetService(typeof(IDesignerHost)); if (host != null) { IDesigner dataBoundControlDesigner = host.GetDesigner(instance); DesignerDataSourceView view = this.GetView(dataBoundControlDesigner); if (view != null) { IDataSourceViewSchema schema = null; try { schema = view.Schema; } catch (Exception exception) { IComponentDesignerDebugService service = (IComponentDesignerDebugService)site.GetService(typeof(IComponentDesignerDebugService)); if (service != null) { service.Fail(System.Design.SR.GetString("DataSource_DebugService_FailedCall", new object[] { "DesignerDataSourceView.Schema", exception.Message })); } } if (schema != null) { IDataSourceFieldSchema[] fields = schema.GetFields(); if (fields != null) { values = new object[fields.Length]; for (int i = 0; i < fields.Length; i++) { values[i] = fields[i].Name; } } } } if (((values == null) && (dataBoundControlDesigner != null)) && (dataBoundControlDesigner is IDataSourceProvider)) { IDataSourceProvider provider = dataBoundControlDesigner as IDataSourceProvider; IEnumerable dataSource = null; if (provider != null) { dataSource = provider.GetResolvedSelectedDataSource(); } if (dataSource != null) { PropertyDescriptorCollection dataFields = DesignTimeData.GetDataFields(dataSource); if (dataFields != null) { ArrayList list = new ArrayList(); foreach (PropertyDescriptor descriptor in dataFields) { list.Add(descriptor.Name); } values = list.ToArray(); } } } } } } } return(new TypeConverter.StandardValuesCollection(values)); }
public static bool ViewSchemasEquivalent(IDataSourceViewSchema viewSchema1, IDataSourceViewSchema viewSchema2) { }
internal bool InternalViewSchemasEquivalent(IDataSourceViewSchema viewSchema1, IDataSourceViewSchema viewSchema2) { return ViewSchemasEquivalent(viewSchema1, viewSchema2); }
private void PopulateSchemaRecursive(System.Windows.Forms.TreeNodeCollection nodes, IDataSourceViewSchema viewSchema, int depth, IDictionary duplicates) { if (viewSchema != null) { SchemaTreeNode node = new SchemaTreeNode(viewSchema); nodes.Add(node); SchemaTreeNode node2 = (SchemaTreeNode)duplicates[viewSchema.Name]; if (node2 != null) { node2.Duplicate = true; node.Duplicate = true; } foreach (TreeNodeBinding binding in this._bindingsListView.Items) { if (string.Compare(binding.DataMember, viewSchema.Name, StringComparison.OrdinalIgnoreCase) == 0) { IDataSourceViewSchemaAccessor accessor = binding; if ((depth == binding.Depth) || (accessor.DataSourceViewSchema == null)) { accessor.DataSourceViewSchema = viewSchema; } } } IDataSourceViewSchema[] children = viewSchema.GetChildren(); if (children != null) { for (int i = 0; i < children.Length; i++) { this.PopulateSchemaRecursive(node.Nodes, children[i], depth + 1, duplicates); } } } }
public SchemaTreeNode(IDataSourceViewSchema schema) : base(schema.Name) { this._schema = schema; }
private void PopulateSchemaRecursive(System.Windows.Forms.TreeNodeCollection nodes, IDataSourceViewSchema viewSchema, int depth, IDictionary duplicates) { if (viewSchema != null) { SchemaTreeNode node = new SchemaTreeNode(viewSchema); nodes.Add(node); SchemaTreeNode node2 = (SchemaTreeNode) duplicates[viewSchema.Name]; if (node2 != null) { node2.Duplicate = true; node.Duplicate = true; } foreach (MenuItemBinding binding in this._bindingsListView.Items) { if (string.Compare(binding.DataMember, viewSchema.Name, StringComparison.OrdinalIgnoreCase) == 0) { IDataSourceViewSchemaAccessor accessor = binding; if ((depth == binding.Depth) || (accessor.DataSourceViewSchema == null)) { accessor.DataSourceViewSchema = viewSchema; } } } IDataSourceViewSchema[] children = viewSchema.GetChildren(); if (children != null) { for (int i = 0; i < children.Length; i++) { this.PopulateSchemaRecursive(node.Nodes, children[i], depth + 1, duplicates); } } } }
public static bool ViewSchemasEquivalent(IDataSourceViewSchema viewSchema1, IDataSourceViewSchema viewSchema2) { if ((viewSchema1 == null) ^ (viewSchema2 == null)) { return false; } if ((viewSchema1 != null) || (viewSchema2 != null)) { IDataSourceFieldSchema[] fields = viewSchema1.GetFields(); IDataSourceFieldSchema[] schemaArray2 = viewSchema2.GetFields(); if ((fields == null) ^ (schemaArray2 == null)) { return false; } if ((fields == null) && (schemaArray2 == null)) { return true; } int length = fields.Length; int num2 = schemaArray2.Length; if (length != num2) { return false; } foreach (IDataSourceFieldSchema schema in fields) { bool flag = false; string name = schema.Name; Type dataType = schema.DataType; foreach (IDataSourceFieldSchema schema2 in schemaArray2) { if ((name == schema2.Name) && (dataType == schema2.DataType)) { flag = true; break; } } if (!flag) { return false; } } } return true; }
internal bool InternalViewSchemasEquivalent(IDataSourceViewSchema viewSchema1, IDataSourceViewSchema viewSchema2) { return(ViewSchemasEquivalent(viewSchema1, viewSchema2)); }
private IDataSourceViewSchema GetViewSchema() { if ((this._viewSchema == null) && (this._controlDesigner != null)) { DesignerDataSourceView designerView = this._controlDesigner.DesignerView; if (designerView != null) { try { this._viewSchema = designerView.Schema; } catch (Exception exception) { IComponentDesignerDebugService service = (IComponentDesignerDebugService) base.ServiceProvider.GetService(typeof(IComponentDesignerDebugService)); if (service != null) { service.Fail(System.Design.SR.GetString("DataSource_DebugService_FailedCall", new object[] { "DesignerDataSourceView.Schema", exception.Message })); } } } } return this._viewSchema; }
private void ExtractFields(IDataSourceViewSchema schema, ArrayList fields) { if (schema != null) { IDataSourceFieldSchema[] schemaArray = schema.GetFields(); if (schemaArray != null) { for (int i = 0; i < schemaArray.Length; i++) { fields.Add(new FieldItem(schemaArray[i].Name, schemaArray[i].DataType)); } } } }
private void OnClickRefreshSchema(object source, LinkLabelLinkClickedEventArgs e) { this._fieldSchemas = null; this._viewSchema = null; IDataSourceDesigner dataSourceDesigner = this._controlDesigner.DataSourceDesigner; if ((dataSourceDesigner != null) && dataSourceDesigner.CanRefreshSchema) { dataSourceDesigner.RefreshSchema(false); } IDataSourceViewSchema viewSchema = this.GetViewSchema(); foreach (FieldItem item in this._selFieldsList.Items) { IDataSourceViewSchemaAccessor runtimeField = item.RuntimeField; if (runtimeField != null) { runtimeField.DataSourceViewSchema = viewSchema; } } this._availableFieldsTree.Nodes.Clear(); this.LoadAvailableFieldsTree(); this.LoadDataSourceFields(); }
public static bool ViewSchemasEquivalent(IDataSourceViewSchema viewSchema1, IDataSourceViewSchema viewSchema2) { throw new NotImplementedException(); }
/// <summary> /// Returns a single element array containing the /// schema for the CSLA .NET business object. /// </summary> public System.Web.UI.Design.IDataSourceViewSchema[] GetViews() { IDataSourceViewSchema[] result = null; result = new IDataSourceViewSchema[] { new ObjectViewSchema(_designer, _typeName) }; return result; }
internal static IDataSourceViewSchema FindViewSchemaRecursive(object schema, int depth, string viewName, int level, IDataSourceViewSchema bestBet) { if (!(schema is IDataSourceSchema) && !(schema is IDataSourceViewSchema)) { return null; } IDataSourceViewSchema schema2 = schema as IDataSourceViewSchema; IDataSourceViewSchema[] schemaArray = (schema2 != null) ? schema2.GetChildren() : ((IDataSourceSchema) schema).GetViews(); if (schemaArray != null) { if (depth == level) { foreach (IDataSourceViewSchema schema3 in schemaArray) { if (string.Equals(schema3.Name, viewName, StringComparison.OrdinalIgnoreCase)) { return schema3; } if (string.IsNullOrEmpty(schema3.Name) && (bestBet == null)) { bestBet = schema3; } bestBet = FindViewSchemaRecursive(schema3, depth + 1, viewName, level, bestBet); } return bestBet; } foreach (IDataSourceViewSchema schema4 in schemaArray) { if (((level == -1) && string.Equals(schema4.Name, viewName, StringComparison.OrdinalIgnoreCase)) && (bestBet == null)) { return schema4; } bestBet = FindViewSchemaRecursive(schema4, depth + 1, viewName, level, bestBet); } } return bestBet; }
public static bool ViewSchemasEquivalent (IDataSourceViewSchema viewSchema1, IDataSourceViewSchema viewSchema2) { throw new NotImplementedException (); }
public static bool ViewSchemasEquivalent(IDataSourceViewSchema viewSchema1, IDataSourceViewSchema viewSchema2) {}
private void AddTemplatesAndKeys(IDataSourceViewSchema schema) { StringBuilder builder = new StringBuilder(); StringBuilder builder2 = new StringBuilder(); StringBuilder builder3 = new StringBuilder(); IDesignerHost service = (IDesignerHost) base.Component.Site.GetService(typeof(IDesignerHost)); if (schema != null) { IDataSourceFieldSchema[] fields = schema.GetFields(); if ((fields != null) && (fields.Length > 0)) { ArrayList list = new ArrayList(); foreach (IDataSourceFieldSchema schema2 in fields) { string name = schema2.Name; char[] chArray = new char[name.Length]; for (int i = 0; i < name.Length; i++) { char c = name[i]; if (char.IsLetterOrDigit(c) || (c == '_')) { chArray[i] = c; } else { chArray[i] = '_'; } } string str2 = new string(chArray); string str3 = DesignTimeDataBinding.CreateEvalExpression(name, string.Empty); string str4 = DesignTimeDataBinding.CreateBindExpression(name, string.Empty); if (schema2.PrimaryKey || schema2.Identity) { if (this.EnableDynamicData) { builder.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:DynamicControl DataField=\"{0}\" runat=\"server\" id=\"{2}DynamicControl\" Mode=\"{1}\" /><br />", new object[] { name, "ReadOnly", str2 })); builder2.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:DynamicControl DataField=\"{0}\" runat=\"server\" id=\"{2}DynamicControl\" Mode=\"{1}\" /><br />", new object[] { name, "ReadOnly", str2 })); } else { builder.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:Label Text='<%# {1} %>' runat=\"server\" id=\"{2}Label1\" /><br />", new object[] { name, str3, str2 })); builder2.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:Label Text='<%# {1} %>' runat=\"server\" id=\"{2}Label\" /><br />", new object[] { name, str3, str2 })); } if (!schema2.Identity) { if (this.EnableDynamicData) { builder3.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:DynamicControl DataField=\"{0}\" runat=\"server\" id=\"{1}DynamicControl\" Mode=\"Insert\" ValidationGroup=\"Insert\" /><br />", new object[] { name, str2 })); } else { builder3.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:TextBox Text='<%# {1} %>' runat=\"server\" id=\"{2}TextBox\" /><br />", new object[] { name, str4, str2 })); } } } else if (this.EnableDynamicData) { builder.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:DynamicControl DataField=\"{0}\" runat=\"server\" id=\"{2}DynamicControl\" Mode=\"{1}\" /><br />", new object[] { name, "Edit", str2 })); builder2.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:DynamicControl DataField=\"{0}\" runat=\"server\" id=\"{2}DynamicControl\" Mode=\"{1}\" /><br />", new object[] { name, "ReadOnly", str2 })); builder3.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:DynamicControl DataField=\"{0}\" runat=\"server\" id=\"{1}DynamicControl\" Mode=\"Insert\" ValidationGroup=\"Insert\" /><br />", new object[] { name, str2 })); } else if ((schema2.DataType == typeof(bool)) || (schema2.DataType == typeof(bool?))) { builder.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:CheckBox Checked='<%# {1} %>' runat=\"server\" id=\"{2}CheckBox\" /><br />", new object[] { name, str4, str2 })); builder2.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:CheckBox Checked='<%# {1} %>' runat=\"server\" id=\"{2}CheckBox\" Enabled=\"false\" /><br />", new object[] { name, str4, str2 })); builder3.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:CheckBox Checked='<%# {1} %>' runat=\"server\" id=\"{2}CheckBox\" /><br />", new object[] { name, str4, str2 })); } else { builder.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:TextBox Text='<%# {1} %>' runat=\"server\" id=\"{2}TextBox\" /><br />", new object[] { name, str4, str2 })); builder2.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:Label Text='<%# {1} %>' runat=\"server\" id=\"{2}Label\" /><br />", new object[] { name, str4, str2 })); builder3.Append(string.Format(CultureInfo.InvariantCulture, "{0}: <asp:TextBox Text='<%# {1} %>' runat=\"server\" id=\"{2}TextBox\" /><br />", new object[] { name, str4, str2 })); } builder.Append(Environment.NewLine); builder2.Append(Environment.NewLine); builder3.Append(Environment.NewLine); if (schema2.PrimaryKey) { list.Add(name); } } bool flag = true; if (base.DesignerView.CanUpdate) { builder2.Append(string.Format(CultureInfo.InvariantCulture, "<asp:LinkButton runat=\"server\" Text=\"{3}\" CommandName=\"{0}\" id=\"{1}{0}Button\" CausesValidation=\"{2}\" />", new object[] { "Edit", string.Empty, bool.FalseString, System.Design.SR.GetString("FormView_Edit") })); flag = false; } if (this.EnableDynamicData) { builder.Append(string.Format(CultureInfo.InvariantCulture, "<asp:LinkButton runat=\"server\" Text=\"{3}\" CommandName=\"{0}\" id=\"{1}{0}Button\" CausesValidation=\"{2}\" ValidationGroup=\"Insert\" />", new object[] { "Update", string.Empty, bool.TrueString, System.Design.SR.GetString("FormView_Update") })); } else { builder.Append(string.Format(CultureInfo.InvariantCulture, "<asp:LinkButton runat=\"server\" Text=\"{3}\" CommandName=\"{0}\" id=\"{1}{0}Button\" CausesValidation=\"{2}\" />", new object[] { "Update", string.Empty, bool.TrueString, System.Design.SR.GetString("FormView_Update") })); } builder.Append(" "); builder.Append(string.Format(CultureInfo.InvariantCulture, "<asp:LinkButton runat=\"server\" Text=\"{3}\" CommandName=\"{0}\" id=\"{1}{0}Button\" CausesValidation=\"{2}\" />", new object[] { "Cancel", "Update", bool.FalseString, System.Design.SR.GetString("FormView_Cancel") })); if (base.DesignerView.CanDelete) { if (!flag) { builder2.Append(" "); } builder2.Append(string.Format(CultureInfo.InvariantCulture, "<asp:LinkButton runat=\"server\" Text=\"{3}\" CommandName=\"{0}\" id=\"{1}{0}Button\" CausesValidation=\"{2}\" />", new object[] { "Delete", string.Empty, bool.FalseString, System.Design.SR.GetString("FormView_Delete") })); flag = false; } if (base.DesignerView.CanInsert) { if (!flag) { builder2.Append(" "); } builder2.Append(string.Format(CultureInfo.InvariantCulture, "<asp:LinkButton runat=\"server\" Text=\"{3}\" CommandName=\"{0}\" id=\"{1}{0}Button\" CausesValidation=\"{2}\" />", new object[] { "New", string.Empty, bool.FalseString, System.Design.SR.GetString("FormView_New") })); } if (this.EnableDynamicData) { builder3.Append(string.Format(CultureInfo.InvariantCulture, "<asp:LinkButton runat=\"server\" Text=\"{3}\" CommandName=\"{0}\" id=\"{1}{0}Button\" CausesValidation=\"{2}\" ValidationGroup=\"Insert\" />", new object[] { "Insert", string.Empty, bool.TrueString, System.Design.SR.GetString("FormView_Insert") })); } else { builder3.Append(string.Format(CultureInfo.InvariantCulture, "<asp:LinkButton runat=\"server\" Text=\"{3}\" CommandName=\"{0}\" id=\"{1}{0}Button\" CausesValidation=\"{2}\" />", new object[] { "Insert", string.Empty, bool.TrueString, System.Design.SR.GetString("FormView_Insert") })); } builder3.Append(" "); builder3.Append(string.Format(CultureInfo.InvariantCulture, "<asp:LinkButton runat=\"server\" Text=\"{3}\" CommandName=\"{0}\" id=\"{1}{0}Button\" CausesValidation=\"{2}\" />", new object[] { "Cancel", "Insert", bool.FalseString, System.Design.SR.GetString("FormView_Cancel") })); builder.Append(Environment.NewLine); builder2.Append(Environment.NewLine); builder3.Append(Environment.NewLine); try { ((FormView) base.Component).EditItemTemplate = ControlParser.ParseTemplate(service, builder.ToString()); ((FormView) base.Component).ItemTemplate = ControlParser.ParseTemplate(service, builder2.ToString()); ((FormView) base.Component).InsertItemTemplate = ControlParser.ParseTemplate(service, builder3.ToString()); } catch { } int count = list.Count; if (count > 0) { string[] array = new string[count]; list.CopyTo(array, 0); ((FormView) base.Component).DataKeyNames = array; } } } }