示例#1
0
        private void btnAplicar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtSinapi.Text) && tvCompor.SelectedNode == null)
            {
                MessageBox.Show("Informe o código de integração.");
            }

            string textoParaAplicar = string.Empty;

            if (tvCompor.SelectedNode != null)
            {
                textoParaAplicar = tvCompor.SelectedNode.Text.Substring(0, tvCompor.SelectedNode.Text.IndexOf("-") - 1);
            }

            if (!string.IsNullOrEmpty(txtSinapi.Text))
            {
                textoParaAplicar = txtSinapi.Text;
            }

            if (treeElementos.SelectedNode.Nodes.Count == 0)
            {
                ElementoSelecionado.Invoke(Int32.Parse((string)treeElementos.SelectedNode.Tag), textoParaAplicar);
            }
            else
            {
                foreach (TreeNode node in treeElementos.SelectedNode.Nodes)
                {
                    ElementoSelecionado.Invoke(Int32.Parse((string)node.Tag), textoParaAplicar);
                }
            }

            MessageBox.Show("Código associado com sucesso.");
        }
示例#2
0
 private void btnAplicar_Click(object sender, EventArgs e)
 {
     if (treeElementos.SelectedNode.Nodes.Count == 0)
     {
         ElementoSelecionado.Invoke(Int32.Parse((string)treeElementos.SelectedNode.Tag), txtSinapi.Text);
     }
     else
     {
         foreach (TreeNode node in treeElementos.SelectedNode.Nodes)
         {
             ElementoSelecionado.Invoke(Int32.Parse((string)node.Tag), txtSinapi.Text);
         }
     }
 }