/// <summary> /// 保存节点对象 /// </summary> /// <param name="activity">节点基本属性</param> /// <param name="note">接收对象Json数据</param> /// <param name="rules">规则Json数据</param> /// <param name="activityId">节点编号</param> /// <param name="processId">流程编号</param> /// <param name="oldNoneName">节点名称</param> /// <returns></returns> public JsonResult SaveActivity(string activity, string note, string rules, string activityId, string processId, string oldNoneName) { var rtEntity = new StatusModel <DBNull> { rtData = null, rtMsrg = "", rtState = 1 }; var strArry = activity.Split('|'); var noneName = strArry[1].Trim(); #region 保存流程 var feOldProcess = new FeProcessBll().QueryByFlowId(processId); if (feOldProcess.Count > 0) { if (!string.IsNullOrEmpty(oldNoneName)) { feOldProcess[0].FlowChart = feOldProcess[0].FlowChart.Replace(oldNoneName, noneName); } feOldProcess[0].Id = Guid.NewGuid().ToString(); if (!new FeProcessBll().SaveProcess(feOldProcess[0])) { rtEntity.rtData = null; rtEntity.rtMsrg = "主流程保存失败!"; rtEntity.rtState = 1; } } else { rtEntity.rtData = null; rtEntity.rtMsrg = "未查到流程!"; rtEntity.rtState = 1; return(Json(rtEntity, JsonRequestBehavior.AllowGet)); } #endregion #region 保存节点属性 var feActivityEntity = new FeActivityEntity(); if (string.IsNullOrEmpty(activityId)) { activityId = Guid.NewGuid().ToString(); } feActivityEntity.ActivityID = activityId; feActivityEntity.ProcessID = processId; feActivityEntity.NoneID = strArry[0].Trim(); feActivityEntity.NoneName = strArry[1].Trim(); feActivityEntity.SendORWithdrawalActivityID = strArry[2].Trim(); feActivityEntity.FormAddress = strArry[3].Trim(); if (strArry[4].Trim() == "1") { feActivityEntity.IsContrastCommunity = true; } if (strArry[5].Trim() == "1") { feActivityEntity.IsContrastRule = true; } if (strArry[6].Trim() == "1") { feActivityEntity.IsSendOnOpener = true; } feActivityEntity.NoneDisposeManner = Convert.ToInt32(strArry[7].Trim()); feActivityEntity.FulfillAssemblyName = strArry[8].Trim(); feActivityEntity.FulfillClassFullName = strArry[9].Trim(); feActivityEntity.OverdueAssemblyName = strArry[10].Trim(); feActivityEntity.OverdueClassFullName = strArry[11].Trim(); feActivityEntity.OverdueHour = Convert.ToInt32(strArry[12].Trim()); feActivityEntity.Remark = strArry[13].Trim(); var istrue = new FeActivityBll().ExitstActivityId(feActivityEntity.ActivityID); if (istrue) { if (new FeActivityBll().DeleActivity(feActivityEntity.ActivityID)) { new FeActivityBll().Save(feActivityEntity); } } else { if (!new FeActivityBll().Save(feActivityEntity)) { rtEntity.rtData = null; rtEntity.rtMsrg = "当前节点不存在!"; rtEntity.rtState = 1; return(Json(rtEntity, JsonRequestBehavior.AllowGet)); } } #endregion #region 保存接收对象 var listActionInstance = JsonConvert.DeserializeObject <List <FeActionInstanceEntity> >(note); //序列化Json var saveActionInstance = new FeActionInstanceBll().SaveActionInstance(listActionInstance, activityId); //保存接收对象 if (!saveActionInstance) { rtEntity.rtData = null; rtEntity.rtMsrg = "保存对象失败!"; rtEntity.rtState = 1; return(Json(rtEntity, JsonRequestBehavior.AllowGet)); } #endregion #region 保存规则 if (!string.IsNullOrEmpty(rules)) { var ruleList = JsonConvert.DeserializeObject <List <FeRuleCodeEntity> >(rules); var saveRule = new FeRuleCodeBll().SaveRule(ruleList, activityId); //保存规则 if (!saveRule) { rtEntity.rtData = null; rtEntity.rtMsrg = "保存规则失败!"; rtEntity.rtState = 1; } } #endregion return(Json(rtEntity, JsonRequestBehavior.AllowGet)); }
public string ReadRuleById(string ruleId) { var rule = new FeRuleCodeBll().ReadRuleById(ruleId); return(JsonConvert.SerializeObject(rule)); }
/// <summary> /// Ajax 读取规则 /// 添加人:张西琼 /// 时间:2014-07-29 /// </summary> /// <param name="actityId"></param> /// <returns></returns> public string ReadRule(string actityId) { var rule = new FeRuleCodeBll().RuleCodeEntity(actityId); return(JsonConvert.SerializeObject(rule)); }