You are on page 1of 14

QUARANTINE

COMMUNITY
FACILITIES
SYSTEM CODES
LOGIN.vb
Imports MySql.Data.MySqlClient
Public Class Login
Private Sub TextBox1_Enter(sender As Object, e As EventArgs) Handles
TextBoxusername.Enter
Dim username As String = TextBoxusername.Text
If username.Trim().ToLower() = "username" Or username.Trim() = "" Then

TextBoxusername.Text = ""
TextBoxusername.ForeColor = Color.Black

End If
End Sub

Private Sub TextBox1_Leave(sender As Object, e As EventArgs) Handles


TextBoxusername.Leave
Dim username As String = TextBoxusername.Text
If username.Trim().ToLower() = "username" Or username.Trim() = "" Then

TextBoxusername.Text = "username"
TextBoxusername.ForeColor = Color.DarkGray

End If
End Sub

Private Sub TextBoxpassword_Enter(sender As Object, e As EventArgs) Handles


TextBoxpassword.Enter
Dim pass As String = TextBoxpassword.Text
If pass.Trim().ToLower() = "password" Or pass.Trim() = "" Then

TextBoxpassword.Text = ""
TextBoxpassword.ForeColor = Color.Black
TextBoxpassword.UseSystemPasswordChar = True

End If

End Sub

Private Sub TextBoxpassword_Leave(sender As Object, e As EventArgs) Handles


TextBoxpassword.Leave
Dim pass As String = TextBoxpassword.Text
If pass.Trim().ToLower() = "password" Or pass.Trim() = "" Then

TextBoxpassword.Text = "Password"
TextBoxpassword.ForeColor = Color.DarkGray
TextBoxpassword.UseSystemPasswordChar = False

End If

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Dim conn As New MY_CONNECTION()
Dim adapter As New MySqlDataAdapter()
Dim table As New DataTable()
Dim command As New MySqlCommand("SELECT `Firstname`, `Lastname`, `username`,
`email`, `password` FROM `users` WHERE `username` = @usn AND `password` = @pass",
conn.getConnection)

command.Parameters.Add("@usn", MySqlDbType.VarChar).Value = TextBoxusername.Text


command.Parameters.Add("@pass", MySqlDbType.VarChar).Value = TextBoxpassword.Text

If TextBoxusername.Text.Trim() = "" Or TextBoxusername.Text.Trim() = "username"


Then
MessageBox.Show("Enter your Username!", "ERROR", MessageBoxButtons.OK,
MessageBoxIcon.Stop)
conn.closeConnection()

ElseIf TextBoxpassword.Text.Trim() = "" Or TextBoxpassword.Text.Trim() =


"password" Then
MessageBox.Show("Enter your Password", "ERROR", MessageBoxButtons.OK,
MessageBoxIcon.Stop)
conn.closeConnection()

End If

adapter.SelectCommand = command
adapter.Fill(table)

If table.Rows.Count > 0 Then


Me.Hide()
Dim lform As New Mainform()
lform.Show()
Else
MessageBox.Show("Your Username and Password Doesn't Exists", "WARNING",
MessageBoxButtons.OK, MessageBoxIcon.Stop)
conn.closeConnection()
End If

End Sub

Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click


Me.Hide()
Dim lform As New Register()
lform.Show()
End Sub

Private Sub Label1_MouseEnter(sender As Object, e As EventArgs) Handles


Label1.MouseEnter
Label1.ForeColor = Color.Red
End Sub

Private Sub Label1_MouseLeave(sender As Object, e As EventArgs) Handles


Label1.MouseLeave
Label1.ForeColor = Color.Black
End Sub

Private Sub Label2_MouseEnter(sender As Object, e As EventArgs) Handles


Label2.MouseEnter
Label2.ForeColor = Color.Red
End Sub

Private Sub Label2_MouseLeave(sender As Object, e As EventArgs) Handles


Label2.MouseLeave
Label2.ForeColor = Color.Black
End Sub

