ISO8583 encoding data fields I just want to confirm that my ISO8583 format is correct.

Example:

For the data field 35, the length of the data is 36, so I put 36 before the 4842. Then all the data is inserted in a string (dataISO). This dataISO variable is then sent to another function SendISO().

private void btnSend_Click(object sender, RoutedEventArgs e)
{
    string command = cboISOCommand.SelectionBoxItem.ToString();
    string dataISO = "";

    if (command == "Pre-Auth")
    {
        string dataLength = "019A";
        string TPDU = "6001010000";
        string MTI = "0100";
        string BITMAP = "3020078020C00204";
        string ProCode = "380000"; // 3
        string Amount = "000000010000"; // 4
        string STAN = "000031"; // 11
        string POSEM = "051"; // 22
        string PANSequence = "001"; // 23
        string FunctionCode = "101"; // 24
        string ConditionCode = "00"; // 25
        string Track2 = "36484200000000009=15000000000000000000"; //35
        string TerminalID = "00000000"; //41
        string IdentificationCode = "000000000000000"; //42
        string ReservedISO = "2725F2A02045882023C008407A0000000031010950500000080009A031407229C01009F0206000000000010";
        ReservedISO +="9F03060000000000009F0902008C9F100706010A03A0A0029F1A0204589F1E0831313731313534399F26";
        ReservedISO +="081344604C7E2C7B589F2701809F3303E0B0C89F34031E03009F3501229F360204379F3704746733F19F4";
        ReservedISO +="104000000079F530152"; //55
        string ReservedPrivate = "006000019"; //62

        string total = dataLength + TPDU + MTI + BITMAP + ProCode + Amount + STAN + POSEM + PANSequence + FunctionCode + ConditionCode + Track2 + TerminalID + IdentificationCode + ReservedISO + ReservedPrivate;
        dataISO = total;
    }


    _controller.SendISO(client2, dataISO);
}

//To Send ISO Data Over TCP Socket
public void SendISO(TcpClient client, string isoData)
{
    string ip =     ((IPEndPoint)client.Client.RemoteEndPoint).Address.ToString();
    int port = ((IPEndPoint)client.Client.RemoteEndPoint).Port;

    if (!client.Connected)
    {
        OnControllerErrorFunction(
            new ControllerErrorArguments(String.Format("02&lt;&gt; IP {0} Port {1} not Connected", ip, Convert.ToString(port)), "DISCONNECTED"));
        return;
    }
    try
    {
        NetworkStream stream = client.GetStream();

        byte[] byteArray = Encoding.Default.GetBytes(isoData);

        if (stream.CanWrite)
        {
            stream.Write(byteArray, 0, byteArray.Length);
            stream.Flush();

            onControllerRawDataFunction(
                    new ControllerRawArguments(
                        string.Format("Send Controller {0} : {1}", ip, isoData)));
        }
    }
    catch (Exception err)
    {
        OnControllerErrorFunction(
            new ControllerErrorArguments(string.Format("02&lt;&gt;Controller {0} Error on sending data : {1} ", ip, isoData), err.Message));
        WriteSystemLog(err.Message, "Send Data To Controller");
        return;
    }
}


And for the function to send ISO Data over a TCP socket, is it correct in terms of the encoding before sending it using stream.Write?
The capitalization rules say:


  
  Do capitalize both characters of two-character acronyms, except the first word of a camel-cased identifier.
  
  A property named DBRate is an example of a short acronym (DB) used
  as the first word of a Pascal-cased identifier. A parameter named
  ioChannel is an example of a short acronym (IO) used as the first word
  of a camel-cased identifier.
  Do capitalize only the first character of acronyms with three or more characters, except the first word of a camel-cased identifier.
  
  A class named XmlWriter is an example of a long acronym used as the
  first word of a Pascal-cased identifier. A parameter named htmlReader
  is an example of a long acronym used as the first word of a
  camel-cased identifier.
  Do not capitalize any of the characters of any acronyms, whatever their length, at the beginning of a camel-cased identifier.
  
  A parameter named xmlStream is an example of a long acronym (xml)
  used as the first word of a camel-cased identifier. A parameter named
  dbServerName is an example of a short acronym (db) used as the first
  word of a camel-cased identifier.
  


You violate these rules numerous times: dataISO, TPDU, BITMAP, cboISOCommand, SendISO, etc.



What is the point of this:

string dataLength = "019A";
string TPDU = "6001010000";
string MTI = "0100";
string BITMAP = "3020078020C00204";
string ProCode = "380000"; // 3
string Amount = "000000010000"; // 4
string STAN = "000031"; // 11
string POSEM = "051"; // 22
string PANSequence = "001"; // 23
string FunctionCode = "101"; // 24
string ConditionCode = "00"; // 25
string Track2 = "36484200000000009=15000000000000000000"; //35
string TerminalID = "00000000"; //41
string IdentificationCode = "000000000000000"; //42
string ReservedISO = "2725F2A02045882023C008407A0000000031010950500000080009A031407229C01009F0206000000000010";
ReservedISO +="9F03060000000000009F0902008C9F100706010A03A0A0029F1A0204589F1E0831313731313534399F26";
ReservedISO +="081344604C7E2C7B589F2701809F3303E0B0C89F34031E03009F3501229F360204379F3704746733F19F4";
ReservedISO +="104000000079F530152"; //55
string ReservedPrivate = "006000019"; //62

string total = dataLength + TPDU + MTI + BITMAP + ProCode + Amount + STAN + POSEM + PANSequence + FunctionCode + ConditionCode + Track2 + TerminalID + IdentificationCode + ReservedISO + ReservedPrivate;



Are all of those string const? If so, why aren't they defined as such?
The comments make no sense: //55, //42
To me this feels like code that should be in a separate class, with the likes of dataLength, TPDU etc. being properties or const, and total being a get-only property with a more meaningful name.
What is the point of total, considering you immediately assign its value to dataISO?
They're currently all local variables, yet most of them are PascalCase when they should be camelCase.




Is ControllerErrorArguments a class you control? If so: why not have a version with the String.Format() functionality built-in?



Twice you do this cast: (IPEndPoint)client.Client.RemoteEndPoint. Do it once, store it in a variable, use that variable.