Hi my actual code is like this i am little bit confused where to merge
public bool saveBatchHeader(string m_strPath)
{
bool m_flag = true;
string Filename = m_strPath;
string m_strDate = DateTime.Now.ToString("MM/dd/yyyy");
m_strDate = m_strDate.Replace("/", "");
if (m_strStandardEntryClassCode == "PPD")
{
m_strPath += "/PPD_BatchHeader_" + m_strDate + ".txt";
if (File.Exists(m_strPath))
{
int index = 1;
Filename += "/PPD_BatchHeader_" + index + "_" + m_strDate + ".txt";
while (File.Exists(Filename))
{
string strFilePath;
strFilePath = Directory.GetCurrentDirectory();
strFilePath = Directory.GetParent(strFilePath).ToString();
strFilePath = Directory.GetParent(strFilePath).ToString();
strFilePath = strFilePath + "\\ACH\\";
Filename = strFilePath + "/PPD_BatchHeader_" + ++index + "_" + m_strDate + ".txt";
}
using (TextWriter tw = new StreamWriter(Filename))
{
tw.Write(m_strRecordTypeCode.PadLeft(1, '0'));
tw.Write(m_strServiceClassCode.PadLeft(3, '0'));
tw.Write(m_strCompanyName.PadRight(16, ' '));
tw.Write(m_strCompanyDiscretionaryData.PadRight(20, ' '));
tw.Write(m_strCompanyIdentification.PadRight(10, ' '));
tw.Write(m_strStandardEntryClassCode.PadRight(3, ' '));
tw.Write(m_strCompanyEntryDescription.PadRight(10, ' '));
tw.Write(m_strCompanyDescriptiveDate.PadLeft(6, '0'));
string m_strEffDate = m_strEffectiveEntryDate.Replace("/", "");
tw.Write(m_strEffDate.PadLeft(6, '0'));
tw.Write(m_strJulianDate.PadRight(3, ' '));
tw.Write(m_strOriginatorStatusCode.PadRight(1, ' '));
tw.Write(m_strOriginationDFIIdentification.PadLeft(8, '0'));
tw.Write(m_strBatchNumber.PadLeft(7, '0'));
tw.Flush();
tw.Close();
}
}
}
else
{
m_strPath += "/CCD_BatchHeader_" + m_strDate + ".txt";
if (File.Exists(m_strPath))
{
int index = 1;
Filename += "/CCD_BatchHeader_" + index + "_" + m_strDate + ".txt";
while (File.Exists(Filename))
{
string strFilePath;
strFilePath = Directory.GetCurrentDirectory();
strFilePath = Directory.GetParent(strFilePath).ToString();
strFilePath = Directory.GetParent(strFilePath).ToString();
strFilePath = strFilePath + "\\ACH\\";
Filename = strFilePath + "/CCD_BatchHeader_" + ++index + "_" + m_strDate + ".txt";
}
using (TextWriter tw = new StreamWriter(Filename))
{
tw.Write(m_strRecordTypeCode.PadLeft(1, '0'));
tw.Write(m_strServiceClassCode.PadLeft(3, '0'));
tw.Write(m_strCompanyName.PadRight(16, ' '));
tw.Write(m_strCompanyDiscretionaryData.PadRight(20, ' '));
tw.Write(m_strCompanyIdentification.PadRight(10, ' '));
tw.Write(m_strStandardEntryClassCode.PadRight(3, ' '));
tw.Write(m_strCompanyEntryDescription.PadRight(10, ' '));
tw.Write(m_strCompanyDescriptiveDate.PadLeft(6, '0'));
string m_strEffDate = m_strEffectiveEntryDate.Replace("/", "");
tw.Write(m_strEffDate.PadLeft(6, '0'));
tw.Write(m_strJulianDate.PadRight(3, ' '));
tw.Write(m_strOriginatorStatusCode.PadRight(1, ' '));
tw.Write(m_strOriginationDFIIdentification.PadLeft(8, '0'));
tw.Write(m_strBatchNumber.PadLeft(7, '0'));
tw.Flush();
tw.Close();
}
}
}
if (!(File.Exists(m_strPath)))
{
using (TextWriter tw = new StreamWriter(m_strPath))
{
tw.Write(m_strRecordTypeCode.PadLeft(1, '0'));
tw.Write(m_strServiceClassCode.PadLeft(3, '0'));
tw.Write(m_strCompanyName.PadRight(16, ' '));
tw.Write(m_strCompanyDiscretionaryData.PadRight(20, ' '));
tw.Write(m_strCompanyIdentification.PadRight(10, ' '));
tw.Write(m_strStandardEntryClassCode.PadRight(3, ' '));
tw.Write(m_strCompanyEntryDescription.PadRight(10, ' '));
tw.Write(m_strCompanyDescriptiveDate.PadLeft(6, '0'));
string m_strEffDate = m_strEffectiveEntryDate.Replace("/", "");
tw.Write(m_strEffDate.PadLeft(6, '0'));
tw.Write(m_strJulianDate.PadRight(3, ' '));
tw.Write(m_strOriginatorStatusCode.PadRight(1, ' '));
tw.Write(m_strOriginationDFIIdentification.PadLeft(8, '0'));
tw.Write(m_strBatchNumber.PadLeft(7, '0'));
tw.Flush();
tw.Close();
}
}
return m_flag;
}
So how to merge those files