Beispiel #1
0
        public X9_Deposit()
        {
            bundles           = new List <X9_Bundle>();
            cashLetterHeader  = new CashLetterHeaderRecord();
            cashLetterControl = new CashLetterControlRecord();
            records           = new Dictionary <CashLetterHeaderRecord, CashLetterControlRecord>();

            cashLetterHeader  = new CashLetterHeaderRecord(1);
            cashLetterControl = new CashLetterControlRecord(1, 0, 0, 1);
            addRecords();
        }
        public static ItemAcknowledgement FromString(StreamReader reader)
        {
            var result = new ItemAcknowledgement();

            // first line should be header record
            var line = reader.ReadLine();

            if (line == null || line.Substring(0, 2) != ItemRecordTypes.FileHeaderRecord)
            {
                throw new ArgumentException("stream bad format");
            }

            result.Header = FileHeaderRecord.FromString(line);

            while ((line = reader.ReadLine()) != null)
            {
                var type = line.Substring(0, 2);

                if (type == ItemRecordTypes.CashLetterHeaderRecord)
                {
                    result.CashLetters.Add(new CashLetterRecord());

                    var header = CashLetterHeaderRecord.FromString(line);
                    result.CashLetters.Last().Header = header;
                }
                else if (type == ItemRecordTypes.ItemDetailRecord)
                {
                    var item = ItemDetailRecord.FromString(line);
                    result.CashLetters.Last().Details.Add(item);
                }
                else if (type == ItemRecordTypes.ItemDetailAddendumRecord)
                {
                    var addendum = ItemDetailAddendumRecord.FromString(line);
                    result.CashLetters.Last().Details.Last().Addendums.Add(addendum);
                }
                else if (type == ItemRecordTypes.CashLetterControlRecord)
                {
                    var control = CashLetterControlRecord.FromString(line);
                    result.CashLetters.Last().Control = control;
                }
                else if (type == ItemRecordTypes.FileControlRecord)
                {
                    result.Control = FileControlRecord.FromString(line);
                }
            }

            return(result);
        }
Beispiel #3
0
 public void addRecords(CashLetterHeaderRecord clHeader, CashLetterControlRecord clControl)
 {
     records.Add(clHeader, clControl);
 }