public string EditTimingActivity(T_WF_TIMINGTRIGGERACTIVITY entity) { try { timingbll.EditTimingActivity(entity); return "1"; } catch (Exception ex) { return ex.Message; } }
public void AddTimingActivity(T_WF_TIMINGTRIGGERACTIVITY model) { try { string insSql = "INSERT INTO T_WF_TIMINGTRIGGERACTIVITY (TRIGGERNAME,COMPANYID,SYSTEMCODE,SYSTEMNAME,MODELCODE,MODELNAME,TRIGGERACTIVITYTYPE,TRIGGERTIME,TRIGGERROUND,WCFURL,FUNCTIONNAME,FUNCTIONPARAMTER,PAMETERSPLITCHAR,WCFBINDINGCONTRACT,RECEIVERUSERID,RECEIVEROLE,RECEIVERNAME,MESSAGEBODY,MESSAGEURL,TRIGGERSTATUS,TRIGGERTYPE,TRIGGERDESCRIPTION,CONTRACTTYPE,CREATEDATETIME,CREATEUSERID,CREATEUSERNAME,REMARK,TRIGGERID) VALUES (:TRIGGERNAME,:COMPANYID,:SYSTEMCODE,:SYSTEMNAME,:MODELCODE,:MODELNAME,:TRIGGERACTIVITYTYPE,:TRIGGERTIME,:TRIGGERROUND,:WCFURL,:FUNCTIONNAME,:FUNCTIONPARAMTER,:PAMETERSPLITCHAR,:WCFBINDINGCONTRACT,:RECEIVERUSERID,:RECEIVEROLE,:RECEIVERNAME,:MESSAGEBODY,:MESSAGEURL,:TRIGGERSTATUS,:TRIGGERTYPE,:TRIGGERDESCRIPTION,:CONTRACTTYPE,:CREATEDATETIME,:CREATEUSERID,:CREATEUSERNAME,:REMARK,:TRIGGERID)"; Parameter[] pageparm = { new Parameter(":TRIGGERNAME",dal.GetValue(model.TRIGGERNAME)), //定时触发名称 new Parameter(":COMPANYID",dal.GetValue(model.COMPANYID)), //公司ID new Parameter(":SYSTEMCODE",dal.GetValue(model.SYSTEMCODE)), //系统代码 new Parameter(":SYSTEMNAME",dal.GetValue(model.SYSTEMNAME)), //系统名称 new Parameter(":MODELCODE",dal.GetValue(model.MODELCODE)), //模块代码 new Parameter(":MODELNAME",dal.GetValue(model.MODELNAME)), //模块名称 new Parameter(":TRIGGERACTIVITYTYPE",dal.GetValue(model.TRIGGERACTIVITYTYPE)), //触发活动类型(1、短信活动 2、服务活动) new Parameter(":TRIGGERTIME",dal.GetValue(model.TRIGGERTIME)), //触发时间 new Parameter(":TRIGGERROUND",dal.GetValue(model.TRIGGERROUND)), //触发周期 0 只触发一次 1 分钟 2小时 3 天 4 月 5年 6周 7未知 new Parameter(":WCFURL",dal.GetValue(model.WCFURL)), //WCF的URL new Parameter(":FUNCTIONNAME",dal.GetValue(model.FUNCTIONNAME)), //所调方法名称 new Parameter(":FUNCTIONPARAMTER",dal.GetValue(model.FUNCTIONPARAMTER)), //方法参数 new Parameter(":PAMETERSPLITCHAR",dal.GetValue(model.PAMETERSPLITCHAR)), //参数分解符 new Parameter(":WCFBINDINGCONTRACT",dal.GetValue(model.WCFBINDINGCONTRACT)), //WCF绑定的契约 new Parameter(":RECEIVERUSERID",dal.GetValue(model.RECEIVERUSERID)), //接收人ID new Parameter(":RECEIVEROLE",dal.GetValue(model.RECEIVEROLE)), //接受人角色 new Parameter(":RECEIVERNAME",dal.GetValue(model.RECEIVERNAME)), //接收人名称 new Parameter(":MESSAGEBODY",dal.GetValue(model.MESSAGEBODY)), //接受消息 new Parameter(":MESSAGEURL",dal.GetValue(model.MESSAGEURL)), //消息链接 new Parameter(":TRIGGERSTATUS",dal.GetValue(model.TRIGGERSTATUS)), //触发器状态 new Parameter(":TRIGGERTYPE",dal.GetValue(model.TRIGGERTYPE)), //触发类型 new Parameter(":TRIGGERDESCRIPTION",dal.GetValue(model.TRIGGERDESCRIPTION)), //触发描述 new Parameter(":CONTRACTTYPE",dal.GetValue(model.CONTRACTTYPE)), //接口类型(引擎,定时接口) new Parameter(":CREATEDATETIME",dal.GetValue(DateTime.Now)), //创建日期 new Parameter(":CREATEUSERID",dal.GetValue(model.CREATEUSERID)), //创建人ID new Parameter(":CREATEUSERNAME",dal.GetValue(model.CREATEUSERNAME)), //创建人 new Parameter(":REMARK",dal.GetValue(model.REMARK)), //备注 new Parameter(":TRIGGERID",dal.GetValue(model.TRIGGERID)) //触发ID }; dal.ExecuteSql(insSql, pageparm); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public void EditTimingActivity(T_WF_TIMINGTRIGGERACTIVITY model) { try { string updSql = "UPDATE T_WF_TIMINGTRIGGERACTIVITY SET TRIGGERNAME=:TRIGGERNAME,COMPANYID=:COMPANYID,SYSTEMCODE=:SYSTEMCODE,SYSTEMNAME=:SYSTEMNAME,MODELCODE=:MODELCODE,MODELNAME=:MODELNAME,TRIGGERACTIVITYTYPE=:TRIGGERACTIVITYTYPE,TRIGGERTIME=:TRIGGERTIME,TRIGGERROUND=:TRIGGERROUND,WCFURL=:WCFURL,FUNCTIONNAME=:FUNCTIONNAME,FUNCTIONPARAMTER=:FUNCTIONPARAMTER,PAMETERSPLITCHAR=:PAMETERSPLITCHAR,WCFBINDINGCONTRACT=:WCFBINDINGCONTRACT,MESSAGEBODY=:MESSAGEBODY,MESSAGEURL=:MESSAGEURL,TRIGGERTYPE=:TRIGGERTYPE,TRIGGERDESCRIPTION=:TRIGGERDESCRIPTION,REMARK=:REMARK WHERE TRIGGERID=:TRIGGERID"; Parameter[] pageparm = { new Parameter(":TRIGGERNAME",dal.GetValue(model.TRIGGERNAME)), //定时触发名称 new Parameter(":COMPANYID",dal.GetValue(model.COMPANYID)), //公司ID new Parameter(":SYSTEMCODE",dal.GetValue(model.SYSTEMCODE)), //系统代码 new Parameter(":SYSTEMNAME",dal.GetValue(model.SYSTEMNAME)), //系统名称 new Parameter(":MODELCODE",dal.GetValue(model.MODELCODE)), //模块代码 new Parameter(":MODELNAME",dal.GetValue(model.MODELNAME)), //模块名称 new Parameter(":TRIGGERACTIVITYTYPE",dal.GetValue(model.TRIGGERACTIVITYTYPE)), //触发活动类型(1、短信活动 2、服务活动) new Parameter(":TRIGGERTIME",dal.GetValue(model.TRIGGERTIME)), //触发时间 new Parameter(":TRIGGERROUND",dal.GetValue(model.TRIGGERROUND)), //触发周期 0 只触发一次 1 分钟 2小时 3 天 4 月 5年 6周 7未知 new Parameter(":WCFURL",dal.GetValue(model.WCFURL)), //WCF的URL new Parameter(":FUNCTIONNAME",dal.GetValue(model.FUNCTIONNAME)), //所调方法名称 new Parameter(":FUNCTIONPARAMTER",dal.GetValue(model.FUNCTIONPARAMTER)), //方法参数 new Parameter(":PAMETERSPLITCHAR",dal.GetValue(model.PAMETERSPLITCHAR)), //参数分解符 new Parameter(":WCFBINDINGCONTRACT",dal.GetValue(model.WCFBINDINGCONTRACT)), //WCF绑定的契约 new Parameter(":MESSAGEBODY",dal.GetValue(model.MESSAGEBODY)), //接受消息 new Parameter(":MESSAGEURL",dal.GetValue(model.MESSAGEURL)), //消息链接 new Parameter(":TRIGGERTYPE",dal.GetValue(model.TRIGGERTYPE)), //触发类型 new Parameter(":TRIGGERDESCRIPTION",dal.GetValue(model.TRIGGERDESCRIPTION)), //触发描述 new Parameter(":REMARK",dal.GetValue(model.REMARK)), //备注 new Parameter(":TRIGGERID",dal.GetValue(model.TRIGGERID)) //触发ID }; dal.ExecuteSql(updSql, pageparm); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public bool AddTimingTrigger(T_WF_TIMINGTRIGGERACTIVITY entity) { try { EngineServicesDAL dal = new EngineServicesDAL(); if (string.IsNullOrWhiteSpace(entity.TRIGGERID)) { entity.TRIGGERID = Guid.NewGuid().ToString(); } if (entity.TRIGGERACTIVITYTYPE < 1) { throw new Exception("触发类型必填"); } if (entity.TRIGGERTIME == null) { throw new Exception("触发时间必填"); } if (entity.TRIGGERROUND < 0) { throw new Exception("触发周期必填"); } if (entity.TRIGGERSTART == null) { entity.TRIGGERSTART = DateTime.Now; } if (entity.TRIGGEREND == null) { entity.TRIGGEREND = DateTime.Now.AddYears(60); } if (entity.TRIGGERMULTIPLE <= 0) { entity.TRIGGERMULTIPLE = 1; } return dal.AddTimingTrigger(entity); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
/// <summary> /// 事件定时 /// </summary> /// <param name="strEventXml">定时所需的XML模版</param> /// <returns></returns> public bool SaveEventTriggerData(string strEventXml) { if (!string.IsNullOrEmpty(strEventXml)) { try { Byte[] b = System.Text.UTF8Encoding.UTF8.GetBytes(strEventXml); XElement xele = XElement.Load(System.Xml.XmlReader.Create(new MemoryStream(b))); T_WF_TIMINGTRIGGERACTIVITY trigger = new T_WF_TIMINGTRIGGERACTIVITY(); trigger.COMPANYID = EventXmlAttribute(xele, "CompanyCode"); trigger.SYSTEMCODE = EventXmlAttribute(xele, "SystemCode"); trigger.MODELCODE = EventXmlAttribute(xele, "ModelCode"); trigger.TRIGGERTIME = Convert.ToDateTime(EventXmlAttribute(xele, "TaskStartDate")); trigger.BUSINESSID = EventXmlAttribute(xele, "ApplicationOrderCode"); string ProcessCycle = EventXmlAttribute(xele, "ProcessCycle"); // 0 只触发一次 1 分钟 2小时 3 天 4 月 5年 6周 7未知 switch (ProcessCycle.ToUpper()) { case "YEAR": trigger.TRIGGERROUND = 5; break; case "MONTH": trigger.TRIGGERROUND = 4; break; case "DAY": trigger.TRIGGERROUND = 3; break; case "HOUR": trigger.TRIGGERROUND = 2; break; case "MINUTE": trigger.TRIGGERROUND = 1; break; case "WEEK": trigger.TRIGGERROUND = 6; break; case " ": trigger.TRIGGERROUND = 0; break; case "": trigger.TRIGGERROUND = 0; break; default: trigger.TRIGGERROUND = 100; trigger.REMARK = "未知的触发周期:" + ProcessCycle; break; } trigger.RECEIVERUSERID = EventXmlAttribute(xele, "ReceiveUser"); trigger.RECEIVEROLE = EventXmlAttribute(xele, "ReceiveRole"); trigger.MESSAGEBODY = EventXmlAttribute(xele, "MessageBody"); trigger.WCFURL = EventXmlAttribute(xele, "ProcessWcfUrl"); trigger.FUNCTIONNAME = EventXmlAttribute(xele, "WcfFuncName"); string TriggerType = EventXmlAttribute(xele, "TriggerType"); if (string.IsNullOrEmpty(TriggerType))// { TriggerType = "User"; } trigger.TRIGGERTYPE = TriggerType; string WcfFuncParamter = string.Empty; string MsgLinkUrl = string.Empty; try { WcfFuncParamter = xele.Element("WcfFuncParamter").ToString().Replace("<WcfFuncParamter>", "").Replace("</WcfFuncParamter>", ""); trigger.FUNCTIONPARAMTER = WcfFuncParamter; } catch { } try { MsgLinkUrl = xele.Element("MsgLinkUrl").ToString().Replace("<MsgLinkUrl>", "").Replace("</MsgLinkUrl>", ""); trigger.MESSAGEURL = MsgLinkUrl; } catch { } trigger.PAMETERSPLITCHAR = EventXmlAttribute(xele, "WcfParamSplitChar"); trigger.WCFBINDINGCONTRACT = EventXmlAttribute(xele, "WcfBinding"); trigger.TRIGGERDESCRIPTION = "EventTrigger"; if (trigger.TRIGGERSTART == null) { trigger.TRIGGERSTART = DateTime.Now; } if (trigger.TRIGGEREND == null) { trigger.TRIGGEREND = DateTime.Now.AddYears(60); } if (trigger.TRIGGERMULTIPLE <= 0) { trigger.TRIGGERMULTIPLE = 1; } EngineServicesDAL dal = new EngineServicesDAL(); return dal.AddTimingTrigger(trigger); } catch (Exception e) { string cMessage = "<消息引擎>Message=[" + e.Message + "]" + "<消息引擎>Source=[" + e.Source + "]<消息引擎>StackTrace=[" + e.StackTrace + "]<消息引擎>TargetSite=[" + e.TargetSite + "]"; Tracer.Debug(cMessage); return false; } } else { return false; } }
/// <summary> /// 新增定时触发 /// </summary> /// <param name="entity"></param> /// <returns></returns> public string WFAddTimingTrigger(T_WF_TIMINGTRIGGERACTIVITY entity) { try { Record.WriteLogFunction("WFAddTimingTrigger()开始调用"); EngineServicesBLL bll = new EngineServicesBLL(); bll.AddTimingTrigger(entity); return "1"; } catch (Exception ex) { Record.WriteLogFunction("WFAddTimingTrigger()" + ex.Message); return ex.Message; } }
/// <summary> /// 新增定时触发数据 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool AddTimingTrigger(T_WF_TIMINGTRIGGERACTIVITY entity) { try { using (OracleConnection con = new OracleConnection(dao.DatabaseString)) { string insSql = @"INSERT INTO T_WF_TIMINGTRIGGERACTIVITY (TRIGGERID, BUSINESSID,TRIGGERNAME,COMPANYID,SYSTEMCODE,SYSTEMNAME, MODELCODE,MODELNAME,TRIGGERACTIVITYTYPE,TRIGGERTIME,TRIGGERSTART,TRIGGEREND,TRIGGERROUND,TRIGGERMULTIPLE,WCFURL,FUNCTIONNAME,FUNCTIONPARAMTER,PAMETERSPLITCHAR, WCFBINDINGCONTRACT,RECEIVERUSERID,RECEIVEROLE,RECEIVERNAME,MESSAGEBODY,MESSAGEURL,TRIGGERTYPE,TRIGGERDESCRIPTION,CONTRACTTYPE, CREATEUSERID,CREATEUSERNAME,REMARK) VALUES (:TRIGGERID,:BUSINESSID,:TRIGGERNAME,:COMPANYID,:SYSTEMCODE,:SYSTEMNAME, :MODELCODE,:MODELNAME,:TRIGGERACTIVITYTYPE,:TRIGGERTIME,:TRIGGERSTART,:TRIGGEREND,:TRIGGERROUND,:TRIGGERMULTIPLE,:WCFURL,:FUNCTIONNAME,:FUNCTIONPARAMTER,:PAMETERSPLITCHAR, :WCFBINDINGCONTRACT,:RECEIVERUSERID,:RECEIVEROLE,:RECEIVERNAME,:MESSAGEBODY,:MESSAGEURL,:TRIGGERTYPE,:TRIGGERDESCRIPTION,:CONTRACTTYPE, :CREATEUSERID,:CREATEUSERNAME,:REMARK)"; OracleParameter[] pageparm = { new OracleParameter(":TRIGGERID",GetValue(entity.TRIGGERID)), new OracleParameter(":BUSINESSID",GetValue(entity.BUSINESSID)), new OracleParameter(":TRIGGERNAME",GetValue(entity.TRIGGERNAME)), new OracleParameter(":COMPANYID",GetValue(entity.COMPANYID)), new OracleParameter(":SYSTEMCODE",GetValue(entity.SYSTEMCODE)), new OracleParameter(":SYSTEMNAME",GetValue(entity.SYSTEMNAME)), new OracleParameter(":MODELCODE",GetValue(entity.MODELCODE)), new OracleParameter(":MODELNAME",GetValue(entity.MODELNAME)), new OracleParameter(":TRIGGERACTIVITYTYPE",GetValue(entity.TRIGGERACTIVITYTYPE)), new OracleParameter(":TRIGGERTIME",GetValue(entity.TRIGGERTIME)), new OracleParameter(":TRIGGERSTART",GetValue(entity.TRIGGERSTART)), new OracleParameter(":TRIGGEREND",GetValue(entity.TRIGGEREND)), new OracleParameter(":TRIGGERROUND",GetValue(entity.TRIGGERROUND)), new OracleParameter(":TRIGGERMULTIPLE",GetValue(entity.TRIGGERMULTIPLE)), new OracleParameter(":WCFURL",GetValue(entity.WCFURL)), new OracleParameter(":FUNCTIONNAME",GetValue(entity.FUNCTIONNAME)), new OracleParameter(":FUNCTIONPARAMTER",GetValue(entity.FUNCTIONPARAMTER)), new OracleParameter(":PAMETERSPLITCHAR",GetValue(entity.PAMETERSPLITCHAR)), new OracleParameter(":WCFBINDINGCONTRACT",GetValue(entity.WCFBINDINGCONTRACT)), new OracleParameter(":RECEIVERUSERID",GetValue(entity.RECEIVERUSERID)), new OracleParameter(":RECEIVEROLE",GetValue(entity.RECEIVEROLE)), new OracleParameter(":RECEIVERNAME",GetValue(entity.RECEIVERNAME)), new OracleParameter(":MESSAGEBODY",GetValue(entity.MESSAGEBODY)), new OracleParameter(":MESSAGEURL",GetValue(entity.MESSAGEURL)), new OracleParameter(":TRIGGERTYPE",GetValue(entity.TRIGGERTYPE)), new OracleParameter(":TRIGGERDESCRIPTION",GetValue(entity.TRIGGERDESCRIPTION)), new OracleParameter(":CONTRACTTYPE",GetValue(entity.CONTRACTTYPE)), new OracleParameter(":CREATEUSERID",GetValue(entity.CREATEUSERID)), new OracleParameter(":CREATEUSERNAME",GetValue(entity.CREATEUSERNAME)), new OracleParameter(":REMARK",GetValue(entity.REMARK)) }; int insert = MsOracle.ExecuteNonQuery(con, CommandType.Text, insSql, pageparm); return insert > 0 ? true : false; } } catch (Exception ex) { dao.Close(); throw new Exception(ex.Message, ex); } finally { dao.Close(); } }