开发者论坛

 找回密码
 注册 (请使用非IE浏览器)
查看: 5091|回复: 0

[源码] C# 腾讯通发送消息通知WCF服务源码

 关闭 [复制链接]

0

精华

4

贡献

6

赞扬

帖子
13
软币
121
在线时间
5 小时
注册时间
2014-3-22
发表于 2014-3-24 09:33:24 | 显示全部楼层 |阅读模式
/// <summary>
/// 发送消息
/// </summary>
/// <param name="IP">IP地址</param>
/// <param name="Port">端口</param>
/// <param name="ShowTime">消息停留时间(毫秒)</param>
/// <param name="Receivers">接受者 (不填则发送给所有人,多个接收者用";"号分开)</param>
/// <param name="MsgTitle">消息标题</param>
/// <param name="MsgContent">消息内容</param>
/// <returns>是否发送成功</returns>
public bool SendNotify(string ShowTime, string Receivers, string MsgTitle, string MsgContent)
{
try
{
RootObj = new RTXSAPIRootObj(); //创建根对象

RootObj.ServerIP = System.Configuration.ConfigurationManager.AppSettings["RtxIp"]; //设置服务器IP
RootObj.ServerPort = Convert.ToInt16(System.Configuration.ConfigurationManager.AppSettings["RtxPort"]); //设置服务器端口

RootObj.SendNotify(Receivers, MsgTitle, Convert.ToInt32(ShowTime), MsgContent); //发送消息

return true;
}
catch (COMException ex)
{
errLog.WriteEntry(ex.Message, System.Diagnostics.EventLogEntryType.Error);
return false;
}
}

/// <summary>
/// 发送短信
/// </summary>
/// <param name="IP">服务器IP</param>
/// <param name="Port">服务器端口</param>
/// <param name="Sender">发送者</param>
/// <param name="Pwd">发送者密码</param>
/// <param name="Receivers">接受者 (不填则发送给所有人,多个接收者用";"号分开)</param>
/// <param name="Content">短信内容</param>
/// <param name="SessionID">SessionID System.Guid{F41886B6-D593-4868-A25E-377C8727D7B6}</param>
/// <returns>是否发送成功</returns>
public bool SendIM(string Sender, string Pwd, string Receivers, string Content, string SessionID)
{
try
{
RootObj = new RTXSAPIRootObj(); //创建根对象

RootObj.ServerIP = System.Configuration.ConfigurationManager.AppSettings["RtxIp"]; //设置服务器IP
RootObj.ServerPort = Convert.ToInt16(System.Configuration.ConfigurationManager.AppSettings["RtxPort"]); //设置服务器端口

if (SessionID == "")
{
SessionID = @"{" + System.Guid.NewGuid().ToString() + @"}";
}
RootObj.SendIM(Sender, Pwd, Receivers, Content, SessionID);

return true;
}
catch (COMException ex)
{
errLog.WriteEntry(ex.Message, System.Diagnostics.EventLogEntryType.Error);
return false;
}
}

http://download.csdn.net/detail/labppz/6698995
回复

使用道具 举报

Archiver|手机版|小黑屋|开发者网 ( 苏ICP备08004430号-2 )
版权所有:南京韵文教育信息咨询有限公司

GMT+8, 2024-12-23 13:37

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表