Пример #1
0
        /*
         * Конструктор.
         */
        public DataProcessor(string sourceFileName, string webURL, string webAgentId, string webApiKey, string webApiSecret)
        {
            logLines = new List <string>();

            fileSource = GetFileSource(sourceFileName);

            ToffAPI.setAuthParams(webURL, webAgentId, webApiKey, webApiSecret);
        }
Пример #2
0
        /*
         * Собственно, запуск процессора.
         */
        public void Process()
        {
            if (fileSource != null)
            {
                fileSource.Open();

                IDataRecord dataRecord;

                while ((dataRecord = fileSource.GetNextRecord()) != null)
                {
                    try
                    {
                        ToffLead lead = DataTransformer.MakeToffLead(dataRecord);

                        if (lead != null)
                        {
                            logLines.Add(string.Format(PATTERN_MESSAGE, lead.innOrOgrn, ToffAPI.createApplication(lead)));
                        }
                    }
                    catch (Exception e)
                    {
                        logLines.Add(e.ToString());
                    }
                }

                fileSource.Close();
            }
        }