Imports System.Data.SqlClient
Imports System.IO
Imports System.Data

Partial Class SearchControl
    Inherits System.Web.UI.UserControl

    Public Sub ListDocuments(ByVal searchText As String)

        'about-Pay-Per-View.
        Dim documentManager As New DMSAdmin.DocumentManagerBL
        documentManager.Credentials = Net.CredentialCache.DefaultNetworkCredentials

        resultListBox.Visible = True

        Dim documents() As DMSAdmin.BLHTMLDocument = documentManager.GetDocumentByKeyword(Trim(searchText))
        resultListBox.DataSource = documents
        resultListBox.DataBind()

    End Sub


    Public Function folderIdByDocId(ByVal docId As Integer) As Integer
        Dim documentManager As New DMSAdmin.DocumentManagerBL
        documentManager.Credentials = Net.CredentialCache.DefaultNetworkCredentials

        Dim folderid As Integer = documentManager.GetDocumentFolderIDByDocumentID(docId)
        Return folderid

    End Function

    Protected Sub SearchButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SearchButton.Click
        ListDocuments(searchText.Text)

    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            If Not Page.IsPostBack Then

                If Len(Request.QueryString("DcoumentID")) > 0 And Len(Request.QueryString("FolderID")) > 0 Then
                    Dim searchTable As Panel = FindControl("searchTable")
                    If (Not searchTable Is Nothing) Then
                        searchTable.BackColor = System.Drawing.Color.FromArgb("&H" + "F8FAFC")
                    End If
                End If
            End If
        Catch ex As Exception
            Throw ex
        End Try

    End Sub

End Class


