public void EditDefaultMessage(T_WF_MESSAGEBODYDEFINE entity) { try { string updSql = @"UPDATE T_WF_MESSAGEBODYDEFINE SET SYSTEMCODE=:SYSTEMCODE,MODELCODE=:MODELCODE,MESSAGEBODY=:MESSAGEBODY, MESSAGEURL=:MESSAGEURL,RECEIVEPOSTID=:RECEIVEPOSTID,RECEIVEPOSTNAME=:RECEIVEPOSTNAME,RECEIVERUSERID=:RECEIVERUSERID,RECEIVERUSERNAME=:RECEIVERUSERNAME,RECEIVETYPE=:RECEIVETYPE WHERE DEFINEID=:DEFINEID"; Parameter[] pageparm = { new Parameter(":DEFINEID",dal.GetValue(entity.DEFINEID)), //默认消息ID new Parameter(":SYSTEMCODE",dal.GetValue(entity.SYSTEMCODE)), //系统代号 new Parameter(":MODELCODE",dal.GetValue(entity.MODELCODE)), //模块代码 new Parameter(":MESSAGEBODY",dal.GetValue(entity.MESSAGEBODY)), //消息体 new Parameter(":MESSAGEURL",dal.GetValue(entity.MESSAGEURL)), //消息链接 new Parameter(":RECEIVEPOSTID",dal.GetValue(entity.RECEIVEPOSTID)), // new Parameter(":RECEIVEPOSTNAME",dal.GetValue(entity.RECEIVEPOSTNAME)), // new Parameter(":RECEIVERUSERID",dal.GetValue(entity.RECEIVERUSERID)) ,// new Parameter(":RECEIVERUSERNAME",dal.GetValue(entity.RECEIVERUSERNAME)), // new Parameter(":RECEIVETYPE",dal.GetValue(entity.RECEIVETYPE)) // }; dal.ExecuteSql(updSql, pageparm); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public bool ExistsDefaultMessage(T_WF_MESSAGEBODYDEFINE entity) { try { string sql = "select DEFINEID from T_WF_MESSAGEBODYDEFINE where SYSTEMCODE='" + entity.SYSTEMCODE + "' and MODELCODE='" + entity.MODELCODE + "' and COMPANYID='" + entity.COMPANYID + "' and DEFINEID!='" + entity.DEFINEID + "'"; if (dal.GetDataTable(sql).Rows.Count > 0) { return false; } return true; } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
//添加默认消息 public bool AddFlowMsgDefine(T_WF_MESSAGEBODYDEFINE FlowMsg) { try { int result = 0; //string sql = "insert into T_WF_MESSAGEBODYDEFINE(DEFINEID, SYSTEMCODE, MODELCODE, MESSAGEBODY, MESSAGEURL, CREATEDATE,COMPANYID,CREATEUSERNAME,CREATEUSERID,MESSAGETYPE)" // + "values('" + FlowMsg.DEFINEID + "','" + FlowMsg.SYSTEMCODE + "','" + FlowMsg.MODELCODE + "'," // + "'" + FlowMsg.MESSAGEBODY + "','" + FlowMsg.MESSAGEURL + "',to_date('" + FlowMsg.CREATEDATE + "','yyyy-mm-dd hh24:mi:ss')," // + "'" + FlowMsg.COMPANYID + "','" + FlowMsg.CREATEUSERNAME + "','" + FlowMsg.CREATEUSERID + "','" + FlowMsg.MESSAGETYPE + "')"; //result = dao.ExecuteNonQuery(sql); string insSql = "INSERT INTO T_WF_MESSAGEBODYDEFINE (DEFINEID,COMPANYID,SYSTEMCODE,MODELCODE,MESSAGEBODY,MESSAGEURL,MESSAGETYPE,CREATEDATE,CREATEUSERNAME,CREATEUSERID) VALUES (:DEFINEID,:COMPANYID,:SYSTEMCODE,:MODELCODE,:MESSAGEBODY,:MESSAGEURL,:MESSAGETYPE,:CREATEDATE,:CREATEUSERNAME,:CREATEUSERID)"; Parameter[] pageparm = { new Parameter(":DEFINEID",GetValue(FlowMsg.DEFINEID)), //默认消息ID new Parameter(":COMPANYID",GetValue(FlowMsg.COMPANYID)), //公司ID new Parameter(":SYSTEMCODE",GetValue(FlowMsg.SYSTEMCODE)), //系统代号 new Parameter(":MODELCODE",GetValue(FlowMsg.MODELCODE)), //模块代码 new Parameter(":MESSAGEBODY",GetValue(FlowMsg.MESSAGEBODY)), //消息体 new Parameter(":MESSAGEURL",GetValue(FlowMsg.MESSAGEURL)), //消息链接 new Parameter(":MESSAGETYPE",GetValue(FlowMsg.MESSAGETYPE)), //消息类型 new Parameter(":CREATEDATE",GetValue(FlowMsg.CREATEDATE)), //创建日期 new Parameter(":CREATEUSERNAME",GetValue(FlowMsg.CREATEUSERNAME)), //创建人名称 new Parameter(":CREATEUSERID",GetValue(FlowMsg.CREATEUSERID)) //创建人 }; ParameterCollection pras = new ParameterCollection(); foreach (var item in pageparm) { pras.Add(item); } result = dao.ExecuteNonQuery(insSql, System.Data.CommandType.Text, pras); return result > 0 ? true : false; } catch { return false; } finally { } }
public string EditDefaultMessge(T_WF_MESSAGEBODYDEFINE entity) { try { if (messagebll.ExistsDefaultMessage(entity)) { messagebll.EditDefaultMessage(entity); return "1"; } else { return "2"; } } catch (Exception ex) { return ex.Message; } }
/// <summary> /// 新增默认消息 /// </summary> /// <param name="entity"></param> public void AddDefaultMessage(T_WF_MESSAGEBODYDEFINE entity) { try { if (string.IsNullOrWhiteSpace(entity.DEFINEID)) { entity.DEFINEID = Guid.NewGuid().ToString(); } string insSql = @"INSERT INTO T_WF_MESSAGEBODYDEFINE (DEFINEID,COMPANYID,SYSTEMCODE,MODELCODE,MESSAGEBODY,MESSAGEURL,MESSAGETYPE, RECEIVEPOSTID,RECEIVEPOSTNAME,RECEIVERUSERID,RECEIVERUSERNAME,RECEIVETYPE,CREATEDATE, CREATEUSERNAME,CREATEUSERID) VALUES (:DEFINEID,:COMPANYID,:SYSTEMCODE,:MODELCODE,:MESSAGEBODY,:MESSAGEURL,:MESSAGETYPE, :RECEIVEPOSTID,:RECEIVEPOSTNAME,:RECEIVERUSERID,:RECEIVERUSERNAME,:RECEIVETYPE,:CREATEDATE,:CREATEUSERNAME,:CREATEUSERID)"; OracleParameter[] pageparm = { new OracleParameter(":DEFINEID",dal.GetValue(entity.DEFINEID)), //默认消息ID new OracleParameter(":COMPANYID",dal.GetValue(entity.COMPANYID)), //公司ID new OracleParameter(":SYSTEMCODE",dal.GetValue(entity.SYSTEMCODE)), //系统代号 new OracleParameter(":MODELCODE",dal.GetValue(entity.MODELCODE)), //模块代码 new OracleParameter(":MESSAGEBODY",dal.GetValue(entity.MESSAGEBODY)), //消息体 new OracleParameter(":MESSAGEURL",dal.GetValue(entity.MESSAGEURL)), //消息链接 new OracleParameter(":MESSAGETYPE",dal.GetValue(entity.MESSAGETYPE)), //消息类型 new OracleParameter(":RECEIVEPOSTID",dal.GetValue(entity.RECEIVEPOSTID)), // new OracleParameter(":RECEIVEPOSTNAME",dal.GetValue(entity.RECEIVEPOSTNAME)), // new OracleParameter(":RECEIVERUSERID",dal.GetValue(entity.RECEIVERUSERID)) ,// new OracleParameter(":RECEIVERUSERNAME",dal.GetValue(entity.RECEIVERUSERNAME)), // new OracleParameter(":RECEIVETYPE",dal.GetValue(entity.RECEIVETYPE)), // new OracleParameter(":CREATEDATE",dal.GetValue(DateTime.Now)), //创建日期 new OracleParameter(":CREATEUSERNAME",dal.GetValue(entity.CREATEUSERNAME)), //创建人名称 new OracleParameter(":CREATEUSERID",dal.GetValue(entity.CREATEUSERID)) //创建人 }; dal.ExecuteSql(insSql, pageparm); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
//删除默认消息 public bool DeleteFlowMsgsDefine(T_WF_MESSAGEBODYDEFINE FlowMsgList) { return dal.DeleteFlowMsgsDefine(FlowMsgList); }
//修改默认消息 public bool UpdateFlowMsgDefine(T_WF_MESSAGEBODYDEFINE FlowMsg) { return dal.UpdateFlowMsgDefine(FlowMsg); }
//添加默认消息 public bool AddFlowMsgDefine(T_WF_MESSAGEBODYDEFINE FlowMsg) { return dal.AddFlowMsgDefine(FlowMsg); }
//引擎添加、修改方法 public string FlowEventAll(T_WF_MESSAGEBODYDEFINE FlowMsg, List<T_WF_DOTASKRULE> ListFlowTrigger, List<T_FLOW_CUSTOMFLOWDEFINE> ListCuostomFlowsDefine, List<T_WF_TIMINGTRIGGERCONFIG> ListFlowsTrigger) { return FlowEventBll.FlowEventAll(FlowMsg, ListFlowTrigger, ListCuostomFlowsDefine, ListFlowsTrigger); }
/// <summary> /// 获取默认消息 /// </summary> /// <param name="strSystemCode"></param> /// <param name="strModelCode"></param> /// <param name="strCompanyID"></param> /// <param name="strMessageType"></param> /// <returns></returns> public List<T_WF_MESSAGEBODYDEFINE> GetMessageBodyDefine(string strSystemCode, string strModelCode, string strCompanyID, int messageType) { List<T_WF_MESSAGEBODYDEFINE> list = new List<T_WF_MESSAGEBODYDEFINE>(); try { string sql = "SELECT * FROM T_WF_MESSAGEBODYDEFINE WHERE SYSTEMCODE='" + strSystemCode + "'AND MODELCODE='" + strModelCode + "'"; if (!string.IsNullOrEmpty(strCompanyID)) { sql += " AND COMPANYID='" + strCompanyID + "'"; } if (messageType >= 0) { sql += " AND MESSAGETYPE=" + messageType + ""; } dao.Open(); DataTable dt = dao.GetDataTable(sql); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { T_WF_MESSAGEBODYDEFINE MsgDefine = new T_WF_MESSAGEBODYDEFINE(); MsgDefine.SYSTEMCODE = string.Concat(dr["SYSTEMCODE"]); MsgDefine.MODELCODE = string.Concat(dr["MODELCODE"]); MsgDefine.MESSAGEBODY = string.Concat(dr["MESSAGEBODY"]); MsgDefine.MESSAGEURL = string.Concat(dr["MESSAGEURL"]); MsgDefine.RECEIVEPOSTID = string.Concat(dr["RECEIVEPOSTID"]); MsgDefine.RECEIVERUSERID = string.Concat(dr["RECEIVERUSERID"]); MsgDefine.RECEIVETYPE = int.Parse(dr["RECEIVETYPE"].ToString()); list.Add(MsgDefine); } } return list; } catch (Exception ex) { LogHelper.WriteLog(this, "GetMessageBodyDefine()", "获取默认消息", ex); return null; } finally { dao.Close(); } }
//删除默认消息 public bool DeleteFlowMsgsDefine(T_WF_MESSAGEBODYDEFINE FlowMsglList) { try { int result = 0; dao.BeginTransaction(); string Sql = "delete from T_WF_MESSAGEBODYDEFINE " + "where DEFINEID = '" + FlowMsglList.DEFINEID + "' "; result = dao.ExecuteNonQuery(Sql); if (result == 0) { dao.Rollback(); return false; } dao.Commit(); return result > 0 ? true : false; } catch { dao.Rollback(); return false; } finally { } }
//修改默认消息 public bool UpdateFlowMsgDefine(T_WF_MESSAGEBODYDEFINE FlowMsg) { try { int result = 0; //string sql = "update T_WF_MESSAGEBODYDEFINE set " // + "SYSTEMCODE = '" + FlowMsg.SYSTEMCODE + "', " // + "MODELCODE = '" + FlowMsg.MODELCODE + "', " // + "MESSAGEBODY = '" + FlowMsg.MESSAGEBODY + "'," // + "MESSAGEURL = '" + FlowMsg.MESSAGEURL + "' " // + "where DEFINEID = '" + FlowMsg.DEFINEID + "' "; //result = dao.ExecuteNonQuery(sql); string updSql = "UPDATE T_WF_MESSAGEBODYDEFINE SET SYSTEMCODE=:SYSTEMCODE,MODELCODE=:MODELCODE,MESSAGEBODY=:MESSAGEBODY,MESSAGEURL=:MESSAGEURL WHERE DEFINEID=:DEFINEID"; Parameter[] pageparm = { new Parameter(":DEFINEID",GetValue(FlowMsg.DEFINEID)), //默认消息ID new Parameter(":SYSTEMCODE",GetValue(FlowMsg.SYSTEMCODE)), //系统代号 new Parameter(":MODELCODE",GetValue(FlowMsg.MODELCODE)), //模块代码 new Parameter(":MESSAGEBODY",GetValue(FlowMsg.MESSAGEBODY)), //消息体 new Parameter(":MESSAGEURL",GetValue(FlowMsg.MESSAGEURL)) //消息链接 }; ParameterCollection pras = new ParameterCollection(); foreach (var item in pageparm) { pras.Add(item); } result = dao.ExecuteNonQuery(updSql, System.Data.CommandType.Text, pras); return result > 0 ? true : false; } catch { return false; } finally { } }
//引擎添加、修改方法 public string FlowEventAll(T_WF_MESSAGEBODYDEFINE FlowMsg, List<T_WF_DOTASKRULE> ListFlowProecss, List<T_FLOW_CUSTOMFLOWDEFINE> ListCuostomFlowsDefine, List<T_WF_TIMINGTRIGGERCONFIG> ListFlowTrigger) { try { int result = 0; string DelectFlowMsg = string.Empty;// List<T_WF_DOTASKRULEDETAIL> DelectProecss = new List<T_WF_DOTASKRULEDETAIL>();// List<T_FLOW_CUSTOMFLOWDEFINE> Delectcustom = new List<T_FLOW_CUSTOMFLOWDEFINE>();// List<T_WF_TIMINGTRIGGERCONFIG> Delecttrigger = new List<T_WF_TIMINGTRIGGERCONFIG>();// List<T_WF_DOTASKRULEDETAIL> NotDelectProecss = new List<T_WF_DOTASKRULEDETAIL>();// List<T_WF_DOTASKRULE> DotaskRuid = new List<T_WF_DOTASKRULE>();// List<T_WF_DOTASKRULE> DotaskRuids = new List<T_WF_DOTASKRULE>();// #region 查询数据 //查询所有存在的数据 if (FlowMsg != null) //消息定义 { string sql = "select * from T_WF_MESSAGEBODYDEFINE " + "where DEFINEID = '" + FlowMsg.DEFINEID + "' "; DataTable dtFlowMsg = dao.GetDataTable(sql); var itemes = ToList<T_WF_MESSAGEBODYDEFINE>(dtFlowMsg).AsQueryable(); if (itemes.ToList().Count() > 0) { DelectFlowMsg = itemes.FirstOrDefault().DEFINEID; } } if (ListFlowProecss != null) // 默认规则 { DotaskRuid.Clear(); foreach (var items in ListFlowProecss) { string sqlp = "select * from T_WF_DOTASKRULEDETAIL " + "where DOTASKRULEDETAILID ='" + items.DOTASKRULEDETAIL.DOTASKRULEDETAILID + "' "; DataTable dtFlowProecss = dao.GetDataTable(sqlp); var ipross = ToList<T_WF_DOTASKRULEDETAIL>(dtFlowProecss).AsQueryable(); if (ipross.ToList().Count() > 0) { DelectProecss.Add(items.DOTASKRULEDETAIL); } string sqlcec = "select * from T_WF_DOTASKRULE " + "where SYSTEMCODE = '" + items.SYSTEMCODE + "' and MODELCODE = '" + items.MODELCODE + "' and TRIGGERORDERSTATUS = " + items.TRIGGERORDERSTATUS + " and COMPANYID = '" + items.COMPANYID + "'"; DataTable dtCuostomFlowsDefinees = dao.GetDataTable(sqlcec); var iCuostomes = ToList<T_WF_DOTASKRULE>(dtCuostomFlowsDefinees); if (iCuostomes.ToList().Count() == 1) { if (ipross.ToList().Count() > 0) { if (DotaskRuid.Where(p => p.DOTASKRULEID == iCuostomes.FirstOrDefault().DOTASKRULEID).Count() == 0) { DotaskRuid.Add(iCuostomes[0]); } } else if (ipross.ToList().Count() == 0) { DotaskRuids.Add(iCuostomes[0]); } } else if (iCuostomes.ToList().Count() == 0) { NotDelectProecss.Add(items.DOTASKRULEDETAIL); } } } if (ListCuostomFlowsDefine != null) //自动发起流程 { foreach (var itemsc in ListCuostomFlowsDefine) { string sqlc = "select * from T_FLOW_CUSTOMFLOWDEFINE " + "where PROCESSID = '" + itemsc.PROCESSID + "' "; DataTable dtCuostomFlowsDefine = dao.GetDataTable(sqlc); var iCuostom = ToList<T_FLOW_CUSTOMFLOWDEFINE>(dtCuostomFlowsDefine).AsQueryable(); if (iCuostom.ToList().Count() > 0) { Delectcustom.Add(itemsc); } } } if (ListFlowTrigger != null) //定时触发 { foreach (var itemst in ListFlowTrigger) { string sqlc = "select * from T_WF_TIMINGTRIGGERCONFIG " + "where TIMINGCONFIGID = '" + itemst.TIMINGCONFIGID + "' "; DataTable dtFlowTrigger = dao.GetDataTable(sqlc); var iTrigger = ToList<T_WF_TIMINGTRIGGERCONFIG>(dtFlowTrigger).AsQueryable(); if (iTrigger.ToList().Count() > 0) { Delecttrigger.Add(itemst); } } } #endregion #region 删除数据 //删除数据 dao.BeginTransaction(); if (DelectFlowMsg != "") { string Sql = "delete from T_WF_MESSAGEBODYDEFINE " + "where DEFINEID = '" + DelectFlowMsg + "' "; result = dao.ExecuteNonQuery(Sql); if (result == 0) //消息删除 { dao.Rollback(); return "消息定义保存失败!"; } } if (DelectProecss.Count() > 0 || DotaskRuid.Count() > 0) { foreach (var itempr in DelectProecss) //默认规则 { string Sqlpr = "delete from T_WF_DOTASKRULEDETAIL " + "where DOTASKRULEID = '" + itempr.DOTASKRULEID + "' "; result = dao.ExecuteNonQuery(Sqlpr); //if (result == 0) //{ // dao.Rollback(); // return "默认规则保存失败!"; //} if (DotaskRuid.Where(p => p.DOTASKRULEID == itempr.DOTASKRULEID).Count() > 0) { string Sqlfl = "delete from T_WF_DOTASKRULE " + "where DOTASKRULEID = '" + itempr.DOTASKRULEID + "' "; result = dao.ExecuteNonQuery(Sqlfl); //if (result == 0) //{ // dao.Rollback(); // return "默认规则保存失败!"; //} } } } if (Delectcustom.Count() > 0) { foreach (var itemctm in Delectcustom) //自动发起流程 { string Sqlctm = "delete from T_FLOW_CUSTOMFLOWDEFINE " + "where PROCESSID = '" + itemctm.PROCESSID + "' "; result = dao.ExecuteNonQuery(Sqlctm); if (result == 0) { dao.Rollback(); return "自动发起流程保存失败!"; } } } if (Delecttrigger.Count() >0) { foreach (var itemter in Delecttrigger) //定时触发 { string Sqlter = "delete from T_WF_TIMINGTRIGGERCONFIG " + "where TIMINGCONFIGID = '" + itemter.TIMINGCONFIGID + "' "; result = dao.ExecuteNonQuery(Sqlter); if (result == 0) { dao.Rollback(); return "定时触发定义保存失败!"; } string Sqlger = "delete from T_WF_TIMINGTRIGGERACTIVITY " + "where TIMINGCONFIGID = '" + itemter.TIMINGCONFIGID + "' "; result = dao.ExecuteNonQuery(Sqlger); //if (result == 0) //{ // dao.Rollback(); // return "定时触发定义保存失败!"; //} } } #endregion #region 添加数据 if (FlowMsg != null) { string SqlAmsg = "insert into T_WF_MESSAGEBODYDEFINE(DEFINEID, SYSTEMCODE, MODELCODE, MESSAGEBODY, MESSAGEURL, CREATEDATE,COMPANYID,CREATEUSERNAME,CREATEUSERID,MESSAGETYPE)" + "values('" + FlowMsg.DEFINEID + "','" + FlowMsg.SYSTEMCODE + "','" + FlowMsg.MODELCODE + "'," + "'" + FlowMsg.MESSAGEBODY + "','" + FlowMsg.MESSAGEURL + "',to_date('" + FlowMsg.CREATEDATE + "','yyyy-mm-dd hh24:mi:ss')," + "'" + FlowMsg.COMPANYID + "','" + FlowMsg.CREATEUSERNAME + "','" + FlowMsg.CREATEUSERID + "','" + FlowMsg.MESSAGETYPE + "')"; result = dao.ExecuteNonQuery(SqlAmsg); //消息定义 if (result == 0) //消息删除 { dao.Rollback(); return "消息定义保存失败!"; } } if (ListFlowProecss != null) { List<string> triggerID = new List<string>(); foreach (var FlowTrigger in ListFlowProecss) //触发规则 { string DotaskRuleID = string.Empty; bool rueslt = false; //判断是否要添加主表 if (DotaskRuid.Where(p => p.SYSTEMCODE == FlowTrigger.SYSTEMCODE && p.MODELCODE == FlowTrigger.MODELCODE && p.TRIGGERORDERSTATUS == FlowTrigger.TRIGGERORDERSTATUS).Count() > 0) { rueslt = true; DotaskRuleID = DotaskRuid.Where(p => p.SYSTEMCODE == FlowTrigger.SYSTEMCODE && p.MODELCODE == FlowTrigger.MODELCODE && p.TRIGGERORDERSTATUS == FlowTrigger.TRIGGERORDERSTATUS).FirstOrDefault().DOTASKRULEID; } else if (DotaskRuids.Where(p => p.SYSTEMCODE == FlowTrigger.SYSTEMCODE && p.MODELCODE == FlowTrigger.MODELCODE && p.TRIGGERORDERSTATUS == FlowTrigger.TRIGGERORDERSTATUS).Count() > 0) { rueslt = false; DotaskRuleID = DotaskRuids.Where(p => p.SYSTEMCODE == FlowTrigger.SYSTEMCODE && p.MODELCODE == FlowTrigger.MODELCODE && p.TRIGGERORDERSTATUS == FlowTrigger.TRIGGERORDERSTATUS).FirstOrDefault().DOTASKRULEID; } else { if (NotDelectProecss.Where(p => p.DOTASKRULEDETAILID == FlowTrigger.DOTASKRULEDETAIL.DOTASKRULEDETAILID).Count() > 0) { rueslt = true; DotaskRuleID = FlowTrigger.DOTASKRULEID; } else { rueslt = false; DotaskRuleID = FlowTrigger.DOTASKRULEID; } } if (rueslt == true) { if (triggerID.Where(p => p == DotaskRuleID).Count() == 0) { triggerID.Add(DotaskRuleID); string sqlAger = "insert into T_WF_DOTASKRULE(DOTASKRULEID ,COMPANYID, SYSTEMCODE,SYSTEMNAME ,MODELCODE ,MODELNAME ,TRIGGERORDERSTATUS ,CREATEDATETIME)values(" + " '" + DotaskRuleID + "','" + FlowTrigger.COMPANYID + "'," + " '" + FlowTrigger.SYSTEMCODE + "','" + FlowTrigger.SYSTEMNAME + "','" + FlowTrigger.MODELCODE + "'," + " '" + FlowTrigger.MODELNAME + "','" + FlowTrigger.TRIGGERORDERSTATUS + "',to_date('" + FlowTrigger.CREATEDATETIME + "','yyyy-mm-dd hh24:mi:ss'))"; result = dao.ExecuteNonQuery(sqlAger); if (result == 0) { dao.Rollback(); return "默认规则保存失败!"; } } } string sqlAter = "insert into T_WF_DOTASKRULEDETAIL(DOTASKRULEDETAILID, DOTASKRULEID , COMPANYID , SYSTEMCODE,SYSTEMNAME ,MODELCODE ,MODELNAME ,WCFURL ,FUNCTIONNAME ," + " FUNCTIONPARAMTER ,PAMETERSPLITCHAR ,WCFBINDINGCONTRACT ,MESSAGEBODY ,LASTDAYS ,CREATEDATETIME ," + " APPLICATIONURL ,RECEIVEUSER ,RECEIVEUSERNAME ,OWNERCOMPANYID ,OWNERDEPARTMENTID ,OWNERPOSTID ,ISDEFAULTMSG ," + " PROCESSFUNCLANGUAGE ,ISOTHERSOURCE ,OTHERSYSTEMCODE ,OTHERMODELCODE,REMARK,CREATEUSERID,CREATEUSERNAME,TRIGGERORDERSTATUS)values(" + " '" + FlowTrigger.DOTASKRULEDETAIL.DOTASKRULEDETAILID + "','" + DotaskRuleID + "','" + FlowTrigger.DOTASKRULEDETAIL.COMPANYID + "'," + " '" + FlowTrigger.DOTASKRULEDETAIL.SYSTEMCODE + "','" + FlowTrigger.DOTASKRULEDETAIL.SYSTEMNAME + "','" + FlowTrigger.DOTASKRULEDETAIL.MODELCODE + "'," + " '" + FlowTrigger.DOTASKRULEDETAIL.MODELNAME + "','" + FlowTrigger.DOTASKRULEDETAIL.WCFURL + "','" + FlowTrigger.DOTASKRULEDETAIL.FUNCTIONNAME + "'," + " '" + FlowTrigger.DOTASKRULEDETAIL.FUNCTIONPARAMTER + "','" + FlowTrigger.DOTASKRULEDETAIL.PAMETERSPLITCHAR + "','" + FlowTrigger.DOTASKRULEDETAIL.WCFBINDINGCONTRACT + "'," + " '" + FlowTrigger.DOTASKRULEDETAIL.MESSAGEBODY + "','" + FlowTrigger.DOTASKRULEDETAIL.LASTDAYS + "',to_date('" + FlowTrigger.DOTASKRULEDETAIL.CREATEDATETIME + "','yyyy-mm-dd hh24:mi:ss')," + " '" + FlowTrigger.DOTASKRULEDETAIL.APPLICATIONURL + "','" + FlowTrigger.DOTASKRULEDETAIL.RECEIVEUSER + "'," + " '" + FlowTrigger.DOTASKRULEDETAIL.RECEIVEUSERNAME + "','" + FlowTrigger.DOTASKRULEDETAIL.OWNERCOMPANYID + "','" + FlowTrigger.DOTASKRULEDETAIL.OWNERDEPARTMENTID + "'," + " '" + FlowTrigger.DOTASKRULEDETAIL.OWNERPOSTID + "','" + FlowTrigger.DOTASKRULEDETAIL.ISDEFAULTMSG + "'," + " '" + FlowTrigger.DOTASKRULEDETAIL.PROCESSFUNCLANGUAGE + "','" + FlowTrigger.DOTASKRULEDETAIL.ISOTHERSOURCE + "'," + " '" + FlowTrigger.DOTASKRULEDETAIL.OTHERSYSTEMCODE + "','" + FlowTrigger.DOTASKRULEDETAIL.OTHERMODELCODE + "','" + FlowTrigger.DOTASKRULEDETAIL.REMARK + "', " + " '" + FlowTrigger.DOTASKRULEDETAIL.CREATEUSERID + "','" + FlowTrigger.DOTASKRULEDETAIL.CREATEUSERNAME + "','" + FlowTrigger.TRIGGERORDERSTATUS + "')"; result = dao.ExecuteNonQuery(sqlAter); if (result == 0) { dao.Rollback(); return "默认规则保存失败!"; } } } if (ListCuostomFlowsDefine != null) { foreach (var CuostomFlow in ListCuostomFlowsDefine) //自动发起流程 { string sqlAcow = "insert into T_FLOW_CUSTOMFLOWDEFINE(PROCESSID, COMPANYCODE, SYSTEMCODE, SYSTEMNAME,MODELCODE,MODELNAME,FUNCTIONNAME,FUNCTIONDES," + " PROCESSWCFURL,PROCESSFUNCNAME,PROCESSFUNCPAMETER,PAMETERSPLITCHAR,WCFBINDINGCONTRACT,MESSAGEBODY,MSGLINKURL,RECEIVEUSER,RECEIVEUSERNAME," + " OWNERCOMPANYID,OWNERDEPARTMENTID,OWNERPOSTID,CREATEDATE,CREATETIME,CREATEUSERNAME,CREATEUSERID)values(" + " '" + CuostomFlow.PROCESSID + "','" + CuostomFlow.COMPANYCODE + "','" + CuostomFlow.SYSTEMCODE + "'," + " '" + CuostomFlow.SYSTEMNAME + "','" + CuostomFlow.MODELCODE + "','" + CuostomFlow.MODELNAME + "'," + " '" + CuostomFlow.FUNCTIONNAME + "','" + CuostomFlow.FUNCTIONDES + "','" + CuostomFlow.PROCESSWCFURL + "'," + " '" + CuostomFlow.PROCESSFUNCNAME + "','" + CuostomFlow.PROCESSFUNCPAMETER + "','" + CuostomFlow.PAMETERSPLITCHAR + "'," + " '" + CuostomFlow.WCFBINDINGCONTRACT + "','" + CuostomFlow.MESSAGEBODY + "','" + CuostomFlow.MSGLINKURL + "'," + " '" + CuostomFlow.RECEIVEUSER + "','" + CuostomFlow.RECEIVEUSERNAME + "','" + CuostomFlow.OWNERCOMPANYID + "'," + " '" + CuostomFlow.OWNERDEPARTMENTID + "','" + CuostomFlow.OWNERPOSTID + "','" + CuostomFlow.CREATEDATE + "'," + " '" + CuostomFlow.CREATETIME + "','" + CuostomFlow.CREATEUSERNAME + "','" + CuostomFlow.CREATEUSERID + "')"; result = dao.ExecuteNonQuery(sqlAcow); if (result == 0) { dao.Rollback(); return "自动发起流程保存失败!"; } } } if (ListFlowTrigger != null) { foreach (var FlowTrigger in ListFlowTrigger) //定时触发 { string sqlAtger = "insert into T_WF_TIMINGTRIGGERCONFIG(TIMINGCONFIGID, 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,TRIGGERNAME)values(" + " '" + FlowTrigger.TIMINGCONFIGID + "','" + FlowTrigger.COMPANYID + "','" + FlowTrigger.SYSTEMCODE + "'," + " '" + FlowTrigger.SYSTEMNAME + "','" + FlowTrigger.MODELCODE + "','" + FlowTrigger.MODELNAME + "'," + " " + FlowTrigger.TRIGGERACTIVITYTYPE + ",to_date('" + FlowTrigger.TRIGGERTIME + "','yyyy-mm-dd hh24:mi:ss')," + FlowTrigger.TRIGGERROUND + "," + " '" + FlowTrigger.WCFURL + "','" + FlowTrigger.FUNCTIONNAME + "','" + FlowTrigger.FUNCTIONPARAMTER + "'," + " '" + FlowTrigger.PAMETERSPLITCHAR + "','" + FlowTrigger.WCFBINDINGCONTRACT + "','" + FlowTrigger.RECEIVERUSERID + "'," + " '" + FlowTrigger.RECEIVEROLE + "','" + FlowTrigger.RECEIVERNAME + "','" + FlowTrigger.MESSAGEBODY + "'," + " '" + FlowTrigger.MESSAGEURL + "'," + FlowTrigger.TRIGGERSTATUS + ",'" + FlowTrigger.TRIGGERTYPE + "'," + " '" + FlowTrigger.TRIGGERDESCRIPTION + "','" + FlowTrigger.CONTRACTTYPE + "',to_date('" + FlowTrigger.CREATEDATETIME + "','yyyy-mm-dd hh24:mi:ss')," + " '" + FlowTrigger.CREATEUSERID + "','" + FlowTrigger.CREATEUSERNAME + "','" + FlowTrigger.REMARK + "', " + " '" + FlowTrigger.TRIGGERNAME + "')"; result = dao.ExecuteNonQuery(sqlAtger); if (result == 0) { dao.Rollback(); return "定时触发定义保存失败!"; } string sqlAtgger = "insert into T_WF_TIMINGTRIGGERACTIVITY(TIMINGCONFIGID, 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,TRIGGERNAME,TRIGGERID)values(" + " '" + FlowTrigger.TIMINGCONFIGID + "','" + FlowTrigger.COMPANYID + "','" + FlowTrigger.SYSTEMCODE + "'," + " '" + FlowTrigger.SYSTEMNAME + "','" + FlowTrigger.MODELCODE + "','" + FlowTrigger.MODELNAME + "'," + " " + FlowTrigger.TRIGGERACTIVITYTYPE + ",to_date('" + FlowTrigger.TRIGGERTIME + "','yyyy-mm-dd hh24:mi:ss')," + FlowTrigger.TRIGGERROUND + "," + " '" + FlowTrigger.WCFURL + "','" + FlowTrigger.FUNCTIONNAME + "','" + FlowTrigger.FUNCTIONPARAMTER + "'," + " '" + FlowTrigger.PAMETERSPLITCHAR + "','" + FlowTrigger.WCFBINDINGCONTRACT + "','" + FlowTrigger.RECEIVERUSERID + "'," + " '" + FlowTrigger.RECEIVEROLE + "','" + FlowTrigger.RECEIVERNAME + "','" + FlowTrigger.MESSAGEBODY + "'," + " '" + FlowTrigger.MESSAGEURL + "'," + FlowTrigger.TRIGGERSTATUS + ",'" + FlowTrigger.TRIGGERTYPE + "'," + " '" + FlowTrigger.TRIGGERDESCRIPTION + "','" + FlowTrigger.CONTRACTTYPE + "',to_date('" + FlowTrigger.CREATEDATETIME + "','yyyy-mm-dd hh24:mi:ss')," + " '" + FlowTrigger.CREATEUSERID + "','" + FlowTrigger.CREATEUSERNAME + "','" + FlowTrigger.REMARK + "', " + " '" + FlowTrigger.TRIGGERNAME + "', '" + Guid.NewGuid() + "')"; result = dao.ExecuteNonQuery(sqlAtgger); if (result == 0) { dao.Rollback(); return "定时触发定义保存失败!"; } } } #endregion dao.Commit(); return "保存成功!"; } catch { dao.Rollback(); return "保存失败!"; } finally { } }