Exemplo n.º 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();

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

                conn.Close();
            }
            catch (Exception e)
            {
                new Log("Task").Write("数据库连接失败,原因描述: " + e.Message + " | " + e.Source);

                return;
            }

            // 自动任务
            try
            {
                task = new Task(ConnectionString);
                task.Run();
            }
            catch (Exception e)
            {
                new Log("Task").Write("Task 启动失败:" + e.Message);
            }

            //自动任务
            try
            {
                Cpstask = new CpsTask(ConnectionString);
                Cpstask.Run();
            }
            catch (Exception e)
            {
                new Log("System").Write("Cpstask 启动失败:" + e.Message);
            }

        }
Exemplo n.º 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();

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

                conn.Close();
            }
            catch (Exception e)
            {
                new Log("Task").Write("数据库连接失败,原因描述: " + e.Message + " | " + e.Source);

                return;
            }

            // 自动任务
            try
            {
                task = new Task(ConnectionString);
                task.Run();
            }
            catch (Exception e)
            {
                new Log("Task").Write("Task 启动失败:" + e.Message);
            }

            //自动任务
            try
            {
                Cpstask = new CpsTask(ConnectionString);
                Cpstask.Run();
            }
            catch (Exception e)
            {
                new Log("System").Write("Cpstask 启动失败:" + e.Message);
            }
        }