I am building my first n-tier application.
The second and third layer are used in different websites.
When i have a numeric field for the tax option. 1 = High BTW and 2=Low btw and 3 = No btw Is it a good design to make an translate function in the business Artikel class? If the answer is no, where is the correct place to translate values. I use this function in the view to show the text instead of the number.
Public Function ArtBtwShow() As String Return ArtikelHelper.GetBtwName(ArtBtw) End Function
GetBtwName Helper function:
Shared Function GetBtwName(Btw As String) Select Case Btw Case "0" Return "Geen" Case "1" Return "Laag" Case "2" Return "Hoog" Case Else Return "" End Select End Function
I'm not sure exactly what you're trying to do, but it looks like you need to use an Enum rather than a string for your Btw object:
Public Enum Btw Green = 0 Laag = 1 Hoog = 2 End Enum
I think the business layer is the place to put this.
You then retrieve the decription like so:
Public Funtion GetName(btw As Btw) return [Enum].GetName(GetType(Btw), (int)btw) End Function