Example #1
0
        //public void LoadConditions(List<FLOW_RULES> ruleslist)
        //{
        //    btnLookUp.Visibility = Visibility.Collapsed;
        //    cboPostLevel.Visibility = Visibility.Collapsed; 
        //    OrganizationCondition();
        //    GetPostLevel();
        //    dgCodition.ItemsSource = null;
        //    dgCodition.ItemsSource = ruleslist;
        //    cboOperate.SelectedIndex = 0;
        //}

        #region 增加条件

        private void btnAddCondition_Click(object sender, RoutedEventArgs e)
        {
            if (_conditionList == null) _conditionList = new List<CompareCondition>();
            if (cboField.SelectedItem != null)
            {
                if (!string.IsNullOrEmpty(txtCompareValue.Text.Trim()))
                {
                    CompareCondition newCondition = new CompareCondition()
                    {
                        Name = System.Guid.NewGuid().ToString(),
                        Description = (cboField.SelectedItem as WFBOAttribute).Description,
                        CompAttr = (cboField.SelectedItem as WFBOAttribute).Name,
                        DataType = (cboField.SelectedItem as WFBOAttribute).DataType,
                        Operate = ((System.Windows.Controls.ContentControl)(cboOperate.SelectedItem)).Content.ToString(),
                        CompareValue = txtCompareValue.Text.Trim().ToString(),
                    };
                    _conditionList.Add(newCondition);
                }
                else
                {
                    ComfirmWindow.ConfirmationBox("提示信息", "比较值不能为空!", "确定");
                }
            }
            dgCodition.ItemsSource = null;
            dgCodition.ItemsSource = _conditionList;
        }
Example #2
0
 private void but_Add_Click(object sender, RoutedEventArgs e)
 {
     if (_conditionList == null) _conditionList = new List<CompareCondition>();
     if (cboField.SelectedItem != null )
     {
         if (!string.IsNullOrEmpty(txtCompareValue.Text.Trim()))
         {
             //if (_conditionList.Count > 0)
             //{
             //    ComfirmWindow.ConfirmationBox("提示信息", "只能设置一个条件!", "确定");
             //}
             //else
             //{
                 CompareCondition newCondition = new CompareCondition()
                 {
                     Name = System.Guid.NewGuid().ToString(),
                     Description = (cboField.SelectedItem as WFBOAttribute).Description,
                     CompAttr = (cboField.SelectedItem as WFBOAttribute).Name,
                     DataType = (cboField.SelectedItem as WFBOAttribute).DataType,
                     Operate = ((System.Windows.Controls.ContentControl)(cboOperate.SelectedItem)).Tag.ToString(),
                     CompareValue = txtCompareValue.Text.Trim().ToString(),
                 };
                 var item = _conditionList.Where(p => p.Description == (cboField.SelectedItem as WFBOAttribute).Description).FirstOrDefault();
                 if (item == null || (item.CompareValue != newCondition.CompareValue && item.Operate != newCondition.Operate))
                 {
                     _conditionList.Add(newCondition);
                 }
             //}
         }
         else
         {
             ComfirmWindow.ConfirmationBox("提示信息", "比较值不能为空!", "确定");
         }
     }
     dgCodition.ItemsSource = null;
     dgCodition.ItemsSource = _conditionList;
     _lineObject.ConditionList = _conditionList;
     UpdateLineObject(_lineObject);
 }
Example #3
0
        /// <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
        }