Esempio n. 1
0
 public SystemEventLogging()
 {
     _eventLog = new EventLog();
     _eventLog.BeginInit();
     _eventLog.Log = "ВИРД";
     _eventLog.Source = "ВИРД";
     _eventLog.EndInit();
 }
Esempio n. 2
0
 private EventLogWriter( )
 {
     evLog = new EventLog();
     evLog.BeginInit();
     evLog.Log = "Application";
     evLog.Source = "ShareIndexService";
     evLog.EndInit();
 }
        private void MainThread()
        {
            eventLog1.BeginInit();

            DataRow dr      = null;
            bool    bLogged = false;

            TvMain = new STKTVMain.TVMain();

            try
            {
                if (TvMain.Init() == true)
                {
                    bLogged = true;
                }
                else
                {
                    WarningReport("Unable to login, check credentials");
                    InfoReport(TvMain.GetEnvInfo());
                    return;
                }
            }
            catch (Exception Ex)
            {
                ErrorReport("Login failed, try again... " + Ex.Message);
                InfoReport(TvMain.GetEnvInfo());
            }

            //InfoReport("DB Initialization OK");
            System.Data.DataTable oRS;
            if (bLogged)
            {
                oRS = null;
                String q;
                q = "select plancall.*,npip,nppassword,ipport,transport,sysdate ServerDate from bdevices join plancall on bdevices.id_bd=plancall.id_bd where  ( nplock is null or nplock <sysdate ) and npquery=1 " +
                    " and bdevices.id_bd=" + DivID.ToString() + " ";
                oRS = TvMain.QuerySelect(q);
                if (oRS != null)
                {
                    if (oRS.Rows.Count > 0)
                    {
                        try
                        {
                            dr = oRS.Rows[0];
                            DeviceThread(dr);
                        }
                        catch (Exception Ex)
                        {
                            ErrorReport("Прибор ID=  " + DivID.ToString() + " error:" + Ex.Message);
                            dr = null;
                        }
                    }
                    oRS = null;
                }



                try
                {
                    //InfoReport("Closing Device thread...");

                    //dr = null;

                    TvMain.ClearDuration();
                    // close transport
                    TvMain.DeviceClose();
                    TvMain.CloseDBConnection();
                    TvMain = null;
                    eventLog1.Dispose();
                    return;
                }
                catch (Exception Ex)
                {
                    ErrorReport("Closing DeviceThread error:" + Ex.Message);
                }
            }
        }