]> fbox.kageds.com Git - NEATEST.git/blobdiff - NEA/Store.xaml.vb
Basic Store
[NEATEST.git] / NEA / Store.xaml.vb
index 86d563efcbab9230ea342f4c87f4715da4b0d0f7..5e6b4fc1673e5e2fbb8a6f476f4d606a657435fa 100644 (file)
@@ -1,46 +1,52 @@
-Public Class Store
-    Private Sub BtnSearch_Click(sender As Object, e As RoutedEventArgs) Handles btnSearch.Click
-        Dim id As String
+Imports System.IO
+Imports System.Drawing
+Public Class Store
+    Dim id As String
+    Private Sub BtnSearch_Click(sender As Object, e As RoutedEventArgs) Handles btnsearch.Click
+
         Dim ds As New NEADataSet
         Dim dr As System.Data.DataRow
         Dim da As New NEADataSetTableAdapters.GamesTableAdapter
         Dim dt As System.Data.DataTable
         Dim ds As New NEADataSet
         Dim dr As System.Data.DataRow
         Dim da As New NEADataSetTableAdapters.GamesTableAdapter
         Dim dt As System.Data.DataTable
+        Dim search As String
+        search = LCase(txtSearch.Text)
         dt = ds.Tables("Games")
         da.Fill(dt)
         For Each dr In dt.Rows
         dt = ds.Tables("Games")
         da.Fill(dt)
         For Each dr In dt.Rows
-            If String.Compare(dr("Name"), txtSearch.Text) = 0 Then
-                MsgBox(txtSearch.Text & " was found in the database")
-
-                Dim Q As String = "[Name] =  '" & txtSearch.Text & "'"
+            If String.Compare(dr("Name"), search) = 0 Then
+                Dim Q As String = "[Name] =  '" & search & "'"
                 Dim result() As NEADataSet.GamesRow = dt.Select(Q)
                 Dim result() As NEADataSet.GamesRow = dt.Select(Q)
-
                 id = result(0).GameID
                 id = result(0).GameID
-                MsgBox(ID)
-
                 GoTo LineBreak
                 GoTo LineBreak
+            Else
+                MsgBox("The game you entered is not in the database", vbExclamation)
             End If
         Next
             End If
         Next
-        MsgBox("The game you entered is not in the database", vbExclamation)
+
 LineBreak:
         ds.Dispose()
 LineBreak:
         ds.Dispose()
+        For Each dr In dt.Rows
+            If String.Compare(dr("GameID"), id) = 0 Then
+                txtname.AppendText(dr.Item("Name"))
+                btnBuy.Content = "Buy for £" & dr.Item("Price")
+                lblPublisher.Content = "Publisher: " & dr.Item("Publisher")
+                lblRating.Content = "This game is rated " & dr.Item("Rating") & " out of 5"
+                lblReviews.Content = "Gamer review: "
+                Dim bytes As [Byte]() = dr.Item("Icon")
+                Dim ms As New MemoryStream(bytes)
+                Dim bi As New BitmapImage()
+                bi.BeginInit()
+                bi.StreamSource = ms
+                bi.EndInit()
+                imgLogo.Source = bi
+            End If
 
 
-        Dim ds2 As New NEADataSet
-        Dim dr2 As System.Data.DataRow
-        Dim da2 As New NEADataSetTableAdapters.GamesTableAdapter
-        Dim dt2 As System.Data.DataTable
-        dt2 = ds2.Tables("Games")
-        da2.Fill(dt2)
-        For Each dr2 In dt2.Rows
-            String.Compare(dr2("GameID"), id) 
-                MsgBox(txtSearch.Text & " was found in the database")
-
-
+        Next
+    End Sub
 
 
-                GoTo LineBreak2
+    Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
+        Dim a As New AddGame()
+        a.Show()
 
 
-        Next
-        MsgBox("The game you entered is not in the database", vbExclamation)
-LineBreak2:
-        ds2.Dispose()
     End Sub
 End Class
     End Sub
 End Class