Beispiel #1
0
 public void Save()
 {
     try
     {
         if (ValidateForm())
         {
             if (cmbOperator.SelectedItem != null && cmbOperator.SelectedItem is OperatorItem)
             {
                 var oper = (OperatorItem)cmbOperator.SelectedItem;
                 if (oper.IsMultipleValuesType && !string.IsNullOrWhiteSpace(cmbValue.Text))
                 {
                     // Now we need to generate value nodes under this node instead of just adding the value
                     foreach (var valuestr in cmbValue.Text.Split(','))
                     {
                         var value    = valuestr.Trim();
                         var attrNode = TreeNodeHelper.AddChildNode(node, "value");
                         var coll     = new Dictionary <string, string>();
                         coll.Add("#text", value);
                         attrNode.Tag = coll;
                         TreeNodeHelper.SetNodeText(attrNode, FetchXmlBuilder.friendlyNames);
                     }
                     cmbValue.Text = "";
                 }
             }
             Dictionary <string, string> collection = ControlUtils.GetAttributesCollection(this.Controls, true);
             SendSaveMessage(collection);
             controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
         }
     }
     catch (ArgumentNullException ex)
     {
         MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
 }
        private void ExtractCommaSeparatedValues()
        {
            var oper = (OperatorItem)cmbOperator.SelectedItem;

            if (oper.IsMultipleValuesType && !string.IsNullOrWhiteSpace(cmbValue.Text))
            {
                // Now we need to generate value nodes under this node instead of just adding the value
                foreach (var valuestr in cmbValue.Text.Split(','))
                {
                    var value    = valuestr.Trim();
                    var attrNode = TreeNodeHelper.AddChildNode(Node, "value");
                    var coll     = new Dictionary <string, string>();
                    coll.Add("#text", value);
                    attrNode.Tag = coll;
                    TreeNodeHelper.SetNodeText(attrNode, fxb);
                }
                cmbValue.Text = "";
            }
        }