Public Function GenearicList1(ByVal parFromDate As String, ByVal parToDate As String, ByVal bondvalueFrom As String, _
ByVal bondvalueTo As String, ByVal broker As String, ByVal businessName As String) As System.Collections.Generic.List(Of TB.Props.clsPropBondNotAcceptedReport)
Dim OleDbCon As OleDbConnection = Nothing
Dim OleDbDA As OleDbDataAdapter = Nothing
Dim dt As DataTable = Nothing
Dim objProp As TB.Props.clsPropBondNotAcceptedReport = Nothing
Try
Dim objLsit As New System.Collections.Generic.List(Of TB.Props.clsPropBondNotAcceptedReport)
OleDbCon = TB.CommonFunctions.clsCommonFunctions.OleDbConnections()
OleDbDA = New OleDbDataAdapter("", OleDbCon)
OleDbCon.Open()
dt = New DataTable()
OleDbDA.SelectCommand.CommandText = "select [Case Opened Date], " & _
"[BondsID], " & _
"[Business Name], " & _
"[Bond Type], " & _
"[Actual Bond Amt], " & _
"[Current Rate], " & _
"[Annual Income], " & _
"[Reasons] " & _
" from bonds where NextActioner='Declined' And " & _
"[Case Opened Date] >=" & parFromDate & " and [Case Opened Date] <=" & parToDate & _
IIf(broker = "", "", "And [Broker Name] Like '" & broker & "'").ToString() & _
IIf(businessName = "", "", "And [Business Name] Like '" & businessName & "'").ToString()
OleDbDA.Fill(dt)
OleDbCon.Close()
If (dt.Rows.Count > 0) Then
For i As Integer = 0 To dt.Rows.Count - 1
objProp = New TB.Props.clsPropBondNotAcceptedReport()
objProp.CaseOpenDate = IIf(IsDBNull(dt.Rows(i)("Case Opened Date")), "", Convert.ToDateTime(dt.Rows(i)("Case Opened Date")).ToString("MM/dd/yyyy")).ToString()
objProp.DataBaseRefNo = IIf(IsDBNull(dt.Rows(i)("BondsID")), "", dt.Rows(i)("BondsID")).ToString()
objProp.BusinessName = IIf(IsDBNull(dt.Rows(i)("Business Name")), "", dt.Rows(i)("Business Name")).ToString()
objProp.ValueOfBond = IIf(IsDBNull(dt.Rows(i)("Actual Bond Amt")), "", dt.Rows(i)("Actual Bond Amt")).ToString()
objProp.Premium = IIf(IsDBNull(dt.Rows(i)("Current Rate")), "", dt.Rows(i)("Current Rate")).ToString()
objProp.IncomeGenerated = IIf(IsDBNull(dt.Rows(i)("Annual Income")), "", dt.Rows(i)("Annual Income")).ToString()
objProp.Reason = IIf(IsDBNull(dt.Rows(i)("Reasons")), "", dt.Rows(i)("Reasons")).ToString()
objLsit.Add(objProp)
Next
End If
Return objLsit
Catch ex As Exception
Throw New Exception(ex.Message)
End Try
No comments:
Post a Comment