Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie - Custom Namespace 2

Status
Not open for further replies.

MEGUIA

Programmer
Sep 26, 2001
62
PR
Hi,

I created three class library(Names: businness object, Businness Logic, Data Access), what I'm trying to do is a three layer tier. I know I have to compile as DLL but I want to import as a namespace. How I make a reference to my namespace?. I doing like this and the differents project doesn't see it. Any help would be appreciate. Thank you

Imports System
Imports System.ComponentModel
Imports System.Transactions
Imports Smartgap.SGPoliApliManager.BO
Imports Smartgap.SGPoliApliManager.DAL
Namespace Smartgap.SGPoliApliManager.Bll
<DataObjectAttribute()> _
Public Class SGClientManager
<DataObjectMethod(DataObjectMethodType.Select, True)> _
Public Shared Function GetList() As ContactPersonList
Return ContactPersonDB.GetList
End Function

<DataObjectMethod(DataObjectMethodType.Select, False)> _
Public Shared Function GetItem(ByVal id As Integer) As client
Return GetItem(id, False)
End Function

<DataObjectMethod(DataObjectMethodType.Select, False)> _
Public Shared Function GetItem(ByVal id As Integer, ByVal getContactRecords As Boolean) As ContactPerson
Dim myContactPerson As ContactPerson = ContactPersonDB.GetItem(id)
If Not (myContactPerson Is Nothing) AndAlso getContactRecords Then
myContactPerson.Addresses = AddressDB.GetList(id)
myContactPerson.EmailAddresses = EmailAddressDB.GetList(id)
myContactPerson.PhoneNumbers = PhoneNumberDB.GetList(id)
End If
Return myContactPerson
End Function

<DataObjectMethod(DataObjectMethodType.Update, True)> _
Public Shared Function Save(ByVal myContactPerson As ContactPerson) As Integer
' Using
Dim myTransactionScope As TransactionScope = New TransactionScope
Try
Dim contactPersonId As Integer = ContactPersonDB.Save(myContactPerson)
For Each myAddress As Address In myContactPerson.Addresses
myAddress.ContactPersonId = contactPersonId
AddressDB.Save(myAddress)
Next
For Each myEmailAddress As EmailAddress In myContactPerson.EmailAddresses
myEmailAddress.ContactPersonId = contactPersonId
EmailAddressDB.Save(myEmailAddress)
Next
For Each myPhoneNumber As PhoneNumber In myContactPerson.PhoneNumbers
myPhoneNumber.ContactPersonId = contactPersonId
PhoneNumberDB.Save(myPhoneNumber)
Next
myContactPerson.Id = contactPersonId
myTransactionScope.Complete()
Return contactPersonId
Finally
CType(myTransactionScope, IDisposable).Dispose()
End Try
End Function

<DataObjectMethod(DataObjectMethodType.Delete, True)> _
Public Shared Function Delete(ByVal myContactPerson As ContactPerson) As Boolean
Return ContactPersonDB.Delete(myContactPerson.Id)
End Function

End Class
End Namespace

 
In your project, put
Imports Smartgap.SGPoliApliManager.Bll at the top
 
Hi Kalisto,

Thank you for your reply.

The imports are already on the top.

Do I have to make a reference in the designate project, the DLL?
 
>>Do I have to make a reference in the designate project

yes, or simply copy the assembly that you are referring to and place it in your BIN folder...

Known is handfull, Unknown is worldfull
 
Hi Kalisto,

Thank you for your help. It works. WOOOHooooo!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top