/// <summary> /// 消息触发 /// </summary> /// <param name="recevieUser">接收人</param> /// <param name="SystemCode">系统代号</param> /// <param name="MsgKey">消息Key</param> /// <param name="ID">业务系统ID</param> /// <param name="strXml">业务数据</param> public void MsgTrigger(string[] recevieUser, string SystemCode, string MsgKey, string ID, string strXml) { if (recevieUser.Length > 0) { try { EngineServicesDAL dal = new EngineServicesDAL(); DataTable dt = dal.GetMessageDefine(MsgKey); DataTable dtValue = Common.EncrytXmlToDataTable(strXml); string Content = dt.Rows[0]["MESSAGEBODY"].ToString(); string Url = dt.Rows[0]["MESSAGEURL"].ToString(); Common.ReplaceValue(ref Content, ref Url, dtValue); foreach (string user in recevieUser) { //刷新缓存用户是否有新的待办 TaskCache.TaskCacheReflesh(user); dal.SendTriggerTaskMsg(user, SystemCode, "", ID, Content, Url, Common.BOObjectEscapeString(strXml), strXml); } } catch (Exception e) { string cMessage = "Message=[" + e.Message + "]" + "<消息引擎>Source=[" + e.Source + "]<消息引擎>StackTrace=[" + e.StackTrace + "]<消息引擎>TargetSite=[" + e.TargetSite + "]" + "\r\n"; Tracer.Debug("MsgTrigger():" + cMessage); } } }
/// <summary> /// 发送消息 /// </summary> /// <param name="ReceiveUserID"></param> /// <param name="strFormID"></param> /// <param name="MsgContent"></param> /// <param name="ModelCode"></param> /// <param name="strXml"></param> public void AppMsgTrigger(string ReceiveUserID, string strFormID, string MsgContent, string ModelCode, string strXml, string strNewGuid) { try { EngineServicesDAL dal = new EngineServicesDAL(); string SystemCode = string.Empty; if (!string.IsNullOrEmpty(strXml)) { Byte[] Bo = System.Text.UTF8Encoding.UTF8.GetBytes(strXml); XElement xemeBoObject = XElement.Load(System.Xml.XmlReader.Create(new MemoryStream(Bo))); SystemCode = (from item in xemeBoObject.Descendants("Name") select item).FirstOrDefault().Value; } DataTable dtFlowTrigger = dal.FlowTriggerTable(SystemCode, ModelCode, null, null); if (dtFlowTrigger != null && dtFlowTrigger.Rows.Count > 0) { TaskCache.TaskCacheReflesh(ReceiveUserID); DataTable dtValue = Common.EncrytXmlToDataTable(strXml); string Url = dtFlowTrigger.Rows[0]["applicationurl"] == null ? "" : dtFlowTrigger.Rows[0]["applicationurl"].ToString(); Url = Common.EncyptUrlNeedXMLHeader(Url, strFormID); // MsgTriggerBLL.ReplaceValue(ref Content, ref Url, dtValue); string strApplicationValue = Common.BOObjectEscapeString(strXml); //刷新缓存用户是否有新的待办 //EngineCache.TaskCache.TaskCacheReflesh(ReceiveUserID); dal.SendTriggerTaskMsg(ReceiveUserID, SystemCode, "", strNewGuid, MsgContent, Url, strApplicationValue, string.Empty); } } catch (Exception e) { string cMessage = "AppMsgTrigger出现异常" + "\r\n" + "ModelCode:" + ModelCode + "\r\n" + "strFormID:" + strFormID + "\r\n" + "异常信息:" + e.Message + "\r\n" + "异常来源:" + e.Source; Tracer.Debug("ApplicationMsgTrigger" + cMessage); } }
public void ApplicationMsgTriggerNew(List<CustomUserMsg> UserAndForm, string companyID, string SystemCode, string ModelCode, string strXml, MsgType msgType) { string strUserAndForm = string.Empty; string cMessage = string.Empty; if (UserAndForm.Count > 0) { try { EngineServicesDAL dal = new EngineServicesDAL(); T_WF_MESSAGEBODYDEFINE MsgBodyDefine = dal.GetMessageBodyDefine(SystemCode, ModelCode, companyID, 0).FirstOrDefault(); if (MsgBodyDefine != null) //在默认消息中有定义消息 { DataTable dtValue = Common.EncrytXmlToDataTable(strXml); string Content = MsgBodyDefine.MESSAGEBODY; string Url = MsgBodyDefine.MESSAGEURL; Content = Content.Replace("new:", ""); Common.ReplaceValue(ref Content, ref Url, dtValue); foreach (CustomUserMsg custom in UserAndForm) { strUserAndForm += "FormID:" + custom.FormID + " ReceiveUserID:" + custom.UserID + "\r\n"; if (MsgType.Task == msgType)//代办任务 { TaskCache.TaskCacheReflesh(custom.UserID); dal.ClosedDoTaskStatus(SystemCode, custom.FormID, custom.UserID); dal.SendTriggerTaskMsg(custom.UserID, SystemCode, ModelCode, custom.FormID, Content, Url, Common.BOObjectEscapeString(strXml), strXml); } else if (MsgType.Msg == msgType) { dal.SendTriggerMsg(custom.UserID, SystemCode, custom.FormID, Content); } } } else { cMessage = "未在消息定义中定义默认数据:ApplicationMsgTriggerNew" + "\r\n" + "SystemCode:" + SystemCode + "\r\n" + "ModelCode:" + ModelCode + "\r\n" + "执行时间:" + DateTime.Now.ToString(); Tracer.Debug("ApplicationMsgTriggerNew()" + cMessage); } } catch (Exception e) { cMessage = "ApplicationMsgTriggerNew出现异常" + "\r\n" + "SystemCode:" + SystemCode + "\r\n" + "ModelCode:" + ModelCode + "\r\n" + "业务数据XML:" + strXml + "\r\n" + "异常信息:" + e.Message + "\r\n" + "异常来源:" + e.Source; Tracer.Debug("ApplicationMsgTriggerNew()" + cMessage); } } cMessage = "ApplicationMsgTriggerNew被执行调用" + "\r\n" + "SystemCode:" + SystemCode + "\r\n" + "ModelCode:" + ModelCode + "\r\n" + "业务数据XML:" + strXml + "\r\n" + "UserAndForm Count:" + UserAndForm.Count + "\r\n" + "UserAndForm:" + strUserAndForm; Tracer.Debug("ApplicationMsgTriggerNew" + cMessage); }
public void AddDoDask(string companyID, string orderID, string systemCode, string modelCode, string modelName, string strXML, MsgType msgType) { try { Tracer.Debug("传入参数:companyID||" + companyID + "||orderID:" + orderID + "||modelCode:" + modelCode + "||strXML:" + strXML); EngineServicesDAL dal = new EngineServicesDAL(); T_WF_MESSAGEBODYDEFINE MsgBodyDefine = dal.GetMessageBodyDefine(systemCode, modelCode, companyID, 0).FirstOrDefault(); if (MsgBodyDefine == null) { Tracer.Debug("EngineServicesBLL.AddDoDask()没有查询到默认消息:modelCode||" + modelCode + "||systemCode" + systemCode + "||companyID" + companyID); return; } DataTable dtValue = Common.EncrytXmlToDataTable(strXML); string Content = MsgBodyDefine.MESSAGEBODY; string Url = MsgBodyDefine.MESSAGEURL; Tracer.Debug("查询到的URL:" + Url); Content = Content.Replace("new:", ""); Common.ReplaceValue(ref Content, ref Url, dtValue); Tracer.Debug("替换后的URL:" + Url); //T_WF_DOTASK dask = new T_WF_DOTASK(); if (MsgBodyDefine.RECEIVETYPE == 1 && MsgBodyDefine.RECEIVERUSERID != null) { for (int i = 0; i < MsgBodyDefine.RECEIVERUSERID.Split(',').Length; i++) { if (MsgType.Task == msgType)//代办任务 { TaskCache.TaskCacheReflesh(MsgBodyDefine.RECEIVERUSERID.Split(',')[i]); dal.ClosedDoTaskStatus(systemCode, orderID, MsgBodyDefine.RECEIVERUSERID.Split(',')[i]); Tracer.Debug("开始进行保存时的URL:" + Url); dal.SendTriggerTaskMsg(MsgBodyDefine.RECEIVERUSERID.Split(',')[i], systemCode, modelCode, orderID, Content, Url, Common.BOObjectEscapeString(strXML), strXML); } else if (MsgType.Msg == msgType) { dal.SendTriggerMsg(MsgBodyDefine.RECEIVERUSERID.Split(',')[i], systemCode, orderID, Content); } } } else if (MsgBodyDefine.RECEIVETYPE == 0 && MsgBodyDefine.RECEIVEPOSTID != null) { for (int i = 0; i < MsgBodyDefine.RECEIVEPOSTID.Split(',').Length; i++) { PersonnelWS.PersonnelServiceClient HRClient = new PersonnelWS.PersonnelServiceClient(); Tracer.Debug("岗位:" + MsgBodyDefine.RECEIVEPOSTID.Split(',')[i]); if (!string.IsNullOrEmpty(MsgBodyDefine.RECEIVEPOSTID.Split(',')[i])) { string[] Employees = HRClient.GetEmployeeIDsByPostID(MsgBodyDefine.RECEIVEPOSTID.Split(',')[i]); Tracer.Debug("岗位人:" + Employees[0]); if (MsgType.Task == msgType)//代办任务 { TaskCache.TaskCacheReflesh(Employees[0]); dal.ClosedDoTaskStatus(systemCode, orderID, Employees[0]); Tracer.Debug("开始进行保存时的URL:" + Url); dal.SendTriggerTaskMsg(Employees[0], systemCode, modelCode, orderID, Content, Url, Common.BOObjectEscapeString(strXML), strXML); } else if (MsgType.Msg == msgType) { dal.SendTriggerMsg(Employees[0], systemCode, orderID, Content); } } } } } catch (Exception ex) { Tracer.Debug("EngineServicesBLL.AddDoDask()" + ex.Message); } }
public List<UserInfo> ReturnUserInfoDask(string companyID, string orderID, string systemCode, string modelCode, string modelName, string strXML, MsgType msgType) { try { PersonnelWS.PersonnelServiceClient HRClient = new PersonnelWS.PersonnelServiceClient(); List<UserInfo> list = new List<UserInfo>(); EngineServicesDAL dal = new EngineServicesDAL(); T_WF_MESSAGEBODYDEFINE MsgBodyDefine = dal.GetMessageBodyDefine(systemCode, modelCode, companyID, 0).FirstOrDefault(); if (MsgBodyDefine == null) { Tracer.Debug("EngineServicesBLL.ReturnUserInfoDask()没有查询到默认消息:modelCode||" + modelCode + "||systemCode" + systemCode + "||companyID" + companyID); return null; } DataTable dtValue = Common.EncrytXmlToDataTable(strXML); string Content = MsgBodyDefine.MESSAGEBODY; string Url = MsgBodyDefine.MESSAGEURL.Replace("Details", "Edit");//MVC 审核通过之后发送指定人的代办 Content = Content.Replace("new:", ""); Common.ReplaceValue(ref Content, ref Url, dtValue); Tracer.Debug("替换后的URL:" + Url); if (MsgBodyDefine.RECEIVETYPE == 1 && MsgBodyDefine.RECEIVERUSERID != null) { for (int i = 0; i < MsgBodyDefine.RECEIVERUSERID.Split(',').Length; i++) { var Users = HRClient.GetFlowUserByUserID(MsgBodyDefine.RECEIVERUSERID.Split(',')[i]); UserInfo info = new UserInfo(); info.CompanyID = Users[0].CompayID; info.CompanyName = Users[0].CompayName; info.DepartmentID = Users[0].DepartmentID; info.DepartmentName = Users[0].DepartmentName; info.PostID = Users[0].PostID; info.PostName = Users[0].PostName; info.UserID = Users[0].UserID; info.UserName = Users[0].EmployeeName; list.Add(info); if (MsgType.Task == msgType)//代办任务 { TaskCache.TaskCacheReflesh(MsgBodyDefine.RECEIVERUSERID.Split(',')[i]); dal.ClosedDoTaskStatus(systemCode, orderID, MsgBodyDefine.RECEIVERUSERID.Split(',')[i]); Tracer.Debug("开始进行保存时的URL:" + Url); dal.SendTriggerTaskMsg(MsgBodyDefine.RECEIVERUSERID.Split(',')[i], systemCode, modelCode, orderID, Content, Url, Common.BOObjectEscapeString(strXML), strXML); } else if (MsgType.Msg == msgType) { dal.SendTriggerMsg(MsgBodyDefine.RECEIVERUSERID.Split(',')[i], systemCode, orderID, Content); } } } else if (MsgBodyDefine.RECEIVETYPE == 0 && MsgBodyDefine.RECEIVEPOSTID != null) { for (int i = 0; i < MsgBodyDefine.RECEIVEPOSTID.Split(',').Length; i++) { Tracer.Debug("岗位:" + MsgBodyDefine.RECEIVEPOSTID.Split(',')[i]); if (!string.IsNullOrEmpty(MsgBodyDefine.RECEIVEPOSTID.Split(',')[i])) { string[] Employees = HRClient.GetEmployeeIDsByPostID(MsgBodyDefine.RECEIVEPOSTID.Split(',')[i]); var Users = HRClient.GetFlowUserByUserID(Employees[0]); UserInfo info = new UserInfo(); info.CompanyID = Users[0].CompayID; info.CompanyName = Users[0].CompayName; info.DepartmentID = Users[0].DepartmentID; info.DepartmentName = Users[0].DepartmentName; info.PostID = Users[0].PostID; info.PostName = Users[0].PostName; info.UserID = Users[0].UserID; info.UserName = Users[0].EmployeeName; list.Add(info); Tracer.Debug("岗位人:" + Employees[0]); if (MsgType.Task == msgType)//代办任务 { TaskCache.TaskCacheReflesh(Employees[0]); dal.ClosedDoTaskStatus(systemCode, orderID, Employees[0]); Tracer.Debug("开始进行保存时的URL:" + Url); dal.SendTriggerTaskMsg(Employees[0], systemCode, modelCode, orderID, Content, Url, Common.BOObjectEscapeString(strXML), strXML); } else if (MsgType.Msg == msgType) { dal.SendTriggerMsg(Employees[0], systemCode, orderID, Content); } } } } return list; } catch (Exception ex) { Tracer.Debug("EngineServicesBLL.ReturnUserInfoDask()" + ex.Message); return null; } }