C Sharp Snippet Guide

using System.Windows.Forms;
using System.Collections.Generic;

public class Test 
{ 
    string mSessionID = ""; 
    string mLogText = ""; 
    
    public void SendAndReceive() 
    { 
        netEDI.netEDIcoms.netEDINetwork netEDIService = new netEDI.netEDIcoms.netEDINetwork(); 
        netEDIService.StatusUpdate += CommunicationLog; 
        { 
            if (netEDIService.Login("netEDI.net", "netedi.LTD66")) { 
                mSessionID = netEDIService.SessionID; 
                //Store the session ID 
                //Loop round your list of files to send 
                if (netEDIService.IsEDIFile("testedi.txt")) { 
                    //if file is EDI use the Upload function 
                    if (netEDIService.Upload("testedi.txt")) { 
                    } 
                    else { 
                        //Flag the file in your system as sent 
                        //report error to log file and mark file in your system as unsent 
                        MessageBox.Show(netEDIService.LastError); 
                    } 
                } 
                else { 
                    //if non-edi file use the UploadEx function to send directly to a Mailbox on the netEDI network 
                    if (netEDIService.UploadEx("Local Path & Filename", "GLN/Other ID", "Qualifer if req.")) { 
                    } 
                    else { 
                        //Flag the file in your system as sent 
                        //report error to log file and mark file in your system as unsent 
                        MessageBox.Show(netEDIService.LastError); 
                    } 
                } 
                //end of loop around files to send 
                List
 Files = default(List); 
                //Holds a list of Files 
                Files = netEDIService.List(); 
                //List Files for Download 
                if (Files.Count > 0) { 
                    //Files to Download 
                    foreach (netEDI.netEDIcoms.netEDIFile objFile in Files) { 
                        if (netEDIService.Download(objFile.ID, objFile.ID + ".edi")) { 
                            //Download the EDI file to the file using the Network File ID 
                                //Marks the file as downloaded on the network 
                            netEDIService.DownloadOK(); 
                        } 
                        else { 
                            //report error with download 
                            MessageBox.Show(netEDIService.LastError); 
                        } 
                    } 
                } 
            } 
            else { 
                //Log error with login 
                MessageBox.Show(netEDIService.LastError); 
            } 
            //logout from the service 
            netEDIService.Logout(); 
            WriteLog(); 
        } 
    } 
    
    private void CommunicationLog(string Description) 
    { 
        //Display the Description of events on screen to the user and/or write them to a log file 
        mLogText += Description + ControlChars.CrLf; 
    } 
    
    private void WriteLog() 
    { 
        //Store the log to file 
        if (!string.IsNullOrEmpty(mSessionID)) { 
            System.IO.StreamWriter objStream = new System.IO.StreamWriter(mSessionID + ".log"); 
            objStream.Write(mLogText); 
            objStream.Close(); 
        } 
    } 
    
}