Help with MemberDetails.vb

Topics: Developer Discussion, Help
Apr 30, 2007 at 8:19 PM
I changed a part MemberDetails.vb from

'If Not member Is Nothing Then
' If Filter = "" OrElse member.lastname.StartsWith(Filter, StringComparison.CurrentCultureIgnoreCase) Then
' l.Add(New MemberDetails(user, member))
' End If
'End If

to
If Filter = "" Then
If Year <> "" Then
If user.UserName.EndsWith(Year, StringComparison.CurrentCulture) Then
l.Add(New MemberDetails(user, member))
End If
End If
Else
If member.lastname.StartsWith(Filter, StringComparison.CurrentCultureIgnoreCase) Then
l.Add(New MemberDetails(user, member))
End If
End If

so that I can do a search for members based on a class year (in this case every username ends in the class year).

It works great in my development server. When I put it on my live server it errors out with "Exception has been thrown by the target of an invocation" on IE6, IE7, and Firefox.
May 1, 2007 at 6:21 PM
Nevermind. I rewrote the entire memberdetails.vb and made it work completely different. instead of loading all the members and then filtering them out using filter in the dataset, I run a query every time someone clicks on the letter. This gets rid of the load time it takes to load some ~2000 records and sorting through them.

It now looks like this

Imports Microsoft.VisualBasic

'Note that this class uses the dataset to create the strongly typed access to the data.

Public Class MemberDetails

Public Shared Function Getmembers(ByVal Filter As String, ByVal Details As String) As Generic.List(Of MemberDetails)
Dim l As New Generic.List(Of MemberDetails)
Dim da As New DataSetTableAdapters.MemberInfoTableAdapter
Dim members As Data.DataTable
Dim Switcher As Integer

Switcher = Integer.Parse(Filter)

Select Case (Switcher)
Case 0
members = da.GetByLetter(Details)
Case 1
members = da.GetByYear(Details)
Case 2
members = da.GetByState(Details)
Case Else
Return Nothing
Exit Function
End Select

For Each member As Data.DataRow In members.Rows
l.Add(New MemberDetails(member))
Next
Return l

End Function

Private Sub New(ByVal member As Data.DataRow)
If Not member Is Nothing Then
m_UserName = member("UserName").ToString()
m_Email = member("Email").ToString()
m_firstname = member("firstname").ToString()
m_LastName = member("lastname").ToString()
m_address = member("address").ToString()
m_Phone = member("phone").ToString()
m_newsletter = member("newsletter").ToString()
If Not (member("AvatarSize").ToString() = System.DBNull.Value.ToString()) Then
m_PhotoURL = "~\UserControls\AvatarImagefetch.ashx?Memberid=" & member("memberid").ToString()
End If
End If
End Sub


Private m_newsletter As Boolean
Public ReadOnly Property Newsletter() As Boolean
Get
Return m_newsletter
End Get
End Property

Private m_firstname As String
Public ReadOnly Property FirstName() As String
Get
Return m_firstname
End Get
End Property

Private m_LastName As String
Public ReadOnly Property LastName() As String
Get
Return m_LastName
End Get
End Property

Private m_address As String
Public ReadOnly Property Address() As String
Get
Return m_address
End Get
End Property

Private m_UserName As String
Public ReadOnly Property UserName() As String
Get
Return m_UserName
End Get
End Property

Private m_PhotoURL As String
Public ReadOnly Property PhotoURL() As String
Get
Return m_PhotoURL
End Get
End Property

Private m_Email As String
Public ReadOnly Property Email() As String
Get
Return m_Email
End Get
End Property

Private m_Phone As String
Public ReadOnly Property Phone() As String
Get
Return m_Phone
End Get
End Property

End Class

Jun 16, 2007 at 3:12 PM
I'd be very interested in seeing the rest of this code. How did you do the da.GetByLetter(Details) type code? Obviously it's somewhere in the DataSetTableAdapters.MemberInfoTableAdapter, but how do you do that?

I'd also be interested in seeing the front-end web code.

Coordinator
Jun 16, 2007 at 5:58 PM

Tina wrote:
I'd be very interested in seeing the rest of this code. How did you do the da.GetByLetter(Details) type code? Obviously it's somewhere in the DataSetTableAdapters.MemberInfoTableAdapter, but how do you do that?

I'd also be interested in seeing the front-end web code.




We will do this same sort of thing once the memberinfo stuff uses SubSonic. We will do a similar thing in the v3 time frame.
Coordinator
Jun 21, 2007 at 6:04 AM
I lied... its checked in now :) Go take a look.