Exemplo n.º 1
0
        public SendSmsResult SendSms(SmsBase sms)
        {
            try
            {
                var paramsUrlStr = UrlHelper.BuildQuery(sms.Render.ReplaceVariables, "utf8");
                var getUrl       = sms.SendUrl + "?" + paramsUrlStr;
                var getString    = UrlHelper.HttpGet(getUrl);
                //var getString = "";

                var xmlContents = CharHelper.GetLookupTable(getString);

                foreach (KeyValuePair <string, string> kv in xmlContents)
                {
                    if (kv.Key.Equals("reason") && kv.Value.Equals("操作成功"))
                    {
                        return(SendSmsResult.Success);
                    }
                    else
                    {
                        sms.ErrorMsg = kv.Value;
                        return(SendSmsResult.Fail);
                    }
                }
                return(SendSmsResult.Fail);
            }
            catch
            {
                return(SendSmsResult.Fail);
            }
        }
Exemplo n.º 2
0
        private SendSmsResult DoBeginSendMail(object smsObject)
        {
            SmsBase sms = smsObject as SmsBase;

            if (sms == null)
            {
                return(SendSmsResult.Fail);
            }

            return(SendSms(sms));
        }
Exemplo n.º 3
0
 public SendSmsResult BeginSendSms(SmsBase sms)
 {
     return(DoBeginSendMail(sms));
     //WaitCallback callback = new WaitCallback(DoBeginSendMail);
     //bool result = ThreadPool.QueueUserWorkItem(callback, sms);
 }