Пример #1
0
        private void btnOkCondition_Click(object sender, RoutedEventArgs e)
        {
            if (labelConditionEditing.Content.ToString().StartsWith("Edit"))
            {
                if (ruleConditionSet.RuleConditions == null)
                {
                    ruleConditionSet.RuleConditions = new List<RuleCondition>();
                }
                RuleCondition thisRC = ruleConditionSet.RuleConditions.Find(RuleCondition => RuleCondition.RuleConditionID == txtRuleConditionID.Text.Trim());
                if (thisRC == null)
                    txtStatus.Text = "Cannot get field: " + txtConditionField_Orig.Text;
                else
                {
                    thisRC.FieldNumber = Convert.ToInt32(cmbConditionField.SelectedItem.ToString().Substring(0,cmbConditionField.SelectedItem.ToString().IndexOf('|')).Trim()) ;
                    thisRC.OperatorList = cmbOperatorType.SelectedItem.ToString();
                    thisRC.SelectorList = txtSelector.Text;
                    thisRC.DisplayValue = txtDisplayValue.Text;
                    thisRC.ValueList = txtValueList.Text;
                    txtStatus.Text = " ";
                    globalDataChanged = origTextChanged(cmbConditionField, thisRC.FieldNumber.ToString());
                    globalDataChanged = origTextChanged(txtSelector, txtSelector.Text);
                    globalDataChanged = origTextChanged(cmbOperatorType, cmbOperatorType.SelectedValue.ToString());
                    globalDataChanged = origTextChanged(txtDisplayValue, txtDisplayValue.Text);
                    globalDataChanged = origTextChanged(txtValueList, txtValueList.Text);
                }
            }
            else //---- New Item ----
            {
                if (ruleConditionSet.RuleConditions == null)
                {
                    ruleConditionSet.RuleConditions = new List<RuleCondition>();
                }
                globalDataChanged = true;
                RuleCondition newRC = new RuleCondition();
                newRC.FieldNumber = Convert.ToInt32(cmbConditionField.SelectedItem.ToString().Substring(0, cmbConditionField.SelectedItem.ToString().IndexOf('|')).Trim());
                newRC.OperatorList = cmbOperatorType.SelectedItem.ToString();
                newRC.SelectorList = txtSelector.Text;
                newRC.DisplayValue = txtDisplayValue.Text;
                newRC.ValueList = txtValueList.Text;
                newRC.RuleConditionID = txtRuleConditionID.Text;

                ruleConditionSet.RuleConditions.Add(newRC);
            }

            updateTreeViewConditions();
            gridConditions.Visibility = System.Windows.Visibility.Hidden;
        }
Пример #2
0
        private void btnAddNewCondition_Click(object sender, RoutedEventArgs e)
        {
            btnAddNewCondition.Visibility = System.Windows.Visibility.Hidden;
            LabelNewCondition.Visibility = System.Windows.Visibility.Visible;
            cmbNewWhich.Visibility = System.Windows.Visibility.Visible;
            cmbNewCondition.Visibility = System.Windows.Visibility.Visible;
            cmbNewOperator.Visibility = System.Windows.Visibility.Visible;
            txtNewRuleValue.Visibility = System.Windows.Visibility.Visible;
            btnAddConditionCompleted.Visibility = System.Windows.Visibility.Visible;

            workingCondition = new RuleCondition();
        }