开发者

Search An Enum Value inside of An Enum

开发者 https://www.devze.com 2023-03-30 07:19 出处:网络
I\'ve tried the code below but it always returns nothing, It should enter Protected Function GetTotalDebitAmount(ByRef roEntryDetailRecordBaseList As List(Of PPDEntryDetailRecord)) As String

I've tried the code below but it always returns nothing, It should enter

Protected Function GetTotalDebitAmount(ByRef roEntryDetailRecordBaseList As List(Of PPDEntryDetailRecord)) As String
    Dim iTotal As Integer = 0
    If Me.BatchHeaderRecord.ServiceClassCode = Convert.ToString(CInt(ServiceClassCodes.EntriesMixedDebitsAndCredits)) Then
        For Each oEntryDetailRecord As PPDEntryDetailRecord In roEntryDetailRecordBaseList
            If CBool(Array.IndexOf([Enum].GetValues(GetType(TransactionCodes.Debits)), CInt(oEntryDetailRecord.TransactionCode)) > 0) Then
                iTotal += CInt(oEntryDetailRecord.Amount)
            End If
        Next
    End If

    Return CStr(iTotal)
End Function

I need some one who evaluate the part below:

If CBool(Array.IndexOf([Enum].GetValues(GetType(TransactionCodes.Debits)), CInt(o开发者_开发问答EntryDetailRecord.TransactionCode)) > 0) Then

Thanks.


Anyways,

I've found the answer:

If [Enum].IsDefined(GetType(TransactionCodes.Debits), CInt(oEntryDetailRecord.TransactionCode)) Then
                    iTotal += CInt(oEntryDetailRecord.Amount)
End If
0

精彩评论

暂无评论...
验证码 换一张
取 消