X-Git-Url: https://fbox.kageds.com/gitweb/NEATEST.git/blobdiff_plain/599222942c6c954fb8eb161aade645f0c38c1a13..61e61981825c73f098cea957e65c7c49dc20cbda:/NEA/SignUp.xaml.vb?ds=inline diff --git a/NEA/SignUp.xaml.vb b/NEA/SignUp.xaml.vb index e3fdaf8..ce33a2e 100644 --- a/NEA/SignUp.xaml.vb +++ b/NEA/SignUp.xaml.vb @@ -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