Exemplo n.º 1
0
        public static LineTemplate GetLineTemplateToParseEbcidicDataWithFixedRecordLength()
        {
            var lineTemplate = new LineTemplate(LineSize, TemplateName);

            lineTemplate.AddFieldTemplate(new FieldTemplate(FieldReservationNumber, FieldType.String, startPosition: 0, fieldSize: 11));
            lineTemplate.AddFieldTemplate(new FieldTemplate(FieldCheckInDate, FieldType.DateString, startPosition: 11, fieldSize: 6));
            lineTemplate.AddFieldTemplate(new FieldTemplate(FieldCalcNetAmount, FieldType.BinaryNum, startPosition: 17, fieldSize: 4, decimalPlaces: 2));
            lineTemplate.AddFieldTemplate(new FieldTemplate(FieldCustomerName, FieldType.String, startPosition: 21, fieldSize: 30));
            lineTemplate.AddFieldTemplate(new FieldTemplate(FieldRunDate, FieldType.DateStringMMDDYY, startPosition: 51, fieldSize: 6));
            lineTemplate.AddFieldTemplate(new FieldTemplate(FieldCurrencyConvRate, FieldType.Packed, startPosition: 57, fieldSize: 6, decimalPlaces: 6));
            lineTemplate.AddFieldTemplate(new FieldTemplate(FieldUsDollarAmountDue, FieldType.Packed, startPosition: 63, fieldSize: 6, decimalPlaces: 2));
            lineTemplate.AddFieldTemplate(new FieldTemplate(FieldDateOfBirth, FieldType.PackedDate, startPosition: 69, fieldSize: 4));
            return(lineTemplate);
        }
Exemplo n.º 2
0
        public void Used_For_Manual_Testing()
        {
            var lineBytes    = ParserUtilities.ConvertHexStringToByteArray("F1-F5-F0-F1-F2-F3");
            var lineTemplate = new LineTemplate(lineBytes.Length);
            var fieldName    = "TEST_ITEM";

            lineTemplate.AddFieldTemplate(
                new FieldTemplate(
                    fieldName: fieldName,
                    fieldType: FieldType.DateString,
                    startPosition: 0,
                    fieldSize: lineBytes.Length,
                    decimalPlaces: 0));

            var processor = new EbcdicParser();

            var parsedLine = processor.ParseSingleLine(lineTemplate, lineBytes);

            var testOutput = parsedLine[fieldName];

            Debug.WriteLine(parsedLine.ToXmlString());
        }