home *** CD-ROM | disk | FTP | other *** search
/ 41-134-104-147.dsl.mweb.co.za / 41-134-104-147.dsl.mweb.co.za.tar / 41-134-104-147.dsl.mweb.co.za / transHistory.aspx.vb < prev    next >
Text File  |  2010-08-24  |  5KB  |  127 lines

  1. ∩╗┐Imports Microsoft.Web.Services3.Messaging
  2. Imports Microsoft.Web.Services3
  3. Imports Microsoft.Web.Services3.Addressing
  4. Imports System.Net
  5. Imports System.IO
  6. Imports System.Xml
  7. Imports Mercantile.PrimeServices
  8.  
  9. Partial Class transHistory
  10.     Inherits System.Web.UI.Page
  11.     Dim myFunctions As New Functions
  12.  
  13.     Protected Sub imgSubmit_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgSubmit.Click
  14.         Dim fromYr As Integer = cmbFromYr.SelectedValue
  15.         Dim fromMt As Integer = cmbFromMt.SelectedValue
  16.         Dim fromDt As Integer = cmbFromDt.SelectedValue
  17.         Dim toYr As Integer = cmbToYr.SelectedValue
  18.         Dim toMt As Integer = cmbToMt.SelectedValue
  19.         Dim toDt As Integer = cmbToDt.SelectedValue
  20.         If fromDt > Date.DaysInMonth(fromYr, fromMt) Then fromDt = Date.DaysInMonth(fromYr, fromMt)
  21.         If toDt > Date.DaysInMonth(toYr, toMt) Then toDt = Date.DaysInMonth(toYr, toMt)
  22.         Dim fromDate As Date = New Date(fromYr, fromMt, fromDt)
  23.         Dim toDate As Date = New Date(toYr, toMt, toDt)
  24.         If Not fromDate > toDate Then
  25.             Dim dFrom As String = fromDate.ToString("yyyy-MM-dd")
  26.             Dim dTo As String = toDate.ToString("yyyy-MM-dd")
  27.             'testMe()
  28.             getTransHistory(dFrom, dTo)
  29.         End If
  30.     End Sub
  31.  
  32.  
  33.     Private Sub getTransHistory(Optional ByVal dFrom As String = Nothing, Optional ByVal dTo As String = Nothing)
  34.         Dim cardNumber As String = Request.Cookies("hcCNum").Value
  35.         Dim failMe As Boolean = False
  36.         Dim trxResponse As StatementInquiryResponse
  37.         Try
  38.             Dim prmServices As New PrimeServices
  39.             Dim trxRequest As New StatementInquiryRequest()
  40.             trxRequest.Header = New Header
  41.             trxRequest.Header.MessageID = "trnTest"
  42.             trxRequest.Content = Global.ContentType.Card
  43.             trxRequest.DateFrom = dFrom
  44.             trxRequest.DateTo = dTo
  45.             trxRequest.Number = cardNumber
  46.             trxRequest.Paging = New Paging
  47.             trxRequest.Paging.Key = ""
  48.             trxRequest.Paging.Size = 0
  49.             trxRequest.Period = PeriodType.FromTo
  50.             trxRequest.Reference = "C"
  51.  
  52.             trxresponse = prmServices.StatementInquiry(trxRequest)
  53.             Dim stmtHeader As StatementHeaderEntity = trxResponse.StatementHeader
  54.             Dim address As AddressEntity = stmtHeader.Address
  55.             Dim transactions As New ArrayList
  56.             For Each trx As TrxnEntity In trxResponse.Transaction
  57.                 For Each trxDet As TransactionDetailsEntity In trx.Details
  58.                     transactions.Add(trxDet)
  59.                 Next
  60.             Next
  61.             lblError.Text = ""
  62.  
  63.  
  64.             Dim myPaging As StatementHeaderEntity = trxResponse.StatementHeader
  65.             If Not myPaging Is Nothing Then
  66.                 lblError.Text = myPaging.AccountNo
  67.             Else
  68.                 lblError.Text = "No paging"
  69.             End If
  70.             If transactions.Count > 0 Then
  71.                 GridView1.DataSource = transactions
  72.             Else
  73.                 GridView1.DataSource = Nothing
  74.             End If
  75.             GridView1.DataBind()
  76.         Catch ex As Exception
  77.             lblError.Text = trxResponse.Result.Description
  78.             failMe = True
  79.         End Try 
  80.  
  81.     End Sub
  82.  
  83.     Protected Sub imgHome_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgHome.Click
  84.         Response.Redirect("~/enquiries.aspx", True)
  85.     End Sub
  86.  
  87.     Protected Sub imgLogout_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgLogout.Click
  88.         If myFunctions.logout(Me.Context) Then Response.Redirect("~/Default.aspx", True)
  89.     End Sub
  90.  
  91.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  92.         If Not myFunctions.testLogin(Me.Context) Then
  93.             Response.Redirect("~/Default.aspx", True)
  94.         Else
  95.             myFunctions.logMe(Request.Cookies("hcUid").Value, "Transaction history")
  96.         End If
  97.         Dim startYear As Integer = Now.Year - 5
  98.         While startYear <= Now.Year
  99.             cmbFromYr.Items.Add(startYear)
  100.             cmbToYr.Items.Add(startYear)
  101.             startYear += 1
  102.         End While
  103.     End Sub
  104.  
  105.     Private Function buildXML() As String
  106.         Dim xmlString As String = "<?xml version=""1.0"" encoding=""utf-8""?>"
  107.         xmlString &= "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
  108.         xmlString &= "<soap:Body>"
  109.         xmlString &= "<EntityInquiry xmlns=""http://CTL.COM.SERVICES.PRIME.WebServices/PrimeServices"">"
  110.         xmlString &= "<XMLRequest>"
  111.         xmlString &= "<Paging>"
  112.         xmlString &= "<Size>0</Size>"
  113.         xmlString &= "<Key></Key>"
  114.         xmlString &= "</Paging>"
  115.         xmlString &= "<Entity>Card</Entity>"
  116.         xmlString &= "<Reference>C</Reference>"
  117.         xmlString &= "<Numbers>"
  118.         xmlString &= "<Number>4503400000099388</Number>"
  119.         xmlString &= "</Numbers>"
  120.         xmlString &= "</XMLRequest>"
  121.         xmlString &= "</EntityInquiry>"
  122.         xmlString &= "</soap:Body>"
  123.         xmlString &= "</soap:Envelope>"
  124.         Return xmlString
  125.     End Function
  126. End Class
  127.