Пример #1
0
        public SrvTrans()
        {
            InitializeComponent();

            //Service 偵錯的方法
            System.Diagnostics.Debugger.Launch();

            //string path = Environment.CurrentDirectory;

            //FtpDownload();

            //oDal.CommandText = "select * from StationData ";

            //DataTable dt = new DataTable();
            //dt = oDal.DataTable();

            //string sMachineName = Environment.MachineName;
            string sLog = "M10ServiceLog";
            string sSource = "M10ServiceLog";

            try
            {
                ODAL oDal = new ODAL(Properties.Settings.Default.DBConnectionString);

                if (!System.Diagnostics.EventLog.SourceExists(sSource))
                {
                    System.Diagnostics.EventLog.CreateEventSource(sSource, sLog);
                }

                eventLog1.Source = sSource;

                eventLog1.WriteEntry("Start Service");

                //相關建立資料夾
                if (!Directory.Exists(folderBack)) Directory.CreateDirectory(folderBack);
                if (!Directory.Exists(folderName)) Directory.CreateDirectory(folderName);

            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #2
0
        public RtiProc(string ver, string station, string delaytime, string sConnectionString,string type)
        {
            sver = ver;
            sstation = station;
            sdelaytime = delaytime;
            stype = type;

            oDal = new ODAL(sConnectionString);
            buildtableRTI();
        }