]> fbox.kageds.com Git - NEATEST.git/blobdiff - NEA/SignUp.xaml.vb
Basic Store
[NEATEST.git] / NEA / SignUp.xaml.vb
index e3fdaf820be61d3b4106eb12f55de5f613f87ea2..05ff931f784a5f7aa95d605a76974240ef62d995 100644 (file)
@@ -1,6 +1,9 @@
 
 Imports System.Data
+Imports System.Drawing
+Imports System.IO
 Imports Microsoft.Win32
+
 Public Class SignUp
     Dim cmd As New OleDb.OleDbCommand
     Dim da3 As New OleDb.OleDbDataAdapter
@@ -24,11 +27,12 @@ Public Class SignUp
         Dim dr2 As NEADataSet.UsersRow
         Dim ID As Integer
         Dim CardNum As Integer
+
         CardNum = CInt(txtCardNum.Text)
         Dim CVC As Integer
         CVC = CInt(txtCVC.Text)
 
-        dr = dt.NewRow()
+        dr = dt.NewUser_DetailsRow()
         dr.Item("FirstName") = txtFirstName.Text
         dr.Item("LastName") = txtLastName.Text
         dr.Item("AddressLine1") = txtAddress.Text
@@ -39,17 +43,17 @@ Public Class SignUp
         dr.Item("Postcode") = txtPostcode.Text
         dr.Item("Town") = txtTown.Text
 
-
-
-
-
+        If imgpath <> "" Then
+            Dim img As Image = Image.FromFile(imgpath)
+            Dim bArr As Byte() = imgToByteArray(img)
+            dr.Item("ProfilePic") = bArr
+        End If
 
         dt.AddUser_DetailsRow(dr)
         da.Update(dt)
-
         MsgBox("Your data has been successfully added")
-        da.Fill(dt)
 
+        da.Fill(dt)
         Dim Q As String = "[FirstName] =  '" & txtFirstName.Text & "'"
         Dim result() As NEADataSet.User_DetailsRow = dt.Select(Q)
 
@@ -61,6 +65,9 @@ Public Class SignUp
         dr2.Item("Username") = txtUsername.Text
         dr2.Item("Password") = txtPassword.Text
 
+
+
+
         dt2.AddUsersRow(dr2)
         da2.Update(dt2)
 
@@ -92,16 +99,18 @@ Public Class SignUp
             fileUri = New Uri(OFD.FileName)
             ProfilePic.Source = New BitmapImage(fileUri)
 
+
             OFD = Nothing
 
         Catch ex As Exception
             MsgBox(ex.Message.ToString())
         End Try
     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
 
-    '    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
 End Class