Exemple #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
            {
                AutoMaticOpenLottery_Task = new AutoMaticOpenLotteryTask(ConnectionString);
                AutoMaticOpenLottery_Task.Run();
            }
            catch (Exception e)
            {
                new Log("System").Write("AutoMaticOpenLottery_Task 启动失败:" + e.Message);
            }

            try
            {
                OpenTask_Task = new OpenTask(ConnectionString);
                OpenTask_Task.Run();
            }
            catch (Exception e)
            {
                new Log("System").Write("OpenTask_Task 启动失败:" + e.Message);
            }
        }
Exemple #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
            {
                AutoMaticOpenLottery_Task = new AutoMaticOpenLotteryTask(ConnectionString);
                AutoMaticOpenLottery_Task.Run();
            }
            catch (Exception e)
            {
                new Log("System").Write("AutoMaticOpenLottery_Task 启动失败:" + e.Message);
            }

            try
            {
                OpenTask_Task = new OpenTask(ConnectionString);
                OpenTask_Task.Run();
            }
            catch (Exception e)
            {
                new Log("System").Write("OpenTask_Task 启动失败:" + e.Message);
            }
        }