/// <summary>
        ///
        /// </summary>
        /// <returns>
        /// C_RES_OK : Result OK
        /// C_RES_NOK: Result NOK
        /// </returns>
        public int  TRXAuthorize()
        {
            int             iRslt  = C_RES_NOK;
            string          szFunc = "CS_M8_TRANSAX::TRXAuthorize ";
            ILogger         logger = null;
            TRXRequestInfo  oRequestInfo;
            TRXResponseInfo oResponseInfo;


            if (lockObject == null)
            {
/*
 *
 *  <!-- TRANSAX -->
 *      <!-- DLL Paths needed for Transax libreries -->
 *      <add key = "TransaxDLLPath" value = "C:\Inetpub\OPSServices\Common\WIN32\TRXPayGateDemo" />
 *      <!-- Transax Primary Server -->
 *      <add key = "TrxPrimaryServer" value = "216.130.225.11" />
 *      <!-- Transax Primary Server Port -->
 *      <add key = "TrxPrimaryServerPort" value = "60051" />
 *      <!-- Transax Secundary Server -->
 *      <add key = "TrxSecundaryServer" value = "216.130.225.11" />
 *      <!-- Transax Secundary Server Port -->
 *      <add key = "TrxSecundaryServerPort" value = "60051" />
 *      <!-- Transax Trace Parameter -->
 *      <add key = "TrxTrace" value = "1" />
 * */

                lockObject = new object();

                try
                {
                    System.Configuration.AppSettingsReader appSettings = new System.Configuration.AppSettingsReader();


                    _TRXPrimaryAddress   = (string)appSettings.GetValue("TrxPrimaryServer", typeof(string));
                    _TRXPrimaryPort      = (int)appSettings.GetValue("TrxPrimaryServerPort", typeof(int));
                    _TRXSecondaryAddress = (string)appSettings.GetValue("TrxSecundaryServer", typeof(string));
                    _TRXSecondaryPort    = (int)appSettings.GetValue("TrxSecundaryServerPort", typeof(int));
                    _TRXTrace            = (((int)appSettings.GetValue("TrxTrace", typeof(int))) == 1);


                    string    delimStr            = ";";
                    char []   delimiter           = delimStr.ToCharArray();
                    string [] splitDLLDirectories = null;
                    string    strDLLDirectories   = (string)appSettings.GetValue("TransaxDLLPath", typeof(string));
                    splitDLLDirectories = strDLLDirectories.Split(delimiter);

                    for (int i = 0; i < splitDLLDirectories.Length; i++)
                    {
                        splitDLLDirectories[i] = splitDLLDirectories[i].Trim();
                        if (splitDLLDirectories[i].Length > 0)
                        {
                            SetDllDirectory(splitDLLDirectories[i]);
                        }
                    }
                }
                catch
                {
                }
            }

            try
            {
                logger = DatabaseFactory.Logger;

                oRequestInfo  = new TRXRequestInfo();
                oResponseInfo = new TRXResponseInfo();


                oRequestInfo.mbTRXPrimaryAddress   = _TRXPrimaryAddress;
                oRequestInfo.mbTRXPrimaryPort      = _TRXPrimaryPort;
                oRequestInfo.mbTRXSecondaryAddress = _TRXSecondaryAddress;
                oRequestInfo.mbTRXSecondaryPort    = _TRXSecondaryPort;
                oRequestInfo.mbTRXTerminalUser     = _TRXTerminalUser;
                oRequestInfo.mbTRXTerminalPass     = _TRXTerminalPass;
                oRequestInfo.mbTRXTerminalStore    = _TRXTerminalStore;
                oRequestInfo.mbTRXTerminalStation  = _TRXTerminalStation;
                oRequestInfo.mbTRXRequestId        = _TRXRequestId;
                oRequestInfo.mbTRXRequestInvoice   = _TRXRequestInvoice;
                oRequestInfo.mbTRXRequestAmount    = _TRXRequestAmount;
                oRequestInfo.mbTRXRequestTrack2    = _TRXRequestTrack2;



                lock (lockObject)
                {
                    iRslt = TRXAuthorize(oRequestInfo, ref oResponseInfo, _TRXTrace);
                }

                _TRXResponseOperStatus  = oResponseInfo.TRXResponseOperStatus;
                _TRXResponseId          = oResponseInfo.mbTRXResponseId;
                _TRXResponseTransStatus = oResponseInfo.mbTRXResponseTransStatus;
                _TRXResponseISORespCode = oResponseInfo.mbTRXResponseISORespCode;
                _TRXResponseApproval    = oResponseInfo.mbTRXResponseApproval;
                _TRXResponseBatch       = oResponseInfo.mbTRXResponseBatch;
                _TRXResponseInvoice     = oResponseInfo.mbTRXResponseInvoice;
                _TRXResponseCardName    = oResponseInfo.mbTRXResponseCardName;
                _TRXResponseMaskedPAN   = oResponseInfo.mbTRXResponseMaskedPAN;
                _TRXResponseAmount      = oResponseInfo.mbTRXResponseAmount;
            }
            catch (Exception e)
            {
                Trace.Write(szFunc + e.Message);
                if (logger != null)
                {
                    logger.AddLog(szFunc + e.Message + iRslt.ToString(), LoggerSeverities.Debug);
                }

                iRslt = C_RES_NOK;
            }
            finally
            {
            }

            return(iRslt);
        }
 public static extern int TRXAuthorize(TRXRequestInfo oRequestInfo, ref TRXResponseInfo oResponseInfo, bool m_bLogFile);