]> fbox.kageds.com Git - NEATEST.git/blobdiff - NEA/SignUp.xaml.vb
Make DB part of project
[NEATEST.git] / NEA / SignUp.xaml.vb
index e3fdaf820be61d3b4106eb12f55de5f613f87ea2..ce33a2e785dd88188e12032548d4b98f4daa7f58 100644 (file)
@@ -1,6 +1,9 @@
-
+' This is a comment
 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,18 @@ 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)
+            '   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")
-        da.Fill(dt)
 
+        da.Fill(dt)
         Dim Q As String = "[FirstName] =  '" & txtFirstName.Text & "'"
         Dim result() As NEADataSet.User_DetailsRow = dt.Select(Q)
 
@@ -61,6 +66,9 @@ Public Class SignUp
         dr2.Item("Username") = txtUsername.Text
         dr2.Item("Password") = txtPassword.Text
 
+
+
+
         dt2.AddUsersRow(dr2)
         da2.Update(dt2)
 
@@ -92,6 +100,7 @@ Public Class SignUp
             fileUri = New Uri(OFD.FileName)
             ProfilePic.Source = New BitmapImage(fileUri)
 
+
             OFD = Nothing
 
         Catch ex As Exception
@@ -104,4 +113,13 @@ Public Class SignUp
     '          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)
+            Return mStream.GetBuffer()
+        End Using
+    End Function
+
 End Class