protected void Dispose(bool Diposing)
        {
            if (!IsDisposed)
            {
                if (Diposing)
                {
                    //Clean Up managed resources
                    mRunn                = false;
                    mShutdown            = true;
                    mArgumentPort.IsIdle = true;
                    if ((mThread != null) && (mThread.ThreadState == ThreadState.Running))
                    {
                        mThread.Abort();
                    }
                    Thread.Sleep(5);
                    if (IsOpen())
                    {
                        ClosePort();
                    }

                    mLog = null;
                    //fMain = null;
                    tc = null;
                    //if(mSp!=null)
                    //    mSp.Dispose();
                    mSp  = null;
                    mStm = null;
                }
                //Clean up unmanaged resources
            }
            IsDisposed = true;
        }
        public bool OpenDyns(string pStrSQL, string pTableName, ref DataSet pDataSet)
        {
            OracleDataAdapter oda;
            DataSet           ds = new DataSet();
            bool vCheck          = false;

            if (mConnect)
            {
                try
                {
                    oda = new OracleDataAdapter(pStrSQL, mConnOracle);
                    oda.Fill(ds, pTableName);
                    pDataSet = ds;
                    CheckExecute(true);
                    vCheck = true;
                }
                catch (Exception exp)
                {
                    CheckExecute(vCheck);
                    clogfile p = new clogfile();
                    mLog.WriteErrLog("Cannot open [" + pStrSQL + "]");
                    mLog.WriteErrLog(exp.Message);
                }
                ds  = null;
                oda = null;
            }
            return(vCheck);
        }
Exemple #3
0
 protected void Dispose(bool Diposing)
 {
     if (!IsDisposed)
     {
         if (Diposing)
         {
             //Clean Up managed resources
             WriteLogCardReader("<-------------System offline------------->");
             if (mCardReader != null)
             {
                 foreach (cCardReader c in this.mCardReader)
                 {
                     if (c != null)
                     {
                         c.Dispose();
                         Thread.Sleep(100);
                     }
                 }
             }
             mCardReader = null;
             if (mPort != null)
             {
                 mPort.Dispose();
             }
             mPort = null;
             mLog  = null;
         }
         //Clean up unmanaged resources
     }
     IsDisposed = true;
 }
 public cPorts(frmCRBay f, cCRProcess pCRProcess)
 {
     //fMain = new frmMain();
     mFMercury  = f;
     mLog       = new clogfile();
     mCRPRocess = pCRProcess;
     //Addlistbox("Initial ports...");
     //StartThread();
 }
 public cOracle(frmCRBay f)
 {
     //fMain = new frmMain();
     mFMercury = f;
     //mConnOracle = new OracleConnection();
     mLog       = new clogfile();
     mIni       = new IniLib.CINI();
     mCurrentDB = DB_TYPE.DB_None;
     //ScanDatabase();
     StartThread();
 }
 public void Close()
 {
     mShutdown = true;
     Thread.Sleep(500);
     if (mConnOracle != null)
     {
         try
         {
             mConnOracle.Close();
             mConnOracle = null;
             //fMercury = null;
             mLog = null;
         }
         catch (Exception exp) { }
     }
 }
        bool Connect()
        {
            string vMsg;

            //mConnOracle = new OracleConnection(mCnnStrMaster);
            switch (mCurrentDB)
            {
            case DB_TYPE.DB_MASTER:
                //vMsg = ">Database Connect-> Master";
                mConnOracle = new OracleConnection(mCnnStrMaster);
                break;

            case DB_TYPE.DB_SUBMASTER:
                //vMsg = ">Database Connect-> Submaster";
                mConnOracle = new OracleConnection(mCnnStrSubMaster);
                break;

            default:
                //vMsg = ">Database Connect-> NONE";
                break;
            }
            //Addlistbox(vMsg);
            try
            {
                mConnOracle.Open();
                mConnect = true;
                mLog     = new clogfile();
                Addlistbox(">" + GetConnectDBName());
                Addlistbox(">Database connect successful.");
                return(true);
            }
            catch (Exception exp)
            {
                mConnect = false;
                mRunn    = false;
                StartThread();
                return(false);
            }
        }
Exemple #8
0
 public cCRProcess(frmCRBay f)
 {
     mLog      = new clogfile();
     mFMercury = f;
     //PPort = new cPorts(fMercury);
 }