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; } }
public Form(int _FormId) { FormId = _FormId; FormInfo form = FormDataAccess.GetForm(_FormId); FormName = form.FormName; FlowXml = form.FlowXml; //Load Active List <ActiveInfo> listActive = ActiveDataAccess.GetAll(_FormId); foreach (ActiveInfo active in listActive) { m_listActive.Add(new Active(active.ActiveId)); } //Load Condition List <ConditionInfo> listCondition = ConditionDataAccess.GetAll(_FormId); foreach (ConditionInfo condition in listCondition) { Condition obj = new Condition(condition.ConditionId); obj.FromActive = m_listActive.Find(delegate(Active active) { return(active.ActiveId == condition.FromActiveId); }); obj.ToActive = m_listActive.Find(delegate(Active active) { return(active.ActiveId == condition.ToActiveId); }); m_listCondition.Add(obj); } //Load Condition Sub //List<ConditionInfoSub> listConditionSub = SqlHelper.QueryTable<ConditionInfoSub>(BizConfig.ConnectionString, cfl); //foreach (ConditionInfoSub conditionSub in listConditionSub) //{ // m_listConditionSub.Add(new ConditionSub(conditionSub.ConditionSubId)); //} }
/// <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)); }