Data Layer
Public Function GetAll() As List(Of SMSCLayer.PromoterType)
Dim result As New List(Of SMSCLayer.PromoterType)
Dim params As New List(Of DbParameter)
Dim dt As DataTable = GetSQLTable("select * from promotertype")
For Each dr As DataRow In dt.Rows
result.Add(New SMSCLayer.PromoterType() With {.Id = ToInteger(dr("Id")),
.Name = ToString(dr("Name"))})
Next
Return result
End Function
Business Layer
Public Shared Function GetAll() As List(Of SMSCLayer.PromoterType)
Dim d As New SMSDLayer.PromoterType
Return d.GetAll()
End Function
Communication Layer
Public Class PromoterType
Public Property Id As Long = 0
Public Property Name As String = String.Empty
End Class
Presentation Layer
Private Sub FillPromoterTypeCombo()
Dim result As New List(Of SMSCLayer.PromoterType)
result = SMSBLayer.PromoterType.GetAll()
result.Insert(0, New SMSCLayer.PromoterType() With {.Id = 0, .Name = "Select"})
cmbPromoterType.DataSource = result
cmbPromoterType.DisplayMember = "Name"
cmbPromoterType.ValueMember = "Id"
cmbPromoterType.SelectedIndex = 0
End Sub
No comments:
Post a Comment