using BP.DA;
using BP.GPM.DTalk.DINGTalk;
using BP.GPM.WeiXin;
using BP.Sys;
using BP.Web;
using BP.WF;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace CCFlow.App
{
public partial class HandlerOfMessage : System.Web.UI.Page
{
///
/// 宜昌的发送.
///
public void DealYiChang()
{
//BP.DA.Log.DefaultLogWriteLineInfo("开始执.....");
byte[] data;
string txt;
Dictionary dictionary = null;
data = new byte[this.Request.InputStream.Length];
this.Request.InputStream.Read(data, 0, data.Length); //获得传入来的数据.
txt = System.Text.Encoding.UTF8.GetString(data); //编码.
// BP.DA.Log.DefaultLogWriteLineInfo("TXT:" + txt);
try
{
//把数据转化为json.
dictionary = Newtonsoft.Json.JsonConvert.DeserializeObject>(txt);
// BP.WF.Dev2Interface.Port_Login("zhoupeng");
//获取参数信息.
string senderUser = dictionary["Sender"].ToString(); //发送人.
string sendTo = dictionary["SendTo"].ToString(); //发送给谁.
string title = dictionary["Title"].ToString(); //标题
string tel = dictionary["Tel"].ToString(); //电话
string url = dictionary["Url"].ToString(); //点击的连接.
string flg = dictionary["MsgFlg"].ToString(); //消息标志, 比如: WorkAlt, Return.
string docs = dictionary["Doc"].ToString(); //消息内容.
string orgNo = dictionary["OrgNo"].ToString(); // 组织编号.
BP.WF.Dev2Interface.Port_Login(senderUser, orgNo);
string email = DBAccess.RunSQLReturnStringIsNull("SELECT Email FROM Port_Emp WHERE OrgNo='" + orgNo + "' AND UserID='" + sendTo + "'", null);
// email = "zhoupeng@ccflow.org";
if (DataType.IsNullOrEmpty(email) == true)
return;
if (DataType.IsNullOrEmpty(url) == false)
{
url = url.Trim();
if (url.Contains("&EmpNo=") == false)
url += "&EmpNo=" + sendTo;
url = url.Replace(" ", "");
url = url.Replace(" ", "");
url = url.Replace(" ", "");
url = url.Replace(" ", "");
docs += " \t\n
";
docs += " \t\n
";
// docs += " 请打开连接,处理工作: " + url;
docs += "
请打开连接,处理工作。";
}
BP.Cloud.OrgSetting.OrgMail orgEmail = new BP.Cloud.OrgSetting.OrgMail(BP.Web.WebUser.OrgNo);
orgEmail.SendEmail(email, title, docs);
// SendEmail(email, title, docs);
// BP.Cloud.OrgSetting.OrgMail mail = new BP.Cloud.OrgSetting.OrgMail(orgNo);
// mail.SendEmail(email, title, docs);
//调用本地的发送.
//SendEmailNowAsync(email, title, docs);
//执行发送.
// BP.Cloud.WeXinAPI.Glo.SendMsg(senderUser, sendTo, title, docs, url, orgNo);
// BP.DA.Log.DefaultLogWriteLineInfo("+++++++++++ 结束执行 ++++++++++++++++");
}
catch (Exception ex)
{
BP.DA.Log.DebugWriteError("err:" + ex.Message);
}
}
protected void Page_Load(object sender, EventArgs e)
{
BP.DA.Log.DebugWriteInfo("开始执.....");
byte[] data;
string txt;
Dictionary dictionary = null;
data = new byte[this.Request.InputStream.Length];
this.Request.InputStream.Read(data, 0, data.Length); //获得传入来的数据.
txt = System.Text.Encoding.UTF8.GetString(data); //编码.
BP.DA.Log.DebugWriteInfo("TXT:" + txt);
try
{
//把数据转化为json.
dictionary = Newtonsoft.Json.JsonConvert.DeserializeObject>(txt);
//获取参数信息
string senderUser = dictionary["Sender"].ToString();
string sendTo = dictionary["SendTo"].ToString(); //短号.
string title = dictionary["Title"].ToString();
string tel = dictionary["Tel"].ToString();
string url = dictionary["Url"].ToString();
string flg = dictionary["MsgFlg"].ToString();
string docs = dictionary["Doc"].ToString();
string orgNo = dictionary["OrgNo"].ToString();
if (url.Contains("OrgNo") == false)
url += "&OrgNo=" + orgNo;
BP.DA.Log.DebugWriteInfo("TXT:" + txt);
BP.Cloud.Org org = new BP.Cloud.Org(orgNo);
if (org.RegFrom == 1)
{
//执行发送.
BP.Cloud.WeXinAPI.Glo.SendMsg(senderUser, sendTo, title, docs, url, orgNo);
BP.DA.Log.DebugWriteInfo("+++++++++++ 结束执行 ++++++++++++++++");
return;
}
if (BP.Difference.SystemConfig.CustomerNo.Equals("ALLMED") == true)
{
DealYiChang();
return;
}
}
catch (Exception ex)
{
BP.DA.Log.DebugWriteError("err:" + ex.Message);
}
}
}
}