Private Sub Label3_MouseEnter(sender As Object, e As EventArgs) Handles


Label3.MouseEnter
Label3.ForeColor = Color.Red
End Sub

Private Sub Label3_MouseLeave(sender As Object, e As EventArgs) Handles


Label3.MouseLeave
Label3.ForeColor = Color.Black
End Sub

Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click


Me.Hide()
Dim lform As New About_us()
lform.Show()

End Sub

Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click


Me.Hide()
Dim lform As New Developer()
lform.Show()
End Sub

End Class
REGISTER.vb
Imports MySql.Data.MySqlClient
Public Class Register

Public Function usernameExist(ByVal username As String) As Boolean

Dim con As New MY_CONNECTION


Dim table As New DataTable()
Dim adapter As New MySqlDataAdapter()
Dim command As New MySqlCommand("SELECT * FROM `users` WHERE `username` = @usn",
con.getConnection())

command.Parameters.Add("@usn", MySqlDbType.VarChar).Value = username

adapter.SelectCommand = command
adapter.Fill(table)

If table.Rows.Count > 0 Then

Return True
Else

Return False

End If

End Function

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Dim fname As String = Firstname.Text
Dim lname As String = Lastname.Text
Dim username As String = Me.username.Text
Dim email As String = TextboxEmail.Text
Dim password As String = TextboxPassword.Text

If fname.Trim() = "" Or lname.Trim() = "" Or username.Trim() = "" Or email.Trim()


= "" Or password.Trim() = "" Then

MessageBox.Show("One Or Other Fields Are Empty", "Missing data",


MessageBoxButtons.OK, MessageBoxIcon.Stop)

ElseIf usernameExist(username) Then

MessageBox.Show("Username Have Already Registered", "Duplicate Information",


MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

Else
Dim conn As New MY_CONNECTION()
Dim command As New MySqlCommand("INSERT INTO `users`(`firstname`, `lastname`,
`username`, `email`, `password`) VALUES (@fn, @ln,@usn, @email, @pass)",
conn.getConnection)

command.Parameters.Add("@fn", MySqlDbType.VarChar).Value = fname


command.Parameters.Add("@ln", MySqlDbType.VarChar).Value = lname
command.Parameters.Add("@email", MySqlDbType.VarChar).Value = email
command.Parameters.Add("usn", MySqlDbType.VarChar).Value = username
command.Parameters.Add("@pass", MySqlDbType.VarChar).Value = password

conn.openConnection()

If command.ExecuteNonQuery() = 1 Then

MessageBox.Show("Registration Successfully!", "User Added",


MessageBoxButtons.OK, MessageBoxIcon.Information)
conn.closeConnection()

End If

For Each txt In {Firstname, Lastname, TextboxEmail, Me.username,


TextboxPassword}
txt.Clear()
Next

End If
End Sub
Private Sub LinkLabel1_LinkClicked(sender As Object, e As
LinkLabelLinkClickedEventArgs)
Me.Hide()
Dim lform As New Login()
lform.Show()

End Sub
Private Sub Firstname_Enter(sender As Object, e As EventArgs) Handles Firstname.Enter
LabelFn.ForeColor = Color.Red
End Sub

Private Sub Firstname_Leave(sender As Object, e As EventArgs) Handles Firstname.Leave


LabelFn.ForeColor = Color.Black
End Sub

Private Sub Lastname_Enter(sender As Object, e As EventArgs) Handles Lastname.Enter


LabelLN.ForeColor = Color.Red
End Sub

Private Sub Lastname_Leave(sender As Object, e As EventArgs) Handles Lastname.Leave


LabelLN.ForeColor = Color.Black
End Sub

Private Sub TextboxEmail_Enter(sender As Object, e As EventArgs) Handles


TextboxEmail.Enter
LabelEM.ForeColor = Color.Red
End Sub

Private Sub TextboxEmail_Leave(sender As Object, e As EventArgs) Handles


