嗨,我的记录有问题。我得到如下的重复记录。我使用telerik radgrid hierachy来显示数据。它可以扩展,然后显示可用的服务。
MerchantID MerchantName BranchID BranchName
1001 AAA B01 BBB
1001 AAA B01 BBB
这是我的代码。请帮忙。感谢
Public Function GetMerchantList(ByVal aMerchant As TT_MERCHANT, ByVal aMerchantService As TT_MERCHANT_SERVICE) As List(Of MerchantApp)
Dim Db As New TTMSEntities
Dim Data = (From p In Db.TT_MERCHANT Join r In Db.TT_BRANCH_SETTING On _
p.MERCHANT_BRANCH_INTERNAL_NUM Equals r.INTERNAL_NUM Join t In Db.TT_MERCHANT_SERVICE On t.MERCHANT_INTERNAL_NUM Equals p.INTERNAL_NUM
Select New MerchantApp With {
.InternalNum = p.INTERNAL_NUM,
.MerchantID = p.MERCHANT_ID,
.MerchantName = p.DESCRIPTION,
.BranchID = r.BRANCH_ID,
.BranchName = r.BRANCH_DESC,
.ServiceID = t.MERCHANT_SERVICE_ID,
.ServiceName = t.DESCRIPTION})
If Not String.IsNullOrEmpty(aMerchant.MERCHANT_ID) Then
Data = Data.Where(Function(x) x.MerchantID = aMerchant.MERCHANT_ID)
End If
If Not String.IsNullOrEmpty(aMerchant.DESCRIPTION) Then
Data = Data.Where(Function(x) x.MerchantName.Contains(aMerchant.DESCRIPTION))
End If
If Not String.IsNullOrEmpty(aMerchant.ISACTIVE) Then
Data = Data.Where(Function(x) x.Status = aMerchant.ISACTIVE)
End If
If Not String.IsNullOrEmpty(aMerchantService.MERCHANT_SERVICE_ID) Then
Data = Data.Where(Function(x) x.ServiceID = aMerchantService.MERCHANT_SERVICE_ID)
End If
If Not String.IsNullOrEmpty(aMerchantService.DESCRIPTION) Then
Data = Data.Where(Function(x) x.ServiceName = aMerchantService.DESCRIPTION)
End If
Return Data.ToList()
End Function