/// <summary> /// Copy constructor. /// </summary> /// <param name="record"></param> public FeederSystemFixedLengthRecord(FeederSystemFixedLengthRecord record) { FiscalYear = record.FiscalYear; ChartNum = record.ChartNum; Account = record.Account; SubAccount = record.SubAccount; ObjectCode = record.ObjectCode; SubObjectCode = record.SubObjectCode; BalanceType = record.BalanceType; ObjectType = record.ObjectType; FiscalPeriod = record.FiscalPeriod; DocumentType = record.DocumentType; OriginCode = record.OriginCode; DocumentNumber = record.DocumentNumber; LineSequenceNumber = record.LineSequenceNumber; TransactionDescription = record.TransactionDescription; Amount = record.Amount; DebitCreditCode = record.DebitCreditCode; TransactionDate = record.TransactionDate; OrganizationTrackingNumber = record.OrganizationTrackingNumber; ProjectCode = record.ProjectCode; OrganizationReferenceId = record.OrganizationReferenceId; ReferenceTypeCode = record.ReferenceTypeCode; ReferenceOriginCode = record.ReferenceOriginCode; ReferenceNumber = record.ReferenceNumber; ReversalDate = record.ReversalDate; TransactionEncumbranceUpdateCode = record.TransactionEncumbranceUpdateCode; }
public bool WriteFile(string fileName, string devarOrgCode, FeederSystemFixedLengthRecord[] transactionsArray) { var success = false; using (var docStream = new MemoryStream()) { using (var flatFileWriter = new StreamWriter(docStream, Encoding.ASCII)) { var fileWriterEngine = new FileHelperEngine(typeof(FeederSystemFixedLengthRecord)); fileWriterEngine.WriteStream(flatFileWriter, transactionsArray); // Flush contents of fileWriterStream to underlying docStream: flatFileWriter.Flush(); // Upload to SFTP server: _sftpService.UploadStream(docStream, fileName, devarOrgCode); // Upload file to A&FS server. // Save file to cloud: _blobStorageService.PutBlob(docStream, fileName); success = _blobStorageService.Exists(fileName); } return success; } }