--- /dev/null
+<Window x:Class="AddGame"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:local="clr-namespace:NEA"
+ mc:Ignorable="d"
+ Title="AddGame" Height="450" Width="800">
+ <Grid>
+ <Button x:Name="bntadd" Content="Button" HorizontalAlignment="Left" Height="33" Margin="63,59,0,0" VerticalAlignment="Top" Width="105"/>
+
+ </Grid>
+</Window>
--- /dev/null
+Imports System.Data
+Imports System.Drawing
+Imports System.IO
+Imports Microsoft.Win32
+Public Class AddGame
+ Dim cmd As New OleDb.OleDbCommand
+ Dim da3 As New OleDb.OleDbDataAdapter
+ Dim result As Integer
+ Dim imgpath As String
+ Dim arrImage() As Byte
+ Dim sql As String
+ Dim fileUri As Uri
+
+ Dim ds As New NEADataSet
+ Dim da As New NEADataSetTableAdapters.GamesTableAdapter
+ Dim dt As New NEADataSet.GamesDataTable
+
+
+ Private Sub Bntadd_Click(sender As Object, e As RoutedEventArgs) Handles bntadd.Click
+ Dim dr As NEADataSet.GamesRow
+
+
+ Try
+ Dim OFD As FileDialog = New OpenFileDialog()
+
+ OFD.Filter = "Image File (*.jpg;*.bmp;*.gif;*.png)|*.jpg;*.bmp;*.gif;*.png"
+
+ OFD.ShowDialog()
+
+ imgpath = OFD.FileName
+ fileUri = New Uri(OFD.FileName)
+
+
+
+ OFD = Nothing
+
+
+ Catch ex As Exception
+ MsgBox(ex.Message.ToString())
+ End Try
+
+ dr = dt.NewGamesRow()
+ dr.Item("Name") = "Hello"
+ If imgpath <> "" Then
+ Dim img As Image = Image.FromFile(imgpath)
+ Dim bArr As Byte() = imgToByteArray(img)
+ dr.Item("Icon") = bArr
+
+ End If
+ dt.AddGamesRow(dr)
+ da.Update(dt)
+ dt.Dispose()
+ da.Dispose()
+ End Sub
+ Private Function imgToByteArray(ByVal img As Image) As Byte()
+ Using mStream As New MemoryStream()
+ img.Save(mStream, Imaging.ImageFormat.Jpeg)
+ Return mStream.GetBuffer()
+ End Using
+ End Function
+
+End Class
<Compile Include="Achievemants.xaml.vb">
<DependentUpon>Achievemants.xaml</DependentUpon>
</Compile>
+ <Compile Include="AddGame.xaml.vb">
+ <DependentUpon>AddGame.xaml</DependentUpon>
+ </Compile>
<Compile Include="fmProfile.xaml.vb">
<DependentUpon>fmProfile.xaml</DependentUpon>
</Compile>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="AddGame.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="fmProfile.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</COMReference>
</ItemGroup>
<ItemGroup>
+ <Resource Include="search.png" />
+ <Resource Include="GarethGames Full.png" />
+ <Resource Include="GarethGames.png" />
<Content Include="NEA.accdb">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
-' This is a comment
+
Imports System.Data
Imports System.Drawing
Imports System.IO
If imgpath <> "" Then
Dim img As Image = Image.FromFile(imgpath)
Dim bArr As Byte() = imgToByteArray(img)
- ' da.InsertQuery(txtFirstName.Text, txtLastName.Text, txtAddress.Text, txtTown.Text, txtPostcode.Text, CardNum, CVC, txtIGN.Text, txtEmail.Text, bArr)
dr.Item("ProfilePic") = bArr
End If
- '
+
dt.AddUser_DetailsRow(dr)
da.Update(dt)
MsgBox("Your data has been successfully added")
MsgBox(ex.Message.ToString())
End Try
End Sub
-
- ' Private Sub txtIGN_LostFocus(sender As Object, e As RoutedEventArgs) Handles txtIGN.LostFocus
- ' If txtIGN.Text <> "In Game Name" Then
- ' lblIGN.Content = txtIGN
- ' End If
- 'End Sub
-
- 'convert image to bytearray
Private Function imgToByteArray(ByVal img As Image) As Byte()
Using mStream As New MemoryStream()
img.Save(mStream, Imaging.ImageFormat.Jpeg)
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:NEA"
mc:Ignorable="d"
- Title="Store">
+ Title="Store"
+ ResizeMode="NoResize"
+ WindowStartupLocation="CenterScreen"
+ WindowState="Maximized" Width="1089" Height="719" Background="#FF403939">
<Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
- <TextBox x:Name="txtSearch" Grid.Column="1" HorizontalAlignment="Left" Height="27" Margin="589,32,0,0" TextWrapping="Wrap" Text="Search" VerticalAlignment="Top" Width="136"/>
- <Button x:Name="btnSearch" Content="" Grid.Column="1" HorizontalAlignment="Left" Height="27" Margin="725,32,0,0" VerticalAlignment="Top" Width="24"/>
- <Image x:Name="imgLogo" Grid.Column="1" HorizontalAlignment="Left" Height="98" Margin="10,81,0,0" VerticalAlignment="Top" Width="243"/>
- <TextBox Grid.Column="1" HorizontalAlignment="Left" Height="56" Margin="10,179,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="249" FontSize="36"/>
+ <Border x:Name="bor1" BorderBrush="White" BorderThickness="1" Height="41" Margin="1534,262,0,0" CornerRadius="15" Background="#FF499E3C" HorizontalAlignment="Left" Width="347" VerticalAlignment="Top"/>
+ <Button x:Name="btnSignUp" Content="Sign Up" BorderBrush="#00707070" ClipToBounds="True" Background="#01F4F7FC" Foreground="White" HorizontalAlignment="Left" Width="346" Height="41" VerticalAlignment="Top" Margin="1534,551,0,0" Style="{DynamicResource ButtonStyle1}" />
+ <Label x:Name="lblIGN" Content="" HorizontalAlignment="Left" Height="35" Margin="488,262,0,0" VerticalAlignment="Top" Width="200" Foreground="White" FontSize="18"/>
+ <TextBox x:Name="txtSearch" HorizontalAlignment="Left" Height="30" Margin="663,80,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="257"/>
+ <Button x:Name="btnsearch" Content="Button" HorizontalAlignment="Left" Height="30" Margin="952,80,0,0" VerticalAlignment="Top" Width="59"/>
+ <TextBox x:Name="txtname" HorizontalAlignment="Left" Height="24" Margin="54,158,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="164"/>
+ <Image x:Name="imglogo" HorizontalAlignment="Left" Height="231" Margin="411,262,0,0" VerticalAlignment="Top" Width="259"/>
+ <Button Content="Button" HorizontalAlignment="Left" Height="162" Margin="98,331,0,0" VerticalAlignment="Top" Width="238" Click="Button_Click"/>
+
</Grid>
</Window>
-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
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 & "'"
Dim result() As NEADataSet.GamesRow = dt.Select(Q)
id = result(0).GameID
- MsgBox(ID)
+
GoTo LineBreak
End If
LineBreak:
ds.Dispose()
- 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")
+ For Each dr In dt.Rows
+ If String.Compare(dr("GameID"), id) = 0 Then
+ txtname.AppendText(dr.Item("Name"))
+
+
+ Dim bytes As [Byte]() = dr.Item("Icon")
+ Dim ms As New MemoryStream(bytes)
- GoTo LineBreak2
+ Dim bi As New BitmapImage()
+ bi.BeginInit()
+ bi.StreamSource = ms
+ bi.EndInit()
+
+ imglogo.Source = bi
+ End If
Next
- MsgBox("The game you entered is not in the database", vbExclamation)
-LineBreak2:
- ds2.Dispose()
+ End Sub
+
+ Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
+ Dim a As New AddGame()
+ a.Show()
+
End Sub
End Class
Else
Dim A = New Store()
A.Show()
- Dim P = New fmProfile()
- P.Show()
Me.Close()
End If
GoTo LineBreak
Me.Close()
End Sub
- ' Private Sub txtUserName_MouseEnter(sender As Object, e As MouseEventArgs) Handles txtUserName.MouseEnter
- ' If txtUserName.Text = "Username" Then
- ' txtUserName.Text = ""
- ' End If
- 'End Sub
- '
- ' Private Sub txtUserName_MouseLeave(sender As Object, e As MouseEventArgs) Handles txtUserName.MouseLeave
- ' If txtUserName.Text = "" Then
- ' txtUserName.Text = "Username"
- 'End If
- 'End Sub
-
- ' Private Sub txtPassword_MouseEnter(sender As Object, e As MouseEventArgs) Handles txtPassword.MouseEnter
- ' If txtPassword.Text = "Password" Then
- ' txtPassword.Text = ""
- ' End If
- 'End Sub
-
- ' Private Sub txtPassword_MouseLeave(sender As Object, e As MouseEventArgs) Handles txtPassword.MouseLeave
- ' If txtPassword.Text = "" Then
- ' txtPassword.Text = "Password"
- 'End If
- ' End Sub
End Class