/// <summary> /// 更新连线的集合(如果连线不存在,就加入到集合里) /// </summary> /// <param name="activity">连线</param> /// <returns></returns> public void UpdateLineObject(LineObject activity) { var e = from a in LineObjects where a.LineId == activity.LineId select a; var ent = e.FirstOrDefault(); if (ent != null) { //先删除后增加,保证数据是最新的 LineObjects.Remove(ent); LineObjects.Add(activity); } else { LineObjects.Add(activity); } }
/// <summary> /// 定义规则返回事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void dialog_Closed(object sender, EventArgs e) { FlowRuleDefineDialog dialog = sender as FlowRuleDefineDialog; if (dialog.DialogResult == true) { if (_lineObject == null) { _lineObject = new LineObject(); } _lineObject.ConditionList = dialog.ConditionList; UpdateLineObject(_lineObject); //SetRulesText(); } }
public void ConditionBind(LineObject activity) { var e = from a in LineObjects where a.LineId == activity.LineId select a; _conditionList = e.FirstOrDefault().ConditionList; dgCodition.ItemsSource = null; dgCodition.ItemsSource = e.FirstOrDefault().ConditionList; }
public void ShowPropertyWindow(UIElement element) { _lineControl = element as LineControl;//旧的 if (_lineControl == null) { return; } #region 如果是新建连线就创对_lineObject对象 if (_lineObject == null) { LineObject obj = LineObjects.Where(p => p.LineId.Equals( _lineControl.UniqueID)).SingleOrDefault(); if (obj == null) { _lineObject = new LineObject(); _lineObject.LineId = _lineControl.UniqueID; } else { _lineObject = obj; } UpdateLineObject(_lineObject); } #endregion }
/// <summary> /// 获取流程的集合 /// </summary> private void GetFlowDefine() { _activityObjects.Clear(); _lineObjects.Clear(); XElement root = XElement.Parse(_currentFlow.FlowDefinition.LAYOUT); #region 活动集合 var el = from e in root.Elements("Activitys") select e; foreach (var ent in el.Nodes()) { XElement node = ent as XElement; ActivityObject activity = new ActivityObject(); activity.CounterSignRoleList = new List<CounterSignRole>(); #region 活动 activity.ActivityId = node.Attribute("Name").Value; activity.UserType = node.Attribute("UserType").Value; activity.IsSpecifyCompany = GetAttributeValue(node, "IsOtherCompany").ToLower() == "true" ? true : false; // node.Attribute("IsOtherCompany").Value.ToLower() == "true" ? true : false; activity.OtherCompanyId = GetAttributeValue(node, "OtherCompanyID");// node.Attribute("OtherCompanyID").Value; activity.RoleId = GetAttributeValue(node, "RoleName");// node.Attribute("RoleName").Value; activity.RoleName = GetAttributeValue(node, "RoleName");// node.Attribute("RoleName").Value; activity.Remark = node.Attribute("Remark").Value; activity.OtherCompanyName = GetAttributeValue(node, "OtherCompanyName");//node.Attribute("OtherCompanyName") != null ? node.Attribute("OtherCompanyName").Value : ""; #endregion #region Countersigns XElement xsigns = node.Elements("Countersigns").FirstOrDefault(); if (xsigns != null) { activity.IsCounterSign = xsigns.Nodes().Count() > 0 ? true : false; //xsigns.Attribute("CountersignType").Value == "0" ? true : false; activity.CounterType = xsigns.Attribute("CountersignType").Value; #region Countersign foreach (var sign in xsigns.Nodes()) { XElement de = sign as XElement; CounterSignRole role = new CounterSignRole(); role.StateCode = de.Attribute("StateType").Value; role.StateName = de.Attribute("RoleName").Value; role.IsOtherCompany = de.Attribute("IsOtherCompany").Value.ToLower() == "true" ? true : false; role.OtherCompanyId = de.Attribute("OtherCompanyID").Value; role.OtherCompanyName =de.Attribute("OtherCompanyName")!=null? de.Attribute("OtherCompanyName").Value:""; role.TypeCode = de.Attribute("UserType").Value; role.TypeName = de.Attribute("UserTypeName") != null ? de.Attribute("UserTypeName").Value : ""; activity.CounterSignRoleList.Add(role); } } #endregion #endregion _activityObjects.Add(activity); } #endregion //==added by jason, 02/24/2012=== if (root.Elements("System").FirstOrDefault() != null) _systemNameFromLayout = root.Elements("System").FirstOrDefault().Value; #region 连线集合 var ru = from e in root.Elements("Rules") select e; foreach (var ent in ru.Nodes()) { XElement node = ent as XElement; LineObject line = new LineObject(); line.ConditionList = new List<CompareCondition>(); #region Rule line.LineId = node.Attribute("Name").Value; //added by jason, 02/16/2012 line.Remark = node.Attribute("Remark") != null ? node.Attribute("Remark").Value : ""; //end added by jason, 02/16/2012 #endregion #region Conditions if (node.Elements("Conditions").FirstOrDefault() != null) { //==added by jason, 02/24/2012=== _objectNameFromLayout = node.Elements("Conditions").FirstOrDefault().Attribute("Object").Value; line.Object = node.Elements("Conditions").FirstOrDefault().Attribute("Object").Value; line.CodiCombMode = node.Elements("Conditions").FirstOrDefault().Attribute("CodiCombMode").Value; #endregion #region Condition foreach (var tion in node.Elements("Conditions").Nodes()) { XElement xnode = tion as XElement; CompareCondition cc = new CompareCondition(); cc.Name = xnode.Attribute("Name").Value; cc.Description = xnode.Attribute("Description").Value; cc.CompAttr = xnode.Attribute("CompAttr").Value; cc.DataType = xnode.Attribute("DataType").Value; cc.Operate = xnode.Attribute("Operate").Value; cc.CompareValueMark = GetAttributeValue(xnode, "CompareValueMark"); cc.CompareValue = xnode.Attribute("CompareValue").Value; line.ConditionList.Add(cc); } } #endregion _lineObjects.Add(line); } #endregion }
/// <summary> /// 刷新连线数据 /// </summary> /// <param name="id"></param> private void RefreshLineData(string id) { LineObject lineObject = _lineObjects.Where(p => p.LineId.Equals(id)).SingleOrDefault(); if (lineObject != null) _lineObjects.Remove(lineObject); lineObject = new LineObject() { LineId = id, ConditionList = ucFlowSetting.lineProperty.LineObjectData == null ? null : ucFlowSetting.lineProperty.LineObjectData.ConditionList, }; _lineObjects.Add(lineObject); }