Asp.Net 2.0 Profile: Need help in Class. Thank You.

M

Miguel Dias Moura

Hello,

I am saving a complex type in Asp.Net 2.0 profile.
I am using an SQL 2005 database as a profile provider.

I have been consulting MSDN as help to create my class.
(Please, see my code at the end of this post)

OBJECTIVE:
- Save the documents published by each user in profile.
- Create operations to manage documents.

My main problems and questions are:

1. How to retrieve ALL items (documents) from ALL users?

2. To remove an item (document) I use Me._documents.Remove(document).
How to specify which document to retrive?
Which field should I use?

3. I need to search trough my documents using keywords inserted in a
textbox.
I was looking at System.Predicate but I am having a few problems.

a) Should I use or not System.Predicate

b) How to solve the error:
"Value of type 'System.Collections.Generic.List(Of Document)'
cannot be converted to 'Document'"
I get in the code line.
"Dim document As Document = _documents.FindAll(predicate)"

c) I have no idea of how to translate the keywords in my textbox to
my predicate.
If it could work with "AND", "OR" or "List Field = ..." like in
Google it would be a dream.

Could someone, please, help me?

Here is the code I have in this moment:

' ----------------------
Imports Microsoft.VisualBasic


<Serializable()> Public Class Document

Private _title As String
Private _subject As String
Private _file As String

Public Property Title() As String
Get
Return _title
End Get
Set(ByVal value As String)
If _title = value Then
Return
End If
_title = value
End Set
End Property

Public Property Subject() As String
Get
Return _subject
End Get
Set(ByVal value As String)
If _subject = value Then
Return
End If
_subject = value
End Set
End Property

Public Property File() As String
Get
Return _file
End Get
Set(ByVal value As String)
If _file = value Then
Return
End If
_file = value
End Set
End Property

End Class


<Serializable()> Public Class Documents

Private _documents As New Generic.List(Of Document)

Public ReadOnly Property All() As Generic.List(Of Document)
Get
Return Me._documents
End Get
End Property

Public Sub Add(ByVal document As Document)
Me._documents.Add(document)
End Sub

Public Sub Remove(ByVal documento As Document)
Me._documents.Remove(document)
End Sub

Public ReadOnly Property Find(ByVal predicate As Predicate(Of
Document)) As Generic.List(Of Document)
Get
Dim document As Document = _documents.FindAll(predicate)
Return _documents
End Get
End Property

End Class

' ---------------------

Thank You Very Much,
Miguel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top