Dim SqlConnection1 As New SqlClient.SqlConnection(Application("SQLConnectionString"))
Dim SqlCommand1 As New SqlClient.SqlCommand
SqlCommand1.CommandText = "dbo.[CitationSearch]"
SqlCommand1.CommandType = System.Data.CommandType.StoredProcedure
SqlCommand1.Connection = SqlConnection1
SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@fk_User", System.Data.SqlDbType.Int, 4))
SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@SearchString", System.Data.SqlDbType.VarChar, 50))
SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@DaysBack", System.Data.SqlDbType.Int, 4))
SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@IsUnpaidPaidOnly", System.Data.SqlDbType.Bit, 1))
SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@IsOverdueOnly", System.Data.SqlDbType.Bit, 1))
With SqlCommand1.Parameters
.Item(0).Value = Me.Session.Item("userguid")
If Not Me.tbSearch.Text = String.Empty Then .Item(1).Value = Me.tbSearch.Text
If Not Me.RadioButtonList1.SelectedValue.Length < 1 Then
If Not Me.RadioButtonList1.SelectedValue = "No Limit" Then
.Item(2).Value = Integer.Parse(Me.RadioButtonList1.SelectedValue)
End If
End If
.Item(3).Value = Me.cbUnpaidOnly.Checked
.Item(4).Value = Me.cbOverDueOnly.Checked
End With
Dim dr As System.Data.SqlClient.SqlDataReader
SqlConnection1.Open()
dr = SqlCommand1.ExecuteReader(CommandBehavior.CloseConnection)
Me.SearchResultsStatusPanel.Visible = True
If Not dr.HasRows Then
Me.lblNoResults.Visible = True
Me.lblSearchResults.Visible = False
Me.SearchResultsPanel.Visible = False
Else
Me.lblSearchResults.Visible = True
Me.lblNoResults.Visible = False
Me.SearchResultsPanel.Visible = True
End If
Me.SearchResultRepeater.DataSource = dr
Me.SearchResultRepeater.DataBind()