コード例 #1
0
        public void ParseSummary(Prism810Context context, string[] marketFields)
        {
            context.RevertToHeader();
            var current = context.Current;

            if (current == null || current.ModelType != Type810Types.Header)
            {
                throw new InvalidOperationException();
            }

            var header = current as Type810Header;

            if (header == null)
            {
                throw new InvalidOperationException();
            }

            var model = new Type810Summary
            {
                TotalAmount    = marketFields.AtIndex(2),
                TotalLineItems = marketFields.AtIndex(3),
            };

            header.AddSummary(model);
        }
コード例 #2
0
        public void ParseLine(Prism810Context context, string line)
        {
            if (string.IsNullOrWhiteSpace(line))
            {
                return;
            }

            if (line.Length < 2)
            {
                return;
            }

            var indicator    = line.Substring(0, 2);
            var marketFields = line.Split('|');

            switch (indicator)
            {
            case "SH":
                context.ResolveToHeader();
                context.Initialize();
                context.TransactionActualCount++;
                marketFields.TryAtIndex(3, x => context.Alias = x);
                break;

            case "01":
                ParseHeader(context, marketFields);
                break;

            case "10":
                context.RevertToHeader();
                context.FirstCharge = true;
                ParseDetail(context, marketFields);
                break;

            case "40":
                if (context.FirstCharge)
                {
                    ParseDetailItem(context, marketFields);
                    context.FirstCharge = false;
                }
                ParseCharge(context, marketFields);
                break;

            case "45":
                ParseTax(context, marketFields);
                break;

            case "60":
                ParseSummary(context, marketFields);
                break;

            case "TL":
                context.ResolveToHeader();
                marketFields.TryAtIndexInt(1, x => context.TransactionAuditCount = x);
                break;
            }
        }