TextboxEmail.Leave
LabelEM.ForeColor = Color.Black
End Sub

Private Sub TextboxUsername_Enter(sender As Object, e As EventArgs) Handles


username.Enter
LabelUN.ForeColor = Color.Red
End Sub

Private Sub TextboxUsername_Leave(sender As Object, e As EventArgs) Handles


username.Leave
LabelUN.ForeColor = Color.Black
End Sub

Private Sub TextboxPassword_Enter(sender As Object, e As EventArgs) Handles


TextboxPassword.Enter
LabelPS.ForeColor = Color.Red
End Sub

Private Sub TextboxPassword_Leave(sender As Object, e As EventArgs) Handles


TextboxPassword.Leave
LabelPS.ForeColor = Color.Black
End Sub

Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click


Me.Hide()
Dim lform As New Login()
lform.Show()
End Sub

Private Sub Label1_MouseEnter(sender As Object, e As EventArgs) Handles


Label1.MouseEnter
Label1.ForeColor = Color.Red
End Sub

Private Sub Label1_MouseLeave(sender As Object, e As EventArgs) Handles


Label1.MouseLeave
Label1.ForeColor = Color.Black
End Sub

End Class
MAINFORM.vb
Public Class Mainform
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Hide()
Dim lform As New San_juan_medical()
lform.Show()
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


Me.Hide()
Dim lform As New Cardinal_santos_medical()
lform.Show()
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


Me.Hide()
Dim lform As New St_martin_de_porres_charity()
lform.Show()
End Sub

Private Sub LabelLogout_MouseEnter(sender As Object, e As EventArgs) Handles


LabelLogout.MouseEnter
LabelLogout.ForeColor = Color.Red
End Sub

Private Sub LabelLogout_MouseLeave(sender As Object, e As EventArgs) Handles


LabelLogout.MouseLeave
LabelLogout.ForeColor = Color.Blue
End Sub

Private Sub LabelLogout_Click(sender As Object, e As EventArgs) Handles


LabelLogout.Click
Me.Hide()
Dim lform As New Login()
lform.Show()
End Sub
End Class
MY_CONNECTION.vb
Imports MySql.Data.MySqlClient
Public Class MY_CONNECTION

Dim connection As New


MySqlConnection("datasource=localhost;port=3306;username=root;password=;database=vbnet_us
ers_db")
ReadOnly Property getConnection() As MySqlConnection
Get
Return connection
End Get
End Property

Sub openConnection()

If connection.State = ConnectionState.Closed Then


connection.Open()
End If
End Sub

Sub closeConnection()

If connection.State = ConnectionState.Open Then


connection.Close()
End If
End Sub
End Class
HOSPITALS INFO.vb
Public Class Cardinal_santos_medical
Private Sub Button1_Click(sender As Object, e As EventArgs)

End Sub

Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click


Me.Hide()
Dim lform As New Mainform()
lform.Show()
End Sub

Private Sub LinkLabel1_LinkClicked(sender As Object, e As


LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
Me.Hide()
Dim lform As New CSMC_sched_form()
lform.Show()
End Sub
End Class

Private Sub Button1_Click(sender As Object, e As EventArgs)

End Sub

Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click


Me.Hide()
Dim lform As New Mainform()
lform.Show()
End Sub

Private Sub LinkLabel1_LinkClicked(sender As Object, e As


LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
Me.Hide()
Dim lform As New SJM_sched_form()
lform.Show()
End Sub
End Class

Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click


Me.Hide()
Dim lform As New Mainform()
lform.Show()
End Sub

Private Sub LinkLabel1_LinkClicked(sender As Object, e As


LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
Me.Hide()
Dim lform As New STMDP_sched_form()
lform.Show()
End Sub
End Class
HOSPITALS FORM.vb
Imports MySql.Data.MySqlClient
Public Class CSMC_sched_form

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Dim FLname As String = TextBoxFullname.Text
Dim Cont As String = TextBoxContact.Text
Dim Adds As String = TextBoxAddress.Text
Dim Eadd As String = TextBoxEmailAdd.Text
Dim messages As String = TextBoxMessage.Text

If FLname.Trim() = "" Or Cont.Trim() = "" Or Adds.Trim() = "" Or Eadd.Trim() = ""


Or messages.Trim() = "" Then

MessageBox.Show("One Or Other Fields Are Empty", "Missing data",


MessageBoxButtons.OK, MessageBoxIcon.Stop)

Else
Dim conn As New MY_CONNECTION()
Dim command As New MySqlCommand("INSERT INTO `csmc_schedule`(`Full name`,
`Contact no`, `Full Address`, `Email Address`, `Message`) VALUES (@Flname, @cont, @Adds,
@Eadds, @message)", conn.getConnection)

command.Parameters.Add("@flname", MySqlDbType.VarChar).Value = FLname


command.Parameters.Add("@cont", MySqlDbType.VarChar).Value = Cont
command.Parameters.Add("@Adds", MySqlDbType.VarChar).Value = Adds
command.Parameters.Add("@Eadds", MySqlDbType.VarChar).Value = Eadd
command.Parameters.Add("@message", MySqlDbType.VarChar).Value = messages

conn.openConnection()
If command.ExecuteNonQuery() = 1 Then
MessageBox.Show("Your form is under review Please wait the email of the
hospital in you submited Email Account", " Registration Successfully ",
MessageBoxButtons.OK, MessageBoxIcon.Information)
conn.closeConnection()
Else

MessageBox.Show("Registration Denied Please Check The Form", "Missing


data", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
conn.closeConnection()

End If

For Each txt In {TextBoxFullname, TextBoxContact, TextBoxEmailAdd,


TextBoxAddress, TextBoxMessage}
txt.Clear()
Next
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


Me.Hide()
Dim lform As New Cardinal_santos_medical()
lform.Show()
End Sub

Private Sub TextBoxContact_KeyPress(sender As Object, e As KeyPressEventArgs) Handles


TextBoxContact.KeyPress
If Not Char.IsNumber(e.KeyChar) And Not e.KeyChar = Chr(Keys.Delete) And Not
e.KeyChar = Chr(Keys.Back) And Not e.KeyChar = Chr(Keys.Space) Then
e.Handled = True
MessageBox.Show("THIS FIELD CAN ONLY USE NUMBERS", " WARNING ",
MessageBoxButtons.OK, MessageBoxIcon.Stop)
End If
End Sub
End Class

Imports MySql.Data.MySqlClient
Public Class SJM_sched_form
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim FLname1 As String = TextBoxFullname1.Text
Dim Cont1 As String = TextBoxContact1.Text
Dim Adds1 As String = TextBoxAddress1.Text
Dim Eadd1 As String = TextBoxEmailAdd1.Text
Dim messages1 As String = TextBoxMessage1.Text

If FLname1.Trim() = "" Or Cont1.Trim() = "" Or Adds1.Trim() = "" Or Eadd1.Trim()


= "" Or messages1.Trim() = "" Then

MessageBox.Show("One Or Other Fields Are Empty", "Missing data",


MessageBoxButtons.OK, MessageBoxIcon.Stop)

Else
Dim conn As New MY_CONNECTION()
Dim command As New MySqlCommand("INSERT INTO `sjm_schedule form`(`Full name`,
`Contact no`, `Full Address`, `Email Address`, `Message`) VALUES (@flname1, @Cont1,
@Adds1, @Eadds1, @message1)", conn.getConnection)

command.Parameters.Add("@flname1", MySqlDbType.VarChar).Value = FLname1


command.Parameters.Add("@Cont1", MySqlDbType.VarChar).Value = Cont1
command.Parameters.Add("@Adds1", MySqlDbType.VarChar).Value = Adds1
command.Parameters.Add("@Eadds1", MySqlDbType.VarChar).Value = Eadd1
command.Parameters.Add("@message1", MySqlDbType.VarChar).Value = messages1

conn.openConnection()
If command.ExecuteNonQuery() = 1 Then
MessageBox.Show("Your form is under review Please wait the email of the
hospital in you submited Email Account", " Registration Successfully ",
MessageBoxButtons.OK, MessageBoxIcon.Information)
conn.closeConnection()
Else
MessageBox.Show("Registration Denied Please Check The Form", "Missing
data", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
conn.closeConnection()

End If

For Each txt In {TextBoxFullname1, TextBoxContact1, TextBoxEmailAdd1,


TextBoxAddress1, TextBoxMessage1}
txt.Clear()
Next
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


Me.Hide()
Dim lform As New San_juan_medical()
lform.Show()
End Sub

Private Sub TextBoxContact1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles TextBoxContact1.KeyPress
If Not Char.IsNumber(e.KeyChar) And Not e.KeyChar = Chr(Keys.Delete) And Not
e.KeyChar = Chr(Keys.Back) And Not e.KeyChar = Chr(Keys.Space) Then
e.Handled = True
MessageBox.Show("THIS FIELD CAN ONLY USE NUMBERS", " WARNING ",
MessageBoxButtons.OK, MessageBoxIcon.Stop)
End If
End Sub
End Class

Imports MySql.Data.MySqlClient
Public Class STMDP_sched_form
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim FLname2 As String = TextBoxFullname2.Text
Dim Cont2 As String = TextBoxContact2.Text
Dim Adds2 As String = TextBoxAddress2.Text
Dim Eadd2 As String = TextBoxEmailAdd2.Text
Dim messages2 As String = TextBoxMessage2.Text

If FLname2.Trim() = "" Or Cont2.Trim() = "" Or Adds2.Trim() = "" Or Eadd2.Trim()


= "" Or messages2.Trim() = "" Then

MessageBox.Show("One Or Other Fields Are Empty", "Missing data",


MessageBoxButtons.OK, MessageBoxIcon.Stop)

Else
Dim conn As New MY_CONNECTION()
Dim command As New MySqlCommand("INSERT INTO `stmdp_schedule fom`(`Full
name`, `Contact no`, `Full Address`, `Email Address`, `Message`) VALUES (@flname2,
@Cont2, @Adds2, @Eadds2, @message2)", conn.getConnection)

command.Parameters.Add("@flname2", MySqlDbType.VarChar).Value = FLname2


command.Parameters.Add("@Cont2", MySqlDbType.VarChar).Value = Cont2
command.Parameters.Add("@Adds2", MySqlDbType.VarChar).Value = Adds2
command.Parameters.Add("@Eadds2", MySqlDbType.VarChar).Value = Eadd2
command.Parameters.Add("@message2", MySqlDbType.VarChar).Value = messages2

conn.openConnection()
If command.ExecuteNonQuery() = 1 Then
MessageBox.Show("Your form is under review Please wait the email of the
hospital in you submited Email Account", " Registration Successfully ",
MessageBoxButtons.OK, MessageBoxIcon.Information)
conn.closeConnection()
Else

MessageBox.Show("Registration Denied Please Check The Form", "Missing


data", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
conn.closeConnection()
End If
For Each txt In {TextBoxFullname2, TextBoxContact2, TextBoxEmailAdd2,
TextBoxAddress2, TextBoxMessage2}
txt.Clear()
Next
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


Me.Hide()
Dim lform As New St_martin_de_porres_charity()
lform.Show()
End Sub

Private Sub TextBoxContact2_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles TextBoxContact2.KeyPress
If Not Char.IsNumber(e.KeyChar) And Not e.KeyChar = Chr(Keys.Delete) And Not
e.KeyChar = Chr(Keys.Back) And Not e.KeyChar = Chr(Keys.Space) Then
e.Handled = True
MessageBox.Show("THIS FIELD CAN ONLY USE NUMBERS", " WARNING ",
MessageBoxButtons.OK, MessageBoxIcon.Stop)
End If
End Sub
End Class

You might also like