private void btnAdd_Click(object sender, RoutedEventArgs e) { if (cboInfo.SelectedItem as StateType == null) { ComfirmWindow.ConfirmationBox("提示信息", "处理角色不能为空!", "确定"); return; } if (_counterSignRoleList == null) _counterSignRoleList = new List<CounterSignRole>(); CounterSignRole newCondition = new CounterSignRole(); newCondition.StateCode = (cboInfo.SelectedItem as StateType).StateCode; if (cbOtherCompany.IsChecked == true) { newCondition.IsOtherCompany = true; newCondition.OtherCompanyId = ((cboOtherCompany.SelectedItem) as SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY).COMPANYID; } else { newCondition.IsOtherCompany = false; newCondition.OtherCompanyId = ""; } newCondition.StateName = (cboInfo.SelectedItem as StateType).StateName; newCondition.TypeCode = (cboUserType.SelectedItem as UserType).TypeCode; newCondition.TypeName = (cboUserType.SelectedItem as UserType).TypeName; _counterSignRoleList.Add(newCondition); dgCodition.ItemsSource = null; dgCodition.ItemsSource = _counterSignRoleList; //增加完后变空 CompanyName = ""; CompanyID = ""; btnSearch.IsEnabled = false; cbOtherCompany.IsChecked = false; }
private void btnOk_Click(object sender, RoutedEventArgs e) { if (_activityObject == null) { _activityObject = new ActivityObject(); _activityObject.ActivityId = _activity.UniqueID; _activityObject.CounterType = cboRule.SelectedIndex.ToString(); } _activityObject.Remark = this.txtActivityName.Text; if (counterSignRoleList == null) counterSignRoleList = new List<CounterSignRole>(); CounterSignRole newCondition = new CounterSignRole(); if (cboUserType.SelectedItem != null) { newCondition.TypeCode = (cboUserType.SelectedItem as UserType).TypeCode; newCondition.TypeName = (cboUserType.SelectedItem as UserType).TypeName; } else { ComfirmWindow.ConfirmationBox("提示信息", "用户类型没有出来,请重新选择!", "确定"); return; } _activityObject.IsCounterSign = true; newCondition.StateCode = (cboCountersignRoles.SelectedItem as StateType).StateCode; if (cbOtherCompany.IsChecked == true) { newCondition.IsOtherCompany = true; newCondition.OtherCompanyId = ((cboOtherCompany.SelectedItem) as SMT.Saas.Tools.OrganizationWS.V_COMPANY).COMPANYID; newCondition.OtherCompanyName = ((cboOtherCompany.SelectedItem) as SMT.Saas.Tools.OrganizationWS.V_COMPANY).CNAME; } else { newCondition.IsOtherCompany = false; newCondition.OtherCompanyId = ""; newCondition.OtherCompanyName = ""; } newCondition.StateName = (cboCountersignRoles.SelectedItem as StateType).StateName; _activityObject.IsSpecifyCompany = false; _activityObject.OtherCompanyId = ""; _activityObject.OtherCompanyName = ""; _activityObject.RoleId = ""; _activityObject.RoleName = ""; _activityObject.UserType = ""; _activityObject.ActivityId = "State" + _activity.UniqueID; _activityObject.CounterType = cboRule.SelectedIndex.ToString(); var item = counterSignRoleList.Where(p => p.StateCode == (cboCountersignRoles.SelectedItem as StateType).StateCode).FirstOrDefault(); if (item == null) { counterSignRoleList.Add(newCondition); dgCountersign.ItemsSource = null; dgCountersign.ItemsSource = counterSignRoleList; } _activityObject.CounterSignRoleList = counterSignRoleList; //if (_activityObject.CounterSignRoleList != null && _activityObject.CounterSignRoleList.Count > 0) //{//已有角色 // if (item == null) // { // counterSignRoleList.Add(newCondition); // dgCountersign.ItemsSource = null; // dgCountersign.ItemsSource = counterSignRoleList; // } //} //else //{//没有角色 // counterSignRoleList.Add(newCondition); // _activityObject.CounterSignRoleList = counterSignRoleList; //} UpdateActivityObject(_activityObject); if (this.chkGroupAudit.IsChecked == true) { this.txtActivityName.Text = ""; this.txtActivityName.Text = "会签节点"; } }
/// <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 }