Example #1
0
 public static RetEntity Parse(string ret) {
     var entity = new RetEntity();
     System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
     doc.LoadXml(ret);
     entity.Result = doc.DocumentElement.GetAttribute("result");
     entity.Method = doc.DocumentElement.GetAttribute("name");
     foreach (System.Xml.XmlNode node in doc.SelectNodes("//Item")) {
         entity.Messages.Add(Message.Parse(node));
     };
     return entity;
 }
Example #2
0
        public static RetEntity Parse(string ret)
        {
            var entity = new RetEntity();

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(ret);
            entity.Result = doc.DocumentElement.GetAttribute("result");
            entity.Method = doc.DocumentElement.GetAttribute("name");
            foreach (System.Xml.XmlNode node in doc.SelectNodes("//Item"))
            {
                entity.Messages.Add(Message.Parse(node));
            }
            ;
            return(entity);
        }
Example #3
0
        public string TestResult(string ret)
        {
            string code = reg.Match(ret).Value;

            if (code.Length > 1)
            {
                code = code.Split('=')[1].Trim('"');
            }
            if ("1".Equals(code) && ret.IndexOf("<Item") >= 0)
            {
                RetEntity entity = RetEntity.Parse(ret);
                return(entity.ToString());
            }
            else
            {
                return(RetCode[code] + ";");
            }
        }
Example #4
0
        public string SendSMS(string mobile, string content)
        {
            string data = string.Format("action=sendOnce&cgid=52&csid=0&ac={0}&authkey={1}&m={2}&c={3}", UserID, Password, mobile, HttpUtility.UrlEncode(content));
            string ret  = GCL.Common.Tool.PostString(APIUrl, data);
            string code = reg.Match(ret).Value;

            if (code.Length > 1)
            {
                code = code.Split('=')[1].Trim('"');
            }
            if ("1".Equals(code) && ret.IndexOf("<Item") >= 0)
            {
                RetEntity entity = RetEntity.Parse(ret);
                return(entity.ToString());
            }
            else
            {
                return(RetCode[code] + ";");
            }
        }