/// <summary> /// Selects a stream-method from the list of advertised methods. /// </summary> /// <param name="feature">The 'feature' element containing the data-form /// with advertised stream-methods.</param> /// <returns>The selected stream-method.</returns> /// <exception cref="ArgumentException">None of the advertised methods is /// supported.</exception> string SelectStreamMethod(XmlElement feature) { // See if we support any of the advertised stream-methods. DataForm form = FeatureNegotiation.Parse(feature); ListField field = form.Fields["stream-method"] as ListField; // Order of preference: Socks5, Ibb. string[] methods = new string[] { "http://jabber.org/protocol/bytestreams", "http://jabber.org/protocol/ibb" }; for (int i = 0; i < methods.Length; i++) { if (ForceInBandBytestreams && methods[i] != "http://jabber.org/protocol/ibb") { continue; } if (field.Values.Contains(methods[i])) { return(methods[i]); } } throw new ArgumentException("No supported method advertised."); }
private bool TryBuildListCell(ListField lf, Dictionary <string, LazyColumnEnumerator> pathToColumn, out object cell) { //As this is the list, all sub-columns of this list have to be cut into. This is essentially a more complicated version of //the TryBuildMapCell method var nestedPathTicks = pathToColumn .Where(ptc => ptc.Key.StartsWith(lf.Path)) .Select(ptc => new { path = ptc.Key, collection = ptc.Value, moved = ptc.Value.MoveNext() }) .ToList(); if (nestedPathTicks.Any(t => !t.moved)) { cell = null; return(false); } var nestedPathToColumn = nestedPathTicks .ToDictionary(ptc => ptc.path, ptc => (LazyColumnEnumerator)ptc.collection.Current); IReadOnlyList <Row> rows = BuildRows(new[] { lf.Item }, nestedPathToColumn); cell = rows.Select(r => r[0]).ToArray(); return(true); }
public static new ItemCollection <ListField> Create(object obj, bool includeBaseTypes = true) { var fieldInfos = obj.GetType().GetFields() .Where(f => IsVisible(f)) .Where(f => includeBaseTypes || f.DeclaringType == obj.GetType()) .OrderBy(f => f.MetadataToken); var listFields = new ItemCollection <ListField>(); // replace any overriden/new field & properties var fieldToIndex = new Dictionary <string, int>(); foreach (FieldInfo fieldInfo in fieldInfos) { var listField = new ListField(obj, fieldInfo); if (fieldToIndex.TryGetValue(fieldInfo.Name, out int index)) { listFields.RemoveAt(index); listFields.Insert(index, listField); } else { fieldToIndex[fieldInfo.Name] = listFields.Count; listFields.Add(listField); } } return(listFields); }
public VariableDictionaryWatchControl(string name, IVariableDictionary variables, bool allowClose) { var proxy = new WatchProxy(variables); var list = new ListField { Label = name, AllowAdd = false, AllowRemove = false, AllowReorder = false, Tooltip = "The variables in this map", EmptyLabel = "This variable map is empty", EmptyTooltip = "There are no variables in this map", }; list.SetProxy(proxy, null, false); if (allowClose) { list.Header.Add(new IconButton(RemoveFromHierarchy) { image = Icon.Close.Texture, tooltip = "Close this watch" }); } Add(list); }
private static void ValidateList(ListField lf, object value) { bool isEnumerable = value.GetType().TryExtractEnumerableType(out Type elementType); //value must be an enumeration of items if (!isEnumerable) { throw new ArgumentException($"simple list must be a collection, but found {value.GetType()}"); } if (lf.Item.SchemaType == SchemaType.Data) { DataField df = (DataField)lf.Item; //value is a list of items foreach (object element in (IEnumerable)value) { ValidatePrimitive(df, element); } } else { if (elementType != typeof(Row)) { throw new ArgumentException($"expected a collection of {typeof(Row)} but found a collection of {elementType}"); } } }
/// <summary> /// Adds a dropdown field to the criteria panel /// </summary> private ListBase InitialiseListField(Search.SearchParameter parameter) { if (!String.IsNullOrEmpty(parameter.CodeType)) { CodeField codeField = new CodeField(); codeField.CodeType = parameter.CodeType.Contains(":") ? parameter.CodeType.Substring(0, parameter.CodeType.IndexOf(":")) : parameter.CodeType; return(codeField); } if (!String.IsNullOrEmpty(parameter.ListData)) { JavaScriptSerializer serializer = new JavaScriptSerializer(); Dictionary <String, Object> jsonData = serializer.Deserialize <Dictionary <String, Object> >(parameter.ListData); ListField listField = null; if (jsonData.Keys.Count >= 1 && String.Equals(jsonData.Keys.ElementAt(0), "SQL", StringComparison.OrdinalIgnoreCase)) { listField = this.InitialiseSqlField(jsonData.Values.ElementAt(0) as String); } if (jsonData.Keys.Count >= 1 && String.Equals(jsonData.Keys.ElementAt(0), "CODE", StringComparison.OrdinalIgnoreCase)) { listField = this.InitialiseJsonField(jsonData.Values.ElementAt(0) as ArrayList); } if (listField != null && !listField.Items.OfType <ListItem>().Any(item => String.IsNullOrEmpty(item.Value))) { listField.Items.Insert(0, new ListItem("", "")); } return(listField); } return(null); }
public override Field CreateSchemaElement(IList <Thrift.SchemaElement> schema, ref int index, out int ownedChildCount) { Thrift.SchemaElement tseList = schema[index]; ListField listField = ListField.CreateWithNoItem(tseList.Name); //https://github.com/apache/parquet-format/blob/master/LogicalTypes.md#backward-compatibility-rules Thrift.SchemaElement tseRepeated = schema[index + 1]; //Rule 1. If the repeated field is not a group, then its type is the element type and elements are required. //not implemented //Rule 2. If the repeated field is a group with multiple fields, then its type is the element type and elements are required. //not implemented //Rule 3. f the repeated field is a group with one field and is named either array or uses //the LIST-annotated group's name with _tuple appended then the repeated type is the element //type and elements are required. // "group with one field and is named either array": if (tseList.Num_children == 1 && tseRepeated.Name == "array") { listField.Path = tseList.Name; index += 1; //only skip this element ownedChildCount = 1; return(listField); } //as we are skipping elements set path hint listField.Path = $"{tseList.Name}{Schema.PathSeparator}{schema[index + 1].Name}"; index += 2; //skip this element and child container ownedChildCount = 1; //we should get this element assigned back return(listField); }
/// <summary> /// Gets the drawing information for a particular element in the compartment. /// </summary> /// <param name="listField">The <see cref="ShapeField"/> of this <see cref="AttributeElementListCompartment"/> which /// paints the items in this compartment.</param> /// <param name="row">The index of the array of items whose item drawing information is of interest.</param> /// <param name="itemDrawInfo">A previously initialized <see cref="ItemDrawInfo"/> object whose properties will be modified.</param> public override void GetItemDrawInfo(ListField listField, int row, ItemDrawInfo itemDrawInfo) { base.GetItemDrawInfo(listField, row, itemDrawInfo); Barker.Attribute currentAttribute = this.Items[row] as Barker.Attribute; Debug.Assert(currentAttribute != null, "An item in the AttributeElementListCompartment is not an attribute."); if (currentAttribute.IsMandatory) { itemDrawInfo.AlternateFont = true; } StringBuilder attributeText = new StringBuilder(); if (currentAttribute.IsPrimaryIdComponent) { attributeText.Append(PrimaryIdentifierString); } else { attributeText.Append(BlankString); } attributeText.Append(BlankString); if (currentAttribute.IsMandatory) { attributeText.Append(MandatoryString); } else { attributeText.Append(OptionalString); } attributeText.Append(BlankString); attributeText.Append(currentAttribute.Name); itemDrawInfo.Text = attributeText.ToString(); }
public override void CreateThrift(Field field, Thrift.SchemaElement parent, IList <Thrift.SchemaElement> container) { ListField listField = (ListField)field; parent.Num_children += 1; //add list container var root = new Thrift.SchemaElement(field.Name) { Converted_type = Thrift.ConvertedType.LIST, Repetition_type = Thrift.FieldRepetitionType.OPTIONAL, Num_children = 1 //field container below }; container.Add(root); //add field container var list = new Thrift.SchemaElement("list") { Repetition_type = Thrift.FieldRepetitionType.REPEATED }; container.Add(list); //add the list item as well IDataTypeHandler fieldHandler = DataTypeFactory.Match(listField.Item); fieldHandler.CreateThrift(listField.Item, list, container); }
/// <summary>添加定制字段,插入指定列之前</summary> /// <param name="name"></param> /// <param name="beforeName"></param> /// <param name="afterName"></param> /// <returns></returns> public ListField AddListField(String name, String beforeName = null, String afterName = null) { var fi = Factory.AllFields.FirstOrDefault(e => e.Name.EqualIgnoreCase(name)); var field = new ListField { Name = name }; if (fi != null) { field.Fill(fi); } if (!beforeName.IsNullOrEmpty()) { var idx = FindIndex(beforeName); if (idx >= 0) { Insert(idx, field); } } else if (!beforeName.IsNullOrEmpty()) { var idx = FindIndex(afterName); if (idx >= 0) { Insert(idx + 1, field); } } else { Add(field); } return(field); }
public void List_maintains_path_prefix() { var list = new ListField("List", new DataField <int>("id")); list.PathPrefix = "Parent"; Assert.Equal("Parent.List.list.id", list.Item.Path); }
public void Write(ListField val) { WriteHeader(Type_List, val.Tag); Write(val.Count, 0); foreach (JceField field in val) { Write(field); } }
public ListTypeNode(ListField list) : base(string.Format("{0} ({1} entries)", list.Info.Name, list.Contained.Count)) { Tag = list; foreach (List <FieldInstance> infos in list.Contained) { Nodes.Add(new FieldInstanceNode(infos, (list.Info as ListType).NameAt)); } }
private BaseInputControl CreateCustomListField(ScreenCustomField field) { ListField listField = new ListField(); listField.DisplayMember = "Text"; listField.ValueMember = "IdValue"; listField.DataSource = ScreenCustomFieldListitem.FetchAllByCfieldId(field.Id).ToList(); return(listField); }
private Row CreateRow(string parentPath, JObject jo, IEnumerable <Field> fields) { var values = new List <object>(); foreach (Field field in fields) { //string path = GetJsonPath(parentPath, field); string path = "$." + field.Name; object value; switch (field.SchemaType) { case SchemaType.Data: JToken vt = jo.SelectToken(path); if (vt == null) { value = null; } else { value = vt.Type == JTokenType.Array ? GetValues((JArray)vt, (DataField)field) : GetValue(((JValue)vt)?.Value, (DataField)field); } break; case SchemaType.Struct: JToken vtStruct = jo.SelectToken(path); value = CreateRow(path, (JObject)vtStruct, ((StructField)field).Fields); break; case SchemaType.List: JToken vtList = jo.SelectToken(path); //it's always a struct in a list ListField listField = (ListField)field; StructField structField = (StructField)listField.Item; var rows = new List <Row>(); if (vtList.Type == JTokenType.Array) //the value may be null or just not matching the schema { foreach (JObject vtListItem in ((JArray)vtList).Children()) { Row row = CreateRow(null, vtListItem, structField.Fields); rows.Add(row); } } value = rows; break; default: throw new NotImplementedException(); } values.Add(value); } return(new Row(values)); }
private static byte[] GetStringBytes(Sheet sheet, out Dictionary <string, int> strOffsetDic) { strOffsetDic = new Dictionary <string, int>(); MemoryStream stream = new MemoryStream(); for (int i = 0; i < sheet.LineCount; ++i) { Line line = sheet.GetLineByIndex(i); for (int j = 0; j < sheet.FieldCount; ++j) { Field field = sheet.GetFieldByIndex(j); Type fieldRealyType = FieldTypeUtil.GetRealyType(field.FieldType); if (fieldRealyType == typeof(string)) { string value = (string)field.GetValue(line.GetCellByIndex(j)); if (!string.IsNullOrEmpty(value) && !strOffsetDic.ContainsKey(value)) { strOffsetDic.Add(value, (int)stream.Length); byte[] strBytes = Encoding.UTF8.GetBytes(value); byte[] strLenBytes = BitConverter.GetBytes(strBytes.Length); stream.Write(strLenBytes, 0, strLenBytes.Length); stream.Write(strBytes, 0, strBytes.Length); } } else if (fieldRealyType == typeof(IList)) { ListField listField = (ListField)field; Type valueRealyType = FieldTypeUtil.GetRealyType(listField.ValueType); if (valueRealyType == typeof(string)) { string[] values = (string[])field.GetValue(line.GetCellByIndex(j)); if (values != null && values.Length > 0) { foreach (var value in values) { if (!string.IsNullOrEmpty(value) && !strOffsetDic.ContainsKey(value)) { strOffsetDic.Add(value, (int)stream.Length); byte[] strBytes = Encoding.UTF8.GetBytes(value); byte[] strLenBytes = BitConverter.GetBytes(strBytes.Length); stream.Write(strLenBytes, 0, strLenBytes.Length); stream.Write(strBytes, 0, strBytes.Length); } } } } } } } return(stream.ToArray()); }
private async void MessageReplyLastExecute() { var last = Items.LastOrDefault(); if (last != null) { MessageReplyCommand.Execute(last); await ListField?.ScrollToItem(last, SnapPointsAlignment.Far, true, 4); } }
/// <summary>添加定制版数据字段</summary> /// <param name="fi"></param> /// <returns></returns> public ListField AddListField(FieldItem fi) { var field = new ListField(); field.Fill(fi); Add(field); return(field); }
// ---------------------------------------------------------------------------------------- /// <!-- For --> /// <summary> /// /// </summary> /// <param name="profile"></param> /// <returns></returns> public IAmAnEndemeItem For(EndemeTermKey profile, bool rawSource) { if (Regex.IsMatch(profile.ToString(), "[*!]")) { return(RegField.Educe(profile, rawSource)); } else { return(ListField.Educe(profile, rawSource)); } }
public EndemeValue GetValue(EndemeTermKey profile) { if (Regex.IsMatch(profile.ToString(), "[*!]")) { return(RegField.Educe(profile, true).Item); } else { return(ListField.Educe(profile, true).Item); } }
// ---------------------------------------------------------------------------------------- /// <!-- For --> /// <summary> /// /// </summary> /// <param name="profile"></param> /// <returns></returns> public IEndemeItem For(string profile) { if (Regex.IsMatch(profile, "[*!]")) { return(RegField.Educe(profile)); } else { return(ListField.Educe(profile)); } }
public EndemeValue GetValue(string profile) { if (Regex.IsMatch(profile, "[*!]")) { return(RegField.Educe(profile).Item); } else { return(ListField.Educe(profile).Item); } }
public void SetValue(string profile, EndemeValue value) { if (Regex.IsMatch(profile, "[*!]")) { EndemeObject enObj = RegField.Educe(profile); enObj.Item = value; } else { ListField.Educe(profile).Item = value; } }
public void SetValue(EndemeTermKey profile, EndemeValue value, bool rawSource) { if (Regex.IsMatch(profile.ToString(), "[*!]")) { EndemeObject enObj = RegField.Educe(profile, rawSource); enObj.Item = value; } else { ListField.Educe(profile, rawSource).Item = value; } }
public override Field CreateSchemaElement(IList <Thrift.SchemaElement> schema, ref int index, out int ownedChildCount) { Thrift.SchemaElement tseList = schema[index]; ListField listField = ListField.CreateWithNoItem(tseList.Name); //as we are skipping elements set path hint listField.Path = $"{tseList.Name}{Schema.PathSeparator}{schema[index + 1].Name}"; index += 2; //skip this element and child container ownedChildCount = 1; //we should get this element assigned back return(listField); }
private string SelectStreamMethod(XmlElement feature) { ListField field = FeatureNegotiation.Parse(feature).Fields["stream-method"] as ListField; string[] strArray = new string[] { "http://jabber.org/protocol/bytestreams", "http://jabber.org/protocol/ibb" }; for (int i = 0; i < strArray.Length; i++) { if ((!this.ForceInBandBytestreams || !(strArray[i] != "http://jabber.org/protocol/ibb")) && field.Values.Contains <string>(strArray[i])) { return(strArray[i]); } } throw new ArgumentException("No supported method advertised."); }
public void Add(IAmAnEndemeItem item) { if (item == null) { return; } if (item.GetType() == typeof(EndemeItem)) { ListField.Add((EndemeItem)item); } else { RegField.Add((EndemeObject)item); } }
/// <summary> /// Adds a JSON-driven dropdown field to the criteria panel /// </summary> private ListField InitialiseJsonField(ArrayList records) { // Iterate through the data-defined list of values ListField listField = new ListField(); foreach (Dictionary <String, Object> record in records) { String value = record.Values.ElementAt(0).ConvertTo <String>(); String text = record.Values.ElementAt(1).ConvertTo <String>(); ListItem item = new ListItem(text, value); listField.Items.Add(item); } return(listField); }
// ---------------------------------------------------------------------------------------- /// <!-- GetMatchList --> /// <summary> /// Orders the list by the sort profile /// </summary> /// <param name="sortProfile"></param> /// <returns></returns> public List <IAmAnEndemeItem> GetMatchList(string sortProfile, bool rawSource) { List <IAmAnEndemeItem> list = new List <IAmAnEndemeItem>(); if (Regex.IsMatch(sortProfile, "[*!]")) { EndemeDefinition part = RegField.PartNotHaving(RegField.EnRef["DSVQAHMU"]); list = part.OrderBy(new EndemeProfile(sortProfile, RegField.EnRef)).ToList(); } else { EndemeItem item = EndemeProfile.BuildSegment(sortProfile, ListField.EnRef, rawSource); list = ListField.OrderBy(item.ItemEndeme).ToList(); } return(list); }
private static NDBFieldType GetNDBFieldType(Field field) { FieldType fieldType = field.FieldType; if (fieldType == FieldType.List) { ListField listField = (ListField)field; FieldType valueType = listField.ValueType; NDBFieldType ndbFieldType = GetNDBFieldType(valueType); return((NDBFieldType)(ndbFieldType + 100)); } else { return(GetNDBFieldType(fieldType)); } }
/// <summary> /// Gets drawing information for a single list item in the list field. /// </summary> /// <param name="listField">The child list field requesting the drawing information.</param> /// <param name="row">The zero-based row number of the list item to draw.</param> /// <param name="itemDrawInfo">An ItemDrawInfo that receives the drawing information.</param> public override void GetItemDrawInfo(ListField listField, int row, ItemDrawInfo itemDrawInfo) { base.GetItemDrawInfo(listField, row, itemDrawInfo); Debug.Assert(ParentShape != null, "ElementListCompartment should be contained in another shape."); if (ParentShape != null) { var ets = ParentShape as EntityTypeShape; Debug.Assert( ets != null, "Expected ElementListCompartment's parent type:EntityTypeShape , Actual:" + ParentShape.GetType().Name); if (ets != null && ets.Diagram != null) { // if the compartment list item is in the EmphasizedShapes list, then set the flag so that the item will be drawn in alternate font. // (The list item's font will be bolded and underlined). if (ets.Diagram.EmphasizedShapes.Contains(new DiagramItem(this, ListField, new ListItemSubField(row)))) { itemDrawInfo.AlternateFont = true; } } } }
void OnGUI() { if(this.ignores == null || this.considers == null || this.functions == null) { this.Init(this.template); } EditorGUILayout.LabelField("CustomTemplate: Edit Tempalte for " + this.template.Extension); GUILayout.Space(20.0f); #region "Validation" EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Setting template's validation"); this.template.validity = (Validater)EditorGUILayout.EnumPopup(this.template.validity); EditorGUILayout.EndHorizontal(); #endregion #region "Label" EditorGUILayout.BeginHorizontal(); this.template.label = EditorGUILayout.TextField("Label for customized", this.template.label); if(GUILayout.Button("Apply")) { this.ChangeLabel(); } EditorGUILayout.EndHorizontal(); #endregion this.ignores.Draw(); this.considers.Draw(); #region "Context" EditorGUILayout.Space(); EditorGUILayout.LabelField("Context of custom template for " + this.template.Extension); this.template.context = EditorGUILayout.TextArea(this.template.context); EditorGUILayout.Space(); #endregion #region "Edit Executor Functions" this.functions.Draw(); if(this.functions.Folding) { EditorGUILayout.Space(); EditorGUI.indentLevel += 1; if(this.efobject == null) { return; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Edit Executor Functions Script", GUILayout.ExpandWidth(false)); if(GUILayout.Button("Open Editor")) { AssetDatabase.OpenAsset(this.efobject); } EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel -= 1; } #endregion #region "Path of Executor Functions Script" GUILayout.Space(5.0f); EditorGUI.BeginDisabledGroup(true); GUILayout.Space(20.0f); EditorGUILayout.TextField("File path", this.efpath); EditorGUI.EndDisabledGroup(); #endregion this.template.ignores = this.ignores.GetValidityList(); this.template.considers = this.considers.GetValidityList(); this.template.functions = this.functions.GetValidityList(); }
/// <summary> /// Gets the drawing information for a particular element in the compartment. /// </summary> /// <param name="listField">The <see cref="ShapeField"/> of this <see cref="ColumnElementListCompartment"/> which /// paints the items in this compartment.</param> /// <param name="row">The index of the array of items whose item drawing information is of interest.</param> /// <param name="itemDrawInfo">A previously initialized <see cref="ItemDrawInfo"/> object whose properties will be modified.</param> public override void GetItemDrawInfo(ListField listField, int row, ItemDrawInfo itemDrawInfo) { base.GetItemDrawInfo(listField, row, itemDrawInfo); Column currentColumn = this.Items[row] as Column; Debug.Assert(currentColumn != null, "An item in the ColumnElementListCompartment is not a column."); if (!currentColumn.IsNullable) { itemDrawInfo.AlternateFont = true; } StringBuilder columnText = new StringBuilder(); bool seenConstraint = false; LinkedElementCollection<UniquenessConstraint> tableUniquenessConstraints = null; Table currentTable = null; foreach (UniquenessConstraint constraint in UniquenessConstraintIncludesColumn.GetUniquenessConstraints(currentColumn)) { if (seenConstraint) { columnText.Append(CommaString); } if (constraint.IsPrimary) { columnText.Append(PrimaryKeyString); } else { if (tableUniquenessConstraints == null) { currentTable = currentColumn.Table; tableUniquenessConstraints = currentTable.UniquenessConstraintCollection; } int constraintNumber = 0; foreach (UniquenessConstraint tableConstraint in tableUniquenessConstraints) { if (!tableConstraint.IsPrimary) { ++constraintNumber; if (tableConstraint == constraint) { break; } } } columnText.AppendFormat(AlternateKeyString, constraintNumber); } seenConstraint = true; } LinkedElementCollection<ReferenceConstraint> tableReferenceConstraints = null; foreach (ColumnReference columnReference in ColumnReference.GetLinksToTargetColumnCollection(currentColumn)) { if (seenConstraint) { columnText.Append(CommaString); } if (tableReferenceConstraints == null) { if (currentTable == null) { currentTable = currentColumn.Table; } tableReferenceConstraints = currentTable.ReferenceConstraintCollection; } columnText.AppendFormat(ForeignKeyString, tableReferenceConstraints.IndexOf(columnReference.ReferenceConstraint) + 1); seenConstraint = true; } if (seenConstraint) { columnText.Append(ColonString); } columnText.Append(currentColumn.Name); if (((RelationalDiagram)this.Diagram).DisplayDataTypes) { columnText.Append(ColonString); columnText.Append(GetDataType(currentColumn.AssociatedValueType)); } itemDrawInfo.Text = columnText.ToString(); }
private void Init(TemplateSet template) { if(template == null) { this.Close(); } this.previousLabel = template.label; this.template = template; Action repaint = () => this.Repaint(); this.ignores = new StringListField("Paths that ignore", repaint, this.template.ignores); this.considers = new StringListField("Paths that consider", repaint, this.template.considers); this.functions = new ListField<ExecutorFunctionSet>("Executor functions", (index, value) => this.GUI4ExecutorFunction(index, value), repaint, this.template.functions); this.functions.ShowHorizontalScrollBar = false; this.efpath = Getters4Editor.GetExecutorFunctionsPath(MetadataHolder.Instance); this.efobject = Getters4Editor.GetExecutorFunctionsObject(MetadataHolder.Instance); this.titleContent.text = "Edit Template"; this.titleContent.tooltip = "Edit Template Window"; }
protected override void ConstructFields() { TableName = "TBL_TESTPERSON"; StoreFlag = StoreFlag.LoadAndStore; m_fldName = new StringField() { Owner = this, FieldName = "PERSON_NAME", Required = true, Size = 50 }; m_fldSex = new StringField() { Owner = this, FieldName = "SEX", Required = true, Size = 1, DataEntryType = DataEntryType.DirectEntryOrLookupWithValidation, LookupType = LookupType.Dictionary }; m_fldSex.LookupDictionary.AddRange(new string[]{"M,Male", "F,Female", "U,Unspecified"}); m_fldRating = new IntField() { Owner = this, FieldName = "RATING", MinMaxChecking = true, MinValue = 0, MaxValue = 10 }; m_fldRegistered = new BoolField() { Owner = this, FieldName = "IS_REGISTERED", Required = true }; m_fldDOB = new DateTimeField() { Owner = this, FieldName = "DOB" }; m_fldSalary = new DecimalField() { Owner = this, FieldName = "PAYROLL_VOLUME", MinMaxChecking = true, MinValue = 0M, MaxValue = Decimal.MaxValue }; //calculated field returns salary * 10 years m_fldDecadeSalary = new DecimalField() { Owner = this, FieldName = "DECADE_SALARY", StoreFlag = StoreFlag.None, DataEntryType = DataEntryType.None, Calculated = true, Formula = "850-10 +(::PAYROLL_VOLUME * 10)" }; m_fldScore = new DoubleField() { Owner = this, FieldName = "SCORE" }; m_fldMovieNames = new ListField<string>() { Owner = this, FieldName = "MOVIES", Required = true }; //ths is business logic-driven computed column for GUI m_fldBusinessCode = new StringField() { Owner = this, FieldName = "BUSINESS_CODE", StoreFlag = StoreFlag.None, DataEntryType = DataEntryType.None }; }