Ejemplo n.º 1
0
        public void Run()
        {
            // 已经启动
            if (State == 1)
            {
                return;
            }

            SystemOptions so = new SystemOptions(ConnectionString);

            Betting_SMS_UserID       = so["Betting_SMS_UserID"].Value.ToString();
            Betting_SMS_UserPassword = so["Betting_SMS_UserPassword"].Value.ToString();
            Betting_SMS_RegCode      = so["Betting_SMS_RegCode"].Value.ToString();

            if ((Betting_SMS_UserID == "") || (Betting_SMS_UserPassword == ""))
            {
                State = 0;

                msg.Send("SendSMSTask: SMS config error.");
                log.Write("SendSMSTask: SMS config error.");

                return;
            }

            segg = new SMS.Eucp.Gateway.Gateway(Betting_SMS_UserID, Betting_SMS_UserPassword);

            if (segg == null)
            {
                State = 0;

                msg.Send("SendSMSTask: SMS Gateway open error.");
                log.Write("SendSMSTask: SMS Gateway open error.");

                return;
            }

            if (Betting_SMS_RegCode != "")
            {
                segg.SetKey(Betting_SMS_RegCode);
            }

            lock (this) // 确保临界区被一个 Thread 所占用
            {
                State = 1;

                gCount1 = 0;

                thread = new System.Threading.Thread(new System.Threading.ThreadStart(Do));
                thread.IsBackground = true;

                thread.Start();

                msg.Send("SendSMSTask Start.");
                log.Write("SendSMSTask Start.");
            }
        }
Ejemplo n.º 2
0
        public void Run()
        {
            // 已经启动
            if (State == 1)
            {
                return;
            }

            SystemOptions so = new SystemOptions(ConnectionString);
            Betting_SMS_UserID = so["Betting_SMS_UserID"].Value.ToString();
            Betting_SMS_UserPassword = so["Betting_SMS_UserPassword"].Value.ToString();
            Betting_SMS_RegCode = so["Betting_SMS_RegCode"].Value.ToString();

            if ((Betting_SMS_UserID == "") || (Betting_SMS_UserPassword == ""))
            {
                State = 0;

                msg.Send("SendSMSTask: SMS config error.");
                log.Write("SendSMSTask: SMS config error.");

                return;
            }

            segg = new SMS.Eucp.Gateway.Gateway(Betting_SMS_UserID, Betting_SMS_UserPassword);

            if (segg == null)
            {
                State = 0;

                msg.Send("SendSMSTask: SMS Gateway open error.");
                log.Write("SendSMSTask: SMS Gateway open error.");

                return;
            }

            if (Betting_SMS_RegCode != "")
            {
                segg.SetKey(Betting_SMS_RegCode);
            }

            lock (this) // 确保临界区被一个 Thread 所占用
            {
                State = 1;

                gCount1 = 0;

                thread = new System.Threading.Thread(new System.Threading.ThreadStart(Do));
                thread.IsBackground = true;

                thread.Start();

                msg.Send("SendSMSTask Start.");
                log.Write("SendSMSTask Start.");
            }
        }
Ejemplo n.º 3
0
        public void Run()
        {
            SystemOptions so = new SystemOptions(ConnectionString);

            if (!so["ElectronTicket_HPSH_Status_ON"].ToBoolean(false))
            {
                return;
            }

            if ((ElectronTicket_HPSH_Getway == "") || (ElectronTicket_HPSH_UserName == "") || (ElectronTicket_HPSH_UserPassword == ""))
            {
                msg.Send("ElectronTicket_HPSH Task 参数配置不完整.");
                log.Write("ElectronTicket_HPSH Task 参数配置不完整.");

                return;
            }

            // 已经启动
            if (StateService == 1)
            {
                return;
            }

            lock (this) // 确保临界区被一个 Thread 所占用
            {
                StateService = 1;

                gCount1 = 0;
                gCount2 = 0;
                gCount3 = 0;

                thread = new System.Threading.Thread(new System.Threading.ThreadStart(Do));
                thread.IsBackground = true;

                thread.Start();

                msg.Send("ElectronTicket_HPSH Task Start.");
                log.Write("ElectronTicket_HPSH Task Start.");
            }
        }
