示例#1
0
        private IField ReadFieldFromTable(DataRow dr, string elementName, SortedList <string, int> bitmapLows, SortedList <string, int> bitmapHighs)
        {
            FieldLength length;

            Enum.TryParse <FieldLength>((string)dr["FieldLength"], out length);
            FieldFormat format;

            Enum.TryParse <FieldFormat>((string)dr["FieldFormat"], out format);
            Messages.Core.Field.Empty empty;
            if (elementName != "Group" && Convert.ToBoolean(dr["Bitmap"]))
            {
                if (Convert.ToBoolean(dr["HexBitmap"]))
                {
                    empty = new BitmapHex(Convert.ToInt32(dr["BitmapFirst"]));
                }
                else
                {
                    empty = new Bitmap(Convert.ToInt32(dr["BitmapFirst"]));
                }
                bitmapLows.Add((string)dr[elementName], Convert.ToInt32(dr["BitmapStartRange"]));
                bitmapHighs.Add((string)dr[elementName], Convert.ToInt32(dr["BitmapEndRange"]));
            }
            else
            {
                empty = new Messages.Core.Field.Empty();
            }
            empty.Configure((string)dr[elementName], Convert.ToInt32(dr["Size"]), Convert.ToInt32(dr["Number"]), length, format, FormatHelpers.GetFormatter((string)dr["Formatter"]), ValidatorHelpers.GetValidator((string)dr["Validator"]), ParserHelpers.GetParser((string)dr["Parser"]));
            return(empty);
        }
示例#2
0
 public IField Configure(string Name, int Size, int Number, FieldLength Length, FieldFormat Format)
 {
     this.Init(Name, Size, Number, Length, Format, FormatHelpers.GetFormatter(Length), ValidatorHelpers.GetValidator(Format), ParserHelpers.GetParser(Length));
     return(this);
 }