Exemple #1
0
 /// <summary>
 /// 获取返回对象
 /// </summary>
 /// <param name="returnxml"></param>
 /// <returns></returns>
 public LanzSMSReturn GetObj(string returnxml)
 {
     try
     {
         LanzSMSReturn ret = new LanzSMSReturn();
         XmlDocument   doc = new XmlDocument();
         doc.LoadXml(returnxml);
         XmlNode rootNode = doc.DocumentElement;
         for (int i = 0; i < rootNode.ChildNodes.Count; i++)
         {
             if (rootNode.ChildNodes[i].Name == "ErrorNum")
             {
                 ret.ErrorNum = rootNode.ChildNodes[i].InnerText;
             }
             if (rootNode.ChildNodes[i].Name == "JobID")
             {
                 ret.JobID = rootNode.ChildNodes[i].InnerText;
             }
             if (rootNode.ChildNodes[i].Name == "PhonesSend")
             {
                 ret.PhonesSend = rootNode.ChildNodes[i].InnerText;
             }
             if (rootNode.ChildNodes[i].Name == "ErrPhones")
             {
                 ret.ErrPhones = rootNode.ChildNodes[i].InnerText;
             }
         }
         ret.ErrorNumDescs = ret.ErrorNumDesc;
         return(ret);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #2
0
 public LanzSMSReturn SendMessage(LanzSMSSend send)
 {
     try
     {
         string g_DnsUrl = LanzSMSBase.url;
         Dictionary <string, string> param = new Dictionary <string, string>();
         param.Add("UserID", LanzSMSBase.UserID);
         param.Add("Account", LanzSMSBase.Account);
         param.Add("Password", LanzSMSBase.Password);
         param.Add("SMSType", send.SMSType);
         param.Add("Content", System.Web.HttpUtility.UrlEncode(send.Content.Trim(), System.Text.Encoding.GetEncoding("gb2312")));
         param.Add("Phones", send.Phones);
         param.Add("SendDate", "");
         param.Add("SendTime", "");
         LanzWeb       web = new LanzWeb();
         LanzSMSReturn ret = GetObj(web.DoPost(g_DnsUrl, param));
         ret.NoteCount = GetNoteCount(send.Content);
         return(ret);
     }
     catch (Exception ex)
     {
         LogWriter.Write("dsadsa", ex.ToString(), "err");
         throw ex;
     }
 }