Public Class frmWD_FulltextChoice

    Private Sub frmWD_FulltextChoice_Load(sender As Object, e As EventArgs) Handles Me.Load
        If CURRENT_NAVIGATION_TYPE = "NODE" Then
            Me.chkSubnode.Visible = True
        Else
            Me.chkSubnode.Visible = False
        End If
        Me.txtFulltextPattern.Text = ""
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        CURRENT_FULLTEXT_PATTERN = ""
        If txtFulltextPattern.Text <> "" Then
            CURRENT_FULLTEXT_PATTERN = txtFulltextPattern.Text
            If CURRENT_NAVIGATION_TYPE = "NODE" And chkSubnode.Checked Then
                CURRENT_SEARCH_TYPE = "FULLTEXT_SUBNODES"
                Dim node As TreeNode = CURRENT_SELECTED_NODE
                Dim NODE_GUID = ClassNodeNavigation.Return_NODEID_forTag(node.Tag)
                Dim sql = String.Format("DECLARE @return_value int " & vbNewLine & _
                    "EXEC	@return_value = [dbo].[PRPMO_NODES_GET_CHILD_RECORDS] @USER_ID = {0}, @NODE_ID = {1} " & vbNewLine & _
                    "SELECT	'Return Value' = @return_value", USER_GUID, NODE_GUID)
                Me.Cursor = Cursors.WaitCursor
                Dim DT As DataTable = ClassDatabase.Return_Datatable(sql)
                If Not IsNothing(DT) Then
                    Dim result = DT.Rows(0).Item(0)
                    If result <> 0 Then
                        ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in Getting SubNodes-Structure", "Check the logfile")
                    Else
                        Me.Close()
                    End If
                End If
                Me.Cursor = Cursors.Default
            Else
                CURRENT_SEARCH_TYPE = "FULLTEXT"
                Me.Close()
            End If

        End If
    End Sub
End Class