Ejemplo n.º 4
0
        public void Run()
        {
            SystemOptions so = new SystemOptions(ConnectionString);

            if (!so["ElectronTicket_HPSH_Status_ON"].ToBoolean(false))
            {
                return;
            }

            if ((ElectronTicket_HPSH_Getway == "") || (ElectronTicket_HPSH_UserName == "") || (ElectronTicket_HPSH_UserPassword == ""))
            {
                msg.Send("ElectronTicket_HPSH Task 参数配置不完整.");
                log.Write("ElectronTicket_HPSH Task 参数配置不完整.");

                return;
            }

            // 已经启动
            if (StateService == 1)
            {
                return;
            }

            lock (this) // 确保临界区被一个 Thread 所占用
            {
                StateService = 1;

                gCount1 = 0;
                gCount2 = 0;
                gCount3 = 0;

                thread = new System.Threading.Thread(new System.Threading.ThreadStart(Do));
                thread.IsBackground = true;

                thread.Start();

                msg.Send("ElectronTicket_HPSH Task Start.");
                log.Write("ElectronTicket_HPSH Task Start.");
            }
        }
Ejemplo n.º 5
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);
            }

            SystemOptions so = new SystemOptions(ConnectionString);

            // 恒朋上海电子票自动任务
            try
            {
                if (so["ElectronTicket_HPSH_Status_ON"].ToBoolean(false) && (new DAL.Tables.T_Lotteries().GetCount(ConnectionString, "PrintOutType = 102") > 0))
                {
                    ElectronTicket_HPSH_Task = new ElectronTicket_HPSH(ConnectionString);

                    ElectronTicket_HPSH_Task.ElectronTicket_HPSH_Getway = so["ElectronTicket_HPSH_Getway"].ToString("");
                    ElectronTicket_HPSH_Task.ElectronTicket_HPSH_UserName = so["ElectronTicket_HPSH_UserName"].ToString("");
                    ElectronTicket_HPSH_Task.ElectronTicket_HPSH_UserPassword = so["ElectronTicket_HPSH_UserPassword"].ToString("");
                    ElectronTicket_HPSH_Task.ElectronTicket_PrintOut_AlipayName = so["ElectronTicket_PrintOut_AlipayName"].ToString("");
                    ElectronTicket_HPSH_Task.ElectronTicket_PrintOut_IDCardNumber = so["ElectronTicket_PrintOut_IDCardNumber"].ToString("");
                    ElectronTicket_HPSH_Task.ElectronTicket_PrintOut_Mobile = so["ElectronTicket_PrintOut_Mobile"].ToString("");
                    ElectronTicket_HPSH_Task.ElectronTicket_PrintOut_RealityName = so["ElectronTicket_PrintOut_RealityName"].ToString("");
                    ElectronTicket_HPSH_Task.ElectronTicket_PrintOut_Email = so["ElectronTicket_PrintOut_Email"].ToString("");

                    ElectronTicket_HPSH_GP_Task = new ElectronTicket_HPSH_GP(ConnectionString);

                    ElectronTicket_HPSH_GP_Task.ElectronTicket_HPSH_Getway = so["ElectronTicket_HPSH_Getway"].ToString("");
                    ElectronTicket_HPSH_GP_Task.ElectronTicket_HPSH_UserName = so["ElectronTicket_HPSH_UserName"].ToString("");
                    ElectronTicket_HPSH_GP_Task.ElectronTicket_HPSH_UserPassword = so["ElectronTicket_HPSH_UserPassword"].ToString("");
                    ElectronTicket_HPSH_GP_Task.ElectronTicket_PrintOut_AlipayName = so["ElectronTicket_PrintOut_AlipayName"].ToString("");
                    ElectronTicket_HPSH_GP_Task.ElectronTicket_PrintOut_IDCardNumber = so["ElectronTicket_PrintOut_IDCardNumber"].ToString("");
                    ElectronTicket_HPSH_GP_Task.ElectronTicket_PrintOut_Mobile = so["ElectronTicket_PrintOut_Mobile"].ToString("");
                    ElectronTicket_HPSH_GP_Task.ElectronTicket_PrintOut_RealityName = so["ElectronTicket_PrintOut_RealityName"].ToString("");
                    ElectronTicket_HPSH_GP_Task.ElectronTicket_PrintOut_Email = so["ElectronTicket_PrintOut_Email"].ToString("");

                    Shove._IO.IniFile ini = new Shove._IO.IniFile(System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
                    ElectronTicket_HPSH_GP_Task.t_Datetime = ini.Read("Options", "DateTime");

                    if ((ElectronTicket_HPSH_Task.ElectronTicket_HPSH_Getway != "") && (ElectronTicket_HPSH_Task.ElectronTicket_HPSH_UserName != "") && (ElectronTicket_HPSH_Task.ElectronTicket_HPSH_UserPassword != ""))
                    {
                        ElectronTicket_HPSH_Task.Run();
                        ElectronTicket_HPSH_GP_Task.Run();
                    }
                }
            }
            catch (Exception e)
            {
                new Log("System").Write("ElectronTicket_HPSH 启动失败:" + e.Message);
            }
        }
Ejemplo n.º 6
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);
            }

            SystemOptions so = new SystemOptions(ConnectionString);

            // 恒朋上海电子票自动任务
            try
            {
                if (so["ElectronTicket_HPSH_Status_ON"].ToBoolean(false) && (new DAL.Tables.T_Lotteries().GetCount(ConnectionString, "PrintOutType = 102") > 0))
                {
                    ElectronTicket_HPSH_Task = new ElectronTicket_HPSH(ConnectionString);

                    ElectronTicket_HPSH_Task.ElectronTicket_HPSH_Getway           = so["ElectronTicket_HPSH_Getway"].ToString("");
                    ElectronTicket_HPSH_Task.ElectronTicket_HPSH_UserName         = so["ElectronTicket_HPSH_UserName"].ToString("");
                    ElectronTicket_HPSH_Task.ElectronTicket_HPSH_UserPassword     = so["ElectronTicket_HPSH_UserPassword"].ToString("");
                    ElectronTicket_HPSH_Task.ElectronTicket_PrintOut_AlipayName   = so["ElectronTicket_PrintOut_AlipayName"].ToString("");
                    ElectronTicket_HPSH_Task.ElectronTicket_PrintOut_IDCardNumber = so["ElectronTicket_PrintOut_IDCardNumber"].ToString("");
                    ElectronTicket_HPSH_Task.ElectronTicket_PrintOut_Mobile       = so["ElectronTicket_PrintOut_Mobile"].ToString("");
                    ElectronTicket_HPSH_Task.ElectronTicket_PrintOut_RealityName  = so["ElectronTicket_PrintOut_RealityName"].ToString("");
                    ElectronTicket_HPSH_Task.ElectronTicket_PrintOut_Email        = so["ElectronTicket_PrintOut_Email"].ToString("");

                    ElectronTicket_HPSH_GP_Task = new ElectronTicket_HPSH_GP(ConnectionString);

                    ElectronTicket_HPSH_GP_Task.ElectronTicket_HPSH_Getway           = so["ElectronTicket_HPSH_Getway"].ToString("");
                    ElectronTicket_HPSH_GP_Task.ElectronTicket_HPSH_UserName         = so["ElectronTicket_HPSH_UserName"].ToString("");
                    ElectronTicket_HPSH_GP_Task.ElectronTicket_HPSH_UserPassword     = so["ElectronTicket_HPSH_UserPassword"].ToString("");
                    ElectronTicket_HPSH_GP_Task.ElectronTicket_PrintOut_AlipayName   = so["ElectronTicket_PrintOut_AlipayName"].ToString("");
                    ElectronTicket_HPSH_GP_Task.ElectronTicket_PrintOut_IDCardNumber = so["ElectronTicket_PrintOut_IDCardNumber"].ToString("");
                    ElectronTicket_HPSH_GP_Task.ElectronTicket_PrintOut_Mobile       = so["ElectronTicket_PrintOut_Mobile"].ToString("");
                    ElectronTicket_HPSH_GP_Task.ElectronTicket_PrintOut_RealityName  = so["ElectronTicket_PrintOut_RealityName"].ToString("");
                    ElectronTicket_HPSH_GP_Task.ElectronTicket_PrintOut_Email        = so["ElectronTicket_PrintOut_Email"].ToString("");

                    Shove._IO.IniFile ini = new Shove._IO.IniFile(System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
                    ElectronTicket_HPSH_GP_Task.t_Datetime = ini.Read("Options", "DateTime");

                    if ((ElectronTicket_HPSH_Task.ElectronTicket_HPSH_Getway != "") && (ElectronTicket_HPSH_Task.ElectronTicket_HPSH_UserName != "") && (ElectronTicket_HPSH_Task.ElectronTicket_HPSH_UserPassword != ""))
                    {
                        ElectronTicket_HPSH_Task.Run();
                        ElectronTicket_HPSH_GP_Task.Run();
                    }
                }
            }
            catch (Exception e)
            {
                new Log("System").Write("ElectronTicket_HPSH 启动失败:" + e.Message);
            }
        }