public Form BuildForm(RowData Data, FormLayouts FormLayout = FormLayouts.Vertical, SectionLayouts SectionLayout = SectionLayouts.Vertical, MetadataTable Table = null) { if (Table == null) { Table = Data.Metadata; if (Table == null) { throw new ArgumentException("The Metadata Table argument is null, and metadata cannot be retrieved from the RowData object", "Table"); } } Form form = new Form(); form.FormLayout = FormLayout; form.TitleColumn = Table.GuessTitleColumn(); FormSection section = new FormSection(); section.SectionLayout = SectionLayout; List <string> Columns = Data.Columns; string TableName = Table.Fullname; foreach (string s in Columns) { MetadataColumn mc; if (Table.Columns.TryGetValue(s, out mc)) { BuildField(mc, TableName, null, section, null, false); } } form.Sections.Add(section); form.Initialize(Data, Table); return(form); }
public Form BuildForm(SqlBuilder Builder, FormLayouts FormLayout = FormLayouts.Vertical, SectionLayouts SectionLayout = SectionLayouts.VerticalTwoColumns) { Form form = new Form(); form.FormLayout = FormLayout; for (int i = 0; i < Builder.Tables.Count; i++) { FormSection section = new FormSection() { SectionLayout = SectionLayout }; Table table = Builder.Tables[i]; MetadataTable mt = Builder.Metadata.FindTable(table.FullName); // section.Legend = StringMap.Default.GetText(SqlBuilder.DefaultCulture.LCID, mt.Fullname, mt.Name); section.Legend = mt.DisplayName; string TableName = mt.Fullname; if (i == 0) { form.TitleColumn = mt.GuessTitleColumn(); } foreach (Field field in table.FieldList) { string name = field.Name; MetadataColumn mc; if (mt.Columns.TryGetValue(name, out mc)) { MetadataColumn includedFrom = mt.Columns.Values.FirstOrDefault(x => x.IncludeColumns != null && x.IncludeColumns.Contains(field.Alias ?? field.Name)); BuildField(mc, TableName, field.Alias, section, includedFrom, i > 0); } } if (section.Fields.Count > 0) { form.Sections.Add(section); } } form.Sections[0].Fields.Insert(0, new FormField() { Name = "__TABLE", ID = "__TABLE", FieldType = FieldTypes.Input, InputType = InputTypes.text, IsHidden = true }); return form; }
public Form BuildForm(SqlBuilder Builder, FormLayouts FormLayout = FormLayouts.Vertical, SectionLayouts SectionLayout = SectionLayouts.VerticalTwoColumns) { Form form = new Form(); form.FormLayout = FormLayout; for (int i = 0; i < Builder.Tables.Count; i++) { FormSection section = new FormSection() { SectionLayout = SectionLayout }; Table table = Builder.Tables[i]; MetadataTable mt = Builder.Metadata.FindTable(table.FullName); // section.Legend = StringMap.Default.GetText(SqlBuilder.DefaultCulture.LCID, mt.Fullname, mt.Name); section.Legend = mt.DisplayName; string TableName = mt.Fullname; if (i == 0) { form.TitleColumn = mt.GuessTitleColumn(); } foreach (Field field in table.FieldList) { string name = field.Name; MetadataColumn mc; if (mt.Columns.TryGetValue(name, out mc)) { MetadataColumn includedFrom = mt.Columns.Values.FirstOrDefault(x => x.IncludeColumns != null && x.IncludeColumns.Contains(field.Alias ?? field.Name)); BuildField(mc, TableName, field.Alias, section, includedFrom, i > 0); } } if (section.Fields.Count > 0) { form.Sections.Add(section); } } form.Sections[0].Fields.Insert(0, new FormField() { Name = "__TABLE", ID = "__TABLE", FieldType = FieldTypes.Input, InputType = InputTypes.text, IsHidden = true }); return(form); }
public Form BuildForm(MetadataTable Table, FormTypes FormType, FormLayouts FormLayout = FormLayouts.Vertical, SectionLayouts SectionLayout = SectionLayouts.VerticalTwoColumns) { Form form = new Form(); form.FormLayout = FormLayout; form.TitleColumn = Table.GuessTitleColumn(); if (form.TitleColumn == null) { form.TitleColumn = Table.PrimaryKey.Columns.First().Name; } FormSection section = new FormSection() { SectionLayout = SectionLayout }; string TableName = Table.Fullname; foreach (MetadataColumn col in Table.Columns.Values) { BuildField(col, TableName, null, section, null, false); } form.Sections.Add(section); return(form); }
private static void BuildField(MetadataColumn col, string TableName, string Alias, FormSection section, MetadataColumn IncludeFrom, bool ForceReadOnly = false) { if (col.IsRowGuid) { return; } FormField field = null; if (col.IsForeignKey) { field = new LookupFormField() { LookupSource = LookupSources.SqlBuilder, Builder = col.ToSqlBuilder() }; } else { field = new FormField(); } field.DisplayName = (IncludeFrom != null ? IncludeFrom.DisplayName + " " : "") + col.DisplayName; field.ID = col.Name; field.Name = col.Name; field.Alias = Alias; field.TableName = TableName; field.NullText = "Enter " + col.Name; field.IsReadOnly = ForceReadOnly || col.IsReadOnly || col.IsPrimaryKey; field.IsRequired = !col.Nullable; ResolveFieldType(col, field); section.Fields.Add(field); }
public static void BuildField(MetadataColumn Column, string Alias, FormSection Section, bool ForceReadonly = false) { BuildField(Column, Column.Parent.Schema + "." + Column.Parent.Name, Alias, Section, null, ForceReadonly); }
internal SectionModel(FormSection formSection, MetadataTable model, RowData data) { this.Section = formSection; this.Model = model; this.Data = data; }
public SectionModel GetSectionModel(FormSection Section) { return new SectionModel(Section, this.Metadata, this.Data); }
public SectionModel GetSectionModel(FormSection Section) { return(new SectionModel(Section, this.Metadata, this.Data)); }
public Form BuildForm(RowData Data, FormLayouts FormLayout = FormLayouts.Vertical, SectionLayouts SectionLayout = SectionLayouts.Vertical, MetadataTable Table = null) { if (Table == null) { Table = Data.Metadata; if (Table == null) { throw new ArgumentException("The Metadata Table argument is null, and metadata cannot be retrieved from the RowData object", "Table"); } } Form form = new Form(); form.FormLayout = FormLayout; form.TitleColumn = Table.GuessTitleColumn(); FormSection section = new FormSection(); section.SectionLayout = SectionLayout; List<string> Columns = Data.Columns; string TableName = Table.Fullname; foreach (string s in Columns) { MetadataColumn mc; if (Table.Columns.TryGetValue(s, out mc)) { BuildField(mc, TableName, null, section, null, false); } } form.Sections.Add(section); form.Initialize(Data, Table); return form; }
public Form BuildForm(MetadataTable Table, FormTypes FormType, FormLayouts FormLayout = FormLayouts.Vertical, SectionLayouts SectionLayout = SectionLayouts.VerticalTwoColumns) { Form form = new Form(); form.FormLayout = FormLayout; form.TitleColumn = Table.GuessTitleColumn(); if (form.TitleColumn == null) { form.TitleColumn = Table.PrimaryKey.Columns.First().Name; } FormSection section = new FormSection() { SectionLayout = SectionLayout }; string TableName = Table.Fullname; foreach (MetadataColumn col in Table.Columns.Values) { BuildField(col, TableName, null, section, null, false); } form.Sections.Add(section); return form; }