public OperationResult GenerateTextFile(string transactionData, string ftpServerRtgs, string ftpUser, string ftpPassword, string fileName) { var op = new OperationResult(); if (string.IsNullOrWhiteSpace(transactionData)) op.AddMessage("Transaction Data is Null"); if (string.IsNullOrWhiteSpace(ftpServerRtgs)) op.AddMessage("Destination Path is Null"); if (string.IsNullOrWhiteSpace(ftpUser)) op.AddMessage("FTP User is Null"); if (string.IsNullOrWhiteSpace(ftpPassword)) op.AddMessage("FTP Password is Null"); if (op.MessageList.Count() > 0) op.Success = false; if (op.Success) { try { var tempFile = AppDomain.CurrentDomain.BaseDirectory + fileName; System.IO.File.WriteAllText(tempFile, transactionData); UploadFileToFTP(tempFile: tempFile, fileName: fileName, ftpServerRtgs: ftpServerRtgs, ftpUser: ftpUser, ftpPassword: ftpPassword, op: op); } catch (Exception ex) { op.Success = false; op.AddMessage(ex.Message); } } return op; }
public void UpdateGeneratedTransactionStatus(string transactionCode, OperationResult op) { try { var outgoingSingleCreditRepository = new OutgoingSingleCreditRepository(connectionString); outgoingSingleCreditRepository.GenerateOutgoingSingleCredit(transactionCode); } catch (Exception ex) { op.Success = false; op.AddMessage(ex.Message); } }