예제 #1
0
        private int Send()
        {
            DAL.Tables.T_SMS sms = new DAL.Tables.T_SMS();
            DataTable        dt  = sms.Open(ConnectionString, " top 100 [ID], [To], [DateTime], [Content]", "IsSent = 0", "[DateTime]");

            if (dt == null)
            {
                log.Write("Send is Fail: Data read fail.");

                return(-1);
            }

            if (dt.Rows.Count == 0)
            {
                return(0);
            }

            int Count = 0;

            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(-1);
            }

            foreach (DataRow dr in dt.Rows)
            {
                SMS.Eucp.Gateway.CallResult Result = segg.Send(dr["To"].ToString(), dr["Content"].ToString());

                if (Result.Code < 0)
                {
                    log.Write("Send is Fail: " + Result.Description);
                }
                else
                {
                    Count++;
                }

                sms.IsSent.Value = true;
                sms.Update(ConnectionString, "[ID] = " + dr["ID"].ToString());

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

            return(Count);
        }
예제 #2
0
        private int Send()
        {
            DAL.Tables.T_SMS sms = new DAL.Tables.T_SMS();
            DataTable dt = sms.Open(ConnectionString, "[ID], [To], [DateTime], [Content]", "IsSent = 0", "[DateTime]");

            if (dt == null)
            {
                log.Write("Send is Fail: Data read fail.");

                return -1;
            }

            if (dt.Rows.Count == 0)
            {
                return 0;
            }

            int Count = 0;

            foreach (DataRow dr in dt.Rows)
            {
                SMS.Eucp.Gateway.CallResult Result = segg.Send(dr["To"].ToString(), dr["Content"].ToString());

                if (Result.Code < 0)
                {
                    log.Write("Send is Fail: " + Result.Description);
                }
                else
                {
                    Count++;
                }

                sms.IsSent.Value = true;
                sms.Update(ConnectionString, "[ID] = " + dr["ID"].ToString());

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

            return Count;
        }