Beispiel #1
0
        protected override void OnStart(string[] args)
        {
            try
            {
                System.Data.SqlClient.SqlConnection conn = Shove.Database.MSSQL.CreateDataConnection <System.Data.SqlClient.SqlConnection>(ConnectionString);

                while (conn.State != ConnectionState.Open)
                {
                    conn.Open();

                    new Log("System").Write("数据库连接失败");

                    System.Threading.Thread.Sleep(1000);
                }

                conn.Close();
            }
            catch (Exception e)
            {
                new Log("System").Write(e.Message);
            }

            // 自动任务
            try
            {
                task = new Task(ConnectionString);

                task.Run();
            }
            catch (Exception e)
            {
                new Log("System").Write("Task 启动失败:" + e.Message);
            }

            // 发送短信任务
            try
            {
                SendSms_Task = new SendSMSTask(ConnectionString);

                SendSms_Task.Run();
            }
            catch (Exception e)
            {
                new Log("System").Write("SendSMSTask 启动失败:" + e.Message);
            }
        }
Beispiel #2
0
        protected override void OnStart(string[] args)
        {
            try
            {
                System.Data.SqlClient.SqlConnection conn = Shove.Database.MSSQL.CreateDataConnection<System.Data.SqlClient.SqlConnection>(ConnectionString);

                while (conn.State != ConnectionState.Open)
                {
                    conn.Open();

                    new Log("System").Write("数据库连接失败");

                    System.Threading.Thread.Sleep(1000);
                }

                conn.Close();
            }
            catch (Exception e)
            {
                new Log("System").Write(e.Message);
            }

            // 自动任务
            try
            {
                task = new Task(ConnectionString);

                task.Run();
            }
            catch (Exception e)
            {
                new Log("System").Write("Task 启动失败:" + e.Message);
            }

            // 发送短信任务
            try
            {
                SendSms_Task = new SendSMSTask(ConnectionString);

                SendSms_Task.Run();
            }
            catch (Exception e)
            {
                new Log("System").Write("SendSMSTask 启动失败:" + e.Message);
            }
        }