public FixedField AddFixedField(FixedField fixedField) { FixedField result = fixedField; fields.Add(fixedField); return(result); }
protected void ProcessFields(XmlNode node, FixedSpecification fs) { string description = ""; string startPosition = ""; string type = ""; string length = ""; string isMandatory = ""; string isIdRow = ""; string idValue = ""; string fieldname = ""; string MaxGroup = ""; string GroupIsMandatory = ""; string UnderGroup = ""; foreach (XmlNode childNode in node.ChildNodes) { fieldname = ""; description = ""; startPosition = ""; type = ""; length = ""; isMandatory = ""; isIdRow = ""; idValue = ""; MaxGroup = ""; GroupIsMandatory = ""; UnderGroup = ""; foreach (XmlAttribute xa in childNode.Attributes) { if (xa.Name == "fieldname") { fieldname = xa.Value; } if (xa.Name == "description") { description = xa.Value; } else if (xa.Name == "startposition") { startPosition = xa.Value; } else if (xa.Name == "type") { type = xa.Value; } else if (xa.Name == "length") { length = xa.Value; } else if (xa.Name == "ismandatory") { isMandatory = xa.Value; } else if (xa.Name == "isidrow") { isIdRow = xa.Value; } else if (xa.Name == "idvalue") { idValue = xa.Value; } else if (xa.Name == "maxgroup") { MaxGroup = xa.Value; } else if (xa.Name == "groupismandatory") { GroupIsMandatory = xa.Value; } else if (xa.Name == "undergroup") { UnderGroup = xa.Value; } } // Start creating the Fields FieldType ft = null; int fieldLength = 0; if (int.TryParse(length, out fieldLength)) { if (type == "S") { ft = new FieldStringType(fieldLength); } else if (type == "N") { ft = new FieldNumericType(fieldLength); } else if (type == "B") { ft = new FieldBooleanType(); } } int fieldStartPosition = 0; if (int.TryParse(startPosition, out fieldStartPosition)) { } int fieldlength = 0; if (int.TryParse(length, out fieldlength)) { } int fieldMaxGroup = 0; if (int.TryParse(MaxGroup, out fieldMaxGroup)) { } bool fieldGroupIsMandatory = false; if (GroupIsMandatory == "1") { fieldGroupIsMandatory = true; } bool fieldIsMandatory = false; if (isMandatory == "1") { fieldIsMandatory = true; } bool fieldIsIdRow = false; if (isIdRow == "1") { fieldIsIdRow = true; } bool fieldMainKey = false; bool fieldAlternativeKey = false; FixedField ff = new FixedField(childNode.Name, fieldname, description, type, fieldStartPosition, fieldLength, ft, fieldIsMandatory, fieldIsIdRow, fieldMainKey, fieldAlternativeKey, idValue, fieldMaxGroup, fieldGroupIsMandatory, UnderGroup); fs.AddFixedField(ff); } }