예제 #1
0
 public static int SendSMS(string phone, string content)
 {
     try
     {
         content = ConvertVietChar.convertToUnSign2(content);
         smsapiClient client = new smsapiClient();
         long         result = client.Sent(username, password, src, phone, content);
         client.Close();
         // 0 success
         return((int)result);
     }
     catch (Exception ex)
     {
         log.Error(ex);
         return(-100);
     }
 }
예제 #2
0
 public static int SendSMS(string phone, string content)
 {
     try
     {
         content = ConvertVietChar.convertToUnSign2(content);
         bool isUnicode = ConvertVietChar.ContainsUnicodeCharacter(content);
         ServiceVNTP.BrandNameWSClient client = new ServiceVNTP.BrandNameWSClient();
         long result = client.uploadSMS(username, password, "VietinBank", phone, "0", "0", content);
         client.Close();
         return((int)result);
     }
     catch (Exception ex)
     {
         log.Error(ex);
         return(-100);
     }
 }
 public static string SendSMSBrandName(string phone, string content, string brandname)
 {
     try
     {
         JsonSOUTHtelecom model = new JsonSOUTHtelecom
         {
             from = brandname,
             to   = phone,
             text = content,
         };
         var           javaScriptSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
         string        body       = javaScriptSerializer.Serialize(model);
         string        jsonResult = ConnectURLByPostBrandName(URL, body);
         List <string> Result     = jsonResult.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).ToList();
         return(Result[1].Replace("}", ""));
     }
     catch (Exception ex1)
     {
         log.Error(ex1);
         try
         {
             content = ConvertVietChar.convertToUnSign2(content);
             JsonSOUTHtelecom model = new JsonSOUTHtelecom
             {
                 from = brandname,
                 to   = phone,
                 text = content,
             };
             var           javaScriptSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
             string        body       = javaScriptSerializer.Serialize(model);
             string        jsonResult = ConnectURLByPostBrandName(URLBackUP, body);
             List <string> Result     = jsonResult.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).ToList();
             return(Result[1].Replace("}", ""));
         }
         catch (Exception ex2)
         {
             log.Error(ex2);
             return("error");
         }
     }
 }