-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuy.aspx.vb
39 lines (35 loc) · 1.96 KB
/
Buy.aspx.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Imports System.Data
Imports System.Web.UI
Partial Class Buy
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load 'Show the right elements depending if the user is logged in
Dim selectedGameID As Integer
Try
selectedGameID = sqlGameSelect.SelectedItem.Value
For Each rowView As DataRowView In sqlDSGameSelect.Select(DataSourceSelectArguments.Empty)
Dim row As DataRow = rowView.Row
If String.Compare(row.Item(0).ToString(), selectedGameID.ToString()) = 0 Then 'find the selected row in the game select dropdown
'set image and text elements to the correct display
imgbuypage.Src = row.Item(2).ToString()
imgbuypagecur.Src = row.Item(4).ToString()
txtbuypage.InnerText = row.Item(1).ToString()
txtbuypagecur.InnerText = row.Item(3).ToString()
Session("ListingImg") = row.Item(2).ToString()
Session("ListingImgCur") = row.Item(4).ToString()
Session("ListingGame") = row.Item(1).ToString()
Session("ListingGameCur") = row.Item(3).ToString()
End If
Next
Catch ex As Exception
End Try
End Sub
Public Sub gridviewlistings_RowCommand(sender As Object, e As System.Web.UI.WebControls.GridViewCommandEventArgs) 'buy button on each row of gridview
If (e.CommandName = "Buy") Then
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
Dim row As GridViewRow = gridviewlistings.Rows(index)
Session("ListingID") = Integer.Parse(row.Cells(0).Text) 'get and set the listing id and seller name before redirecting to checkout
Session("ListingName") = row.Cells(1).Text
Response.Redirect("CheckOut.aspx", True)
End If
End Sub
End Class