public static List <DocumentReceiveLog> GetFilesForParsing(ISession session, params string[] filePaths)
        {
            var client     = TestClient.Create(session);
            var supplier   = TestSupplier.Create(session);
            var resultList = new List <uint>();

            foreach (var filePath in filePaths)
            {
                var file = filePath;
                if (!File.Exists(file))
                {
                    file = Path.Combine(@"..\..\Data\Waybills\multifile", filePath);
                }

                var log = new TestDocumentLog(supplier, client, Path.GetFileName(filePath));
                session.Save(log);
                resultList.Add(log.Id);
                var clientDir   = Path.Combine(Settings.Default.DocumentPath, log.Address.Id.ToString().PadLeft(3, '0'));
                var documentDir = Path.Combine(clientDir, DocumentType.Waybill + "s");
                var name        = String.Format("{0}_{1}({2}){3}",
                                                log.Id,
                                                supplier.Name,
                                                Path.GetFileNameWithoutExtension(file),
                                                Path.GetExtension(file));

                Common.Tools.FileHelper.CreateDirectoryRecursive(documentDir);
                File.Copy(file, Path.Combine(documentDir, name));
            }
            return(DocumentReceiveLog.LoadByIds(resultList.ToArray()));
        }
        public uint[] ParseWaybill(uint[] ids)
        {
            try {
                using (var scope = new TransactionScope(OnDispose.Rollback)) {
                    var result = ParseWaybills(DocumentReceiveLog.LoadByIds(ids))
                                 .Select(d => d.Id)
                                 .ToArray();

                    scope.VoteCommit();
                    return(result);
                }
            } catch (Exception e) {
                _log.Error(string.Format("Ошибка при разборе накладных {0}", ids.Implode()), e);
            }
            return(new uint[0]);
        }