//定时发送短信 public static object SendMessageTimer(string sendDoc, string getTel, string sendDatetime) { int Id = 300;//机构代码 try { Id = Convert.ToInt32(ApiClientUtil.GetConfigCont("MESSAGE_ID")); } catch { } string Name = ApiClientUtil.GetConfigCont("MESSAGE_NAME"); //账户名 string Psw = ApiClientUtil.GetConfigCont("MESSAGE_PWD"); //密码 string webServiceURL = ApiClientUtil.GetConfigCont("MESSAGE_WEBSERVICEURL"); //webService地址 long Timestamp = GetTimeStamp(); //SendTimer(int Id, string Name, string Psw, string Message, string Phone,String DateTime, long Timestamp) object result = ""; try { result = DynamicServiceBind.InvokeWebService(webServiceURL, "SendTimer", new object[] { Id, Name, Psw, sendDoc, getTel, sendDatetime, Timestamp }); } catch (Exception e) { } return(result); }
//获取帐户短信可用数量 public static int GetBalance() { int Id = 300;//机构代码 try { Id = Convert.ToInt32(ApiClientUtil.GetConfigCont("MESSAGE_ID")); } catch { } string Name = ApiClientUtil.GetConfigCont("MESSAGE_NAME"); //账户名 string Psw = ApiClientUtil.GetConfigCont("MESSAGE_PWD"); //密码 string webServiceURL = ApiClientUtil.GetConfigCont("MESSAGE_WEBSERVICEURL"); //webService地址 //GetBalance(int Id, string Name, string Psw) int Balance = -1; object BalanceState = null; try { BalanceState = DynamicServiceBind.InvokeWebService(webServiceURL, "GetBalance", new object[] { Id, Name, Psw }); } catch (Exception e) { throw e; } if (BalanceState != null) { System.Reflection.FieldInfo fieldInfoBalance = BalanceState.GetType().GetField("Balance"); Balance = (int)fieldInfoBalance.GetValue(BalanceState); } return(Balance); }
//发送短信 public static object SendMessage(string sendDoc, string getTel) { int Id = 300;//机构代码 try { Id = Convert.ToInt32(ApiClientUtil.GetConfigCont("MESSAGE_ID")); } catch { } string Name = ApiClientUtil.GetConfigCont("MESSAGE_NAME"); //账户名 string Psw = ApiClientUtil.GetConfigCont("MESSAGE_PWD"); //密码 string webServiceURL = ApiClientUtil.GetConfigCont("MESSAGE_WEBSERVICEURL"); //webService地址 long Timestamp = GetTimeStamp(); //SendMessage(int Id, string Name, string Psw, string Message, string Phone, int Timestamp) object result = null; try { //Message.ServiceSoap. service= new Message.ServiceSoap(); //Messages.ServiceSoapClient ser = new Messages.ServiceSoapClient(); //Messages.SendState c= ser.SendMessage(Id,Name,Psw,sendDoc,getTel,Timestamp); //result = c.Id.ToString() + "|" + c.State + "|" + c.FailPhone; result = DynamicServiceBind.InvokeWebService(webServiceURL, "SendMessage", new object[] { Id, Name, Psw, sendDoc, getTel, Timestamp }); } catch (Exception e) { } return(result); }