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.");
            }
        }