X-Git-Url: https://fbox.kageds.com/gitweb/NEATEST.git/blobdiff_plain/cab6f2211264ec5b3eee4accf65794c8c2b5604c..20dbf92bc0579668c40523cd06f2add91ddf9b98:/NEA/SignUp.xaml.vb diff --git a/NEA/SignUp.xaml.vb b/NEA/SignUp.xaml.vb index 3dde66f..05ff931 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,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