/// <summary> /// Implemantation of ITransactionRouter /// </summary> /// <param name="transactionFile">TransactionFile</param> public void SubmitTransactionFile(TransactionFileItem transactionFile) { if (!transactionFile.IsZip || HandleZipFile(transactionFile.File, transactionFile.FileName)) { FilterFile(transactionFile.File, transactionFile.FileName); } }
/// <summary> /// Moves the file to queue. /// </summary> /// <param name="fullPath">The full path.</param> /// <remarks></remarks> private void MoveFileToQueue(string fullPath) { _logger.InfoFormat("Moving File {0} to queue", fullPath); if (fullPath.Trim().EndsWith(".part")) { Thread.Sleep(50); UpdateBackLog(); return; } var clt = new TransactionRouterClient(); try { if (CheckFileRestrictions(fullPath)) { var newFile = new TransactionFileItem { IsZip = CheckFileHelper.IsFileAZip(fullPath), File = File.ReadAllBytes(fullPath), FileName = Path.GetFileName(fullPath) }; using (var scope = new TransactionScope(TransactionScopeOption.Required)) { clt.SubmitTransactionFile(newFile); scope.Complete(); File.Move(fullPath, File.Exists(Path.Combine(FileWatcherConfigurationHelper.ReceivedPath, Path.GetFileName(fullPath))) ? Path.Combine(FileWatcherConfigurationHelper.ReceivedPath, Path.GetFileName(fullPath)) : Path.Combine(FileWatcherConfigurationHelper.ReceivedPath, Path.GetFileName(fullPath) + "_" + DateTime.Now.ToFileTimeUtc())); UpdateBackLog(); } } else { File.Move(fullPath, File.Exists(Path.Combine(FileWatcherConfigurationHelper.ErrorPath, Path.GetFileName(fullPath))) ? Path.Combine(FileWatcherConfigurationHelper.ErrorPath, Path.GetFileName(fullPath)) : Path.Combine(FileWatcherConfigurationHelper.ErrorPath, Path.GetFileName(fullPath) + "_" + DateTime.Now.ToFileTimeUtc())); UpdateBackLog(); } } catch (Exception ex) { _logger.ErrorFormat(ex.Message); } finally { clt.Close(); } }
public void SubmitTransactionFile(TransactionFileItem transactionFile) { try { _logger.InfoFormat("Received SubmitTransactionFile Request"); _fact .CreateRouter() .SubmitTransactionFile(transactionFile); } catch (Exception ex) { string s = ex.InnerException == null ? ex.Message : ex.InnerException.Message; _logger.ErrorFormat(s); } }
public void SubmitTransactionFile(TransactionFileItem transactionFile) { Client.SubmitTransactionFile(transactionFile); }