public Active(string activeId) { ActiveId = activeId; ActiveInfo active = ActiveDataAccess.GetActive(activeId); ActiveName = active.ActiveName; FormId = active.FormId; ActiveType = active.ActiveType; List <ParticipantInfo> listParameterInfo = ParticipantDataAccess.GetParticipantByActive(activeId); //participant if (listParameterInfo.Count > 0) { m_Participant = (Participant)Assembly.Load("SimpleFlow.BusinessRules").CreateInstance("SimpleFlow.BusinessRules.Participant" + listParameterInfo[0].ParticipantKind); m_Participant.ParticipantId = listParameterInfo[0].ParticipantId; } }
/// <summary> /// 更新流程xml /// </summary> /// <param name="workFlowXml">流程xml描述</param> public static bool UpdateWorkFlowXML(string workFlowXml) { Byte[] b = System.Text.UTF8Encoding.UTF8.GetBytes(workFlowXml); XmlDocument objXmlDoc = new XmlDocument(); objXmlDoc.Load(System.Xml.XmlReader.Create(new MemoryStream(b))); #region form XmlNode node = objXmlDoc.SelectSingleNode("WebFlow/FlowConfig/BaseProperties"); int flowId = Convert.ToInt32(node.Attributes["flowId"].Value); FormInfo form = FormBiz.GetForm(flowId); form.FormName = node.Attributes["flowText"].Value; form.FlowXml = workFlowXml; #endregion #region active List <ActiveInfo> listActive = new List <ActiveInfo>(); XmlNodeList nodeStepList = objXmlDoc.SelectNodes("WebFlow/Steps/Step"); foreach (XmlNode nodeStep in nodeStepList) { XmlNode nodeBase = nodeStep.SelectSingleNode("BaseProperties"); ActiveInfo active = ActiveDataAccess.GetActive(nodeBase.Attributes["id"].Value); if (active == null) { active = new ActiveInfo(); } active.ActiveId = nodeBase.Attributes["id"].Value; active.ActiveName = nodeBase.Attributes["text"].Value; active.ActiveType = nodeBase.Attributes["stepType"].Value; active.FormId = form.FormId; listActive.Add(active); } #endregion #region condition List <ConditionInfo> listCondition = new List <ConditionInfo>(); XmlNodeList nodeActionList = objXmlDoc.SelectNodes("WebFlow/Actions/Action"); foreach (XmlNode nodeAction in nodeActionList) { XmlNode nodeBase = nodeAction.SelectSingleNode("BaseProperties"); ConditionInfo condition = ConditionDataAccess.GetCondition(nodeBase.Attributes["id"].Value); if (condition == null) { condition = new ConditionInfo(); } condition.FromActiveId = nodeBase.Attributes["from"].Value; condition.ToActiveId = nodeBase.Attributes["to"].Value; condition.ConditionId = nodeBase.Attributes["id"].Value; condition.ConditionName = nodeBase.Attributes["text"].Value; condition.FormId = form.FormId; listCondition.Add(condition); } #endregion return(FlowDataAccess.UpdateFlow(form, listActive, listCondition)); }