Open szjs2013 opened 10 years ago
public class SMS {
protected bool SqlEvent(string Sql)//数据库添加删除更新处理
{
bool returns = true;
Database db = DatabaseFactory.CreateDatabase("SMS_ConnectionString");
try
{
DbCommand cmd = db.GetSqlStringCommand(Sql);
db.ExecuteNonQuery(cmd);
}
catch (Exception ex)
{
ex.ToString();
System.Web.HttpContext.Current.Response.Write("<script language=javascript>alert('" + ex.ToString() + "')</script>");
returns = false;
}
return returns;
}
public void SendSMS(object sendUserName, object receiveUserName, object smsContent, object receiveMobilePhone)
{
string rowid = "kcsj" + Guid.NewGuid().ToString();
string messagesql = "insert into T_SendTask(DestNumber,Content,SendFlag)values('"
+ receiveMobilePhone.ToString().Trim() + "','" + smsContent + "',0)";
if (SqlEvent(messagesql))
{//写入短信发送
string addsql = "insert into smsMessage (sendUserName,receiveUserName,smscontent,receiveMobilePhone,issend,row_id,senddate,messagetarget)values('"
+ sendUserName + "','" + receiveUserName + "','" + smsContent + "','" + receiveMobilePhone.ToString().Trim() + "', 0 ,'" + rowid + "','"
+ DateTime.Now.ToString().Trim() + "','YES')"; //本地数据库
Epoint.MisBizLogic2.DB.ExecuteNonQuery(addsql);
}
}
}
短信数据库:Database=db_sms;Server=192.168.153.208;UserID=sa;Password=wxjsj^200612data1
企业/资质/人员/备案审核需有短信通知。