Пример #1
0
        public static ChoNACHAReader LoadText(string inputText, ChoNACHAConfiguration configuration = null)
        {
            var r = new ChoNACHAReader(inputText.ToStream(), configuration);

            r._closeStreamOnDispose = true;

            return(r);
        }
Пример #2
0
        public ChoNACHAReader(StreamReader streamReader, ChoNACHAConfiguration configuration = null)
        {
            ChoGuard.ArgumentNotNull(streamReader, "StreamReader");
            Configuration = configuration;
            Init();

            _streamReader = streamReader;
        }
Пример #3
0
        public ChoNACHAReader(TextReader textReader, ChoNACHAConfiguration configuration = null)
        {
            ChoGuard.ArgumentNotNull(textReader, "TextReader");
            Configuration = configuration;
            Init();

            _textReader = textReader;
        }
Пример #4
0
 private void Init()
 {
     _enumerator = new Lazy <IEnumerator>(() => GetEnumerator());
     if (Configuration == null)
     {
         Configuration = new ChoNACHAConfiguration();
     }
 }
Пример #5
0
        public ChoNACHAReader(Stream inStream, ChoNACHAConfiguration configuration = null)
        {
            ChoGuard.ArgumentNotNull(inStream, "Stream");
            Configuration = configuration;
            Init();

            _streamReader         = new StreamReader(inStream, Configuration.GetEncoding(inStream), false, Configuration.BufferSize);
            _closeStreamOnDispose = true;
        }
Пример #6
0
        public ChoNACHAReader(string filePath, ChoNACHAConfiguration configuration = null)
        {
            ChoGuard.ArgumentNotNullOrEmpty(filePath, "FilePath");
            Configuration = configuration;
            Init();

            _textReader           = new StreamReader(ChoPath.GetFullPath(filePath), Configuration.GetEncoding(filePath), false, Configuration.BufferSize);
            _closeStreamOnDispose = true;
        }
        internal ChoNACHAEntryDetailWriter(ChoManifoldWriter writer, ChoNACHARunningStat batchRunningStatObject, ChoNACHAConfiguration configuration)
        {
            _configuration          = configuration;
            _writer                 = writer;
            _batchRunningStatObject = batchRunningStatObject;

            _entryDetailWriter = new Lazy <bool>(() =>
            {
                WriteEntryDetail();
                return(true);
            });
        }
Пример #8
0
        public ChoNACHAWriter(StreamWriter streamWriter, ChoNACHAConfiguration configuration = null)
        {
            ChoGuard.ArgumentNotNull(streamWriter, "StreamWriter");
            Configuration = configuration;
            if (Configuration == null)
            {
                Configuration = new ChoNACHAConfiguration();
            }
            _streamWriter = streamWriter;

            Init();
        }
Пример #9
0
        public ChoNACHAWriter(TextWriter textWriter, ChoNACHAConfiguration configuration = null)
        {
            ChoGuard.ArgumentNotNull(textWriter, "TextWriter");
            Configuration = configuration;
            if (Configuration == null)
            {
                Configuration = new ChoNACHAConfiguration();
            }
            _textWriter = textWriter;

            Init();
        }
Пример #10
0
        internal ChoNACHABatchWriter(ChoManifoldWriter writer, ChoNACHARunningStat fileRunningStatObject, ChoNACHAConfiguration configuration)
        {
            _configuration          = configuration;
            _writer                 = writer;
            _batchRunningStatObject = new ChoNACHARunningStat();

            _fileRunningStatObject = fileRunningStatObject;
            _batchHeaderWriter     = new Lazy <bool>(() =>
            {
                WriteBatchHeader();
                return(true);
            });
        }
Пример #11
0
        public ChoNACHAWriter(Stream inStream, ChoNACHAConfiguration configuration = null)
        {
            ChoGuard.ArgumentNotNull(inStream, "Stream");
            Configuration = configuration;
            if (Configuration == null)
            {
                Configuration = new ChoNACHAConfiguration();
            }

            _streamWriter         = new StreamWriter(inStream, Configuration.Encoding, Configuration.BufferSize);
            _closeStreamOnDispose = true;

            Init();
        }
Пример #12
0
        public ChoNACHAWriter(string filePath, ChoNACHAConfiguration configuration = null)
        {
            ChoGuard.ArgumentNotNullOrEmpty(filePath, "FilePath");
            Configuration = configuration;
            if (Configuration == null)
            {
                Configuration = new ChoNACHAConfiguration();
            }

            _streamWriter         = new StreamWriter(ChoPath.GetFullPath(filePath), false, Configuration.Encoding, Configuration.BufferSize);
            _closeStreamOnDispose = true;

            Init();
        }
Пример #13
0
        public ChoNACHAReader(Stream inStream, ChoNACHAConfiguration configuration = null)
        {
            ChoGuard.ArgumentNotNull(inStream, "Stream");
            Configuration = configuration;
            Init();

            if (inStream is MemoryStream)
            {
                _textReader = new StreamReader(inStream);
            }
            else
            {
                _textReader = new StreamReader(inStream, Configuration.GetEncoding(inStream), false, Configuration.BufferSize);
            }
        }
Пример #14
0
        public ChoNACHAWriter(Stream inStream, ChoNACHAConfiguration configuration = null)
        {
            ChoGuard.ArgumentNotNull(inStream, "Stream");
            Configuration = configuration;
            if (Configuration == null)
            {
                Configuration = new ChoNACHAConfiguration();
            }

            if (inStream is MemoryStream)
            {
                _textWriter = new StreamWriter(inStream);
            }
            else
            {
                _textWriter = new StreamWriter(inStream, Configuration.Encoding, Configuration.BufferSize);
            }

            Init();
        }
Пример #15
0
        public void Validate(ChoNACHAConfiguration configuration)
        {
            if (!configuration.TurnOffDestinationBankRoutingNumber)
            {
                string immediateDestination = ImmediateDestination.ToNString();
                var    value1 = !immediateDestination.IsNullOrEmpty() && ((immediateDestination.Length == 9 && !immediateDestination.Where(c => !Char.IsDigit(c)).Any()) || (immediateDestination.Length == 10 && immediateDestination[0] == ' ' && !immediateDestination.Skip(1).Where(c => !Char.IsDigit(c)).Any()));
                if (!value1)
                {
                    throw new ChoNACHAException("Invalid ImmediateDestination value found.");
                }
            }

            if (!configuration.TurnOffOriginatingCompanyIdValidation)
            {
                string immediateOrigin = ImmediateOrigin.ToNString();
                var    value2          = !immediateOrigin.IsNullOrEmpty() && ((immediateOrigin.Length == 9 && !immediateOrigin.Where(c => !Char.IsDigit(c)).Any()) || (immediateOrigin.Length == 10 && immediateOrigin[0] == ' ' && !immediateOrigin.Skip(1).Where(c => !Char.IsDigit(c)).Any()) || (immediateOrigin.Length == 10 && !immediateOrigin.Where(c => !Char.IsDigit(c)).Any()));
                if (!value2)
                {
                    throw new ChoNACHAException("Invalid ImmediateOrigin value found.");
                }
            }
        }
Пример #16
0
 public ChoNACHAReader(StringBuilder sb, ChoNACHAConfiguration configuration = null) : this(new StringReader(sb.ToString()), configuration)
 {
 }
Пример #17
0
        public static ChoNACHAReader LoadText(string inputText, Encoding encoding = null, ChoNACHAConfiguration configuration = null, TraceSwitch traceSwitch = null)
        {
            var r = new ChoNACHAReader(inputText.ToStream(encoding), configuration)
            {
                TraceSwitch = traceSwitch == null ? ChoETLFramework.TraceSwitch : traceSwitch
            };

            r._closeStreamOnDispose = true;

            return(r);
        }
Пример #18
0
 public ChoNACHAWriter(StringBuilder sb, ChoNACHAConfiguration configuration = null) : this(new StringWriter(sb), configuration)
 {
 }