You are on page 1of 68

APPENDICES

Appendix A
Relevant Source Code
Imports System.Data
Imports System.Data.SqlClient
Imports System
Public Class Login info
Dim conn As SqlConnection
Dim cn As New SqlConnection("Data Source = DESKTOP-CPNQCCI;
integrated Security = true;" & "Initial Catalog = StudentAttendanceSystem")
Dim cmd As New SqlCommand
Dim dr As SqlDataReader
Dim dr2 As SqlDataReader
Dim sql_command As SqlClient.SqlCommand

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click

cn.Close()
cn.Open()
Dim cmd As New SqlCommand("SELECT * FROM tbllogininfo WHERE
IDNo = @IDNo And Password = @Password", cn)
cmd.Parameters.AddWithValue("@IDNo", txtIDno.Text)
cmd.Parameters.AddWithValue("@Password", txtpass.Text)
Dim sdr As SqlDataReader = cmd.ExecuteReader()
Try
If (sdr.Read() = True) Then
GoTo inn
Else
MsgBox("Invalid ID", MsgBoxStyle.Critical)
txtIDno.Text = ""
txtpass.Text = ""
txtIDno.Focus()
Exit Sub
inn:
If sdr("Authority") = "Councilor" Then
authority.Text = "Councilor"
txtIDno.Text = ""
txtpass.Text = ""
' authority.Text = ""
'MsgBox("Successfully Login")
Agendainfo.Label19.Text = authority.Text

Me.Hide()
Agendainfo.Show()
Agendainfo.Button2.Enabled = True
Agendainfo.FileMaintenanceToolStripMenuItem.Enabled = False
Agendainfo.MasterListToolStripMenuItem.Enabled = True
Agendainfo.Button3.Enabled = True

Else
If sdr("Authority") = "President" Then
authority.Text = "President"
txtIDno.Text = ""
txtpass.Text = ""
'authority.Text = ""

Me.Hide()
Agendainfo.Show()
Agendainfo.btnadd.Enabled = True
Agendainfo.btnsave.Enabled = True
Agendainfo.btnedit.Enabled = True
Agendainfo.btncancel.Enabled = True
Agendainfo.Button2.Enabled = True
Agendainfo.btncancel.Enabled = True
Agendainfo.Button3.Enabled = True
Agendainfo.Label19.Text = authority.Text
Else
If sdr("Authority") = "IT" Then
authority.Text = "IT"
txtIDno.Text = ""
txtpass.Text = ""
'authority.Text = ""

Me.Hide()

Agendainfo.Show()

Agendainfo.btnadd.Enabled = True
Agendainfo.btnsave.Enabled = True
Agendainfo.btnedit.Enabled = True
Agendainfo.btncancel.Enabled = True
Agendainfo.Button2.Enabled = True
Agendainfo.btncancel.Enabled = True
Agendainfo.Label19.Text = authority.Text

Exit Sub

End If
End If
End If
End If
Catch ex As Exception
End Try

cn.Close()

End Sub
'Private Sub keypress_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles Button1.KeyPress,
txtpass.KeyPress

' Dim NotAllowed As String = "-,+=/\[]{};:.,_'"

' If e.KeyChar <> ControlChars.Back = True Then


' If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then
' e.Handled = True
' End If
' End If

' If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then


' SendKeys.Send("{TAB}")
' e.Handled = True
' End If

'End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs)

Me.Close()
End Sub

Private Sub Logininfo_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
txtIDno.Focus()

End Sub

Private Sub IDrestriction(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtIDno.KeyPress

Dim NotAllowed As String = "-,+=/\[]


{};:.,_'qwertyuiopasdfghjklzxcvbnm<>?"

If e.KeyChar <> ControlChars.Back = True Then


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then
e.Handled = True
End if
End If
If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then
SendKeys.Send("{TAB}")
e.Handled = True
End If
End Sub
End Class

Imports System.Data
Imports System.Data.SqlClient
Imports System.IO
Imports Excel = Microsoft.Office.Interop.Excel

Public Class Attendanceinfo

Dim conn As SqlConnection


Dim cn As New SqlConnection("Data Source = DESKTOP-CPNQCCI;
integrated Security = true;" & "Initial Catalog = StudentAttendanceSystem")
'Dim cn As New SqlConnection("Data Source = EVAJHEAN05-
PC\SQLEXPRESS; integrated Security = true;" & "Initial Catalog =
StudentAttendanceSystem")
Dim cmd As New SqlCommand
Dim dr As SqlDataReader
Dim dr2 As SqlDataReader
Dim sql_command As SqlClient.SqlCommand

Private Sub Attendanceinfo_Load(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles MyBase.Load

newid2.Focus()
autoid()

End Sub

Public Sub autoid()


cn.Close()
Try
cn.Open()
Dim cmd As SqlCommand = cn.CreateCommand

'cmd.CommandText = "SELECT COUNT(ID) From Attende WHERE


Agenda='" & txtAgenda.Text & "'"
cmd.CommandText = "SELECT COUNT(testautoID) From
tblattendanceinfo"
dr = cmd.ExecuteReader
If dr.Read = True Then
' Me.idTextBox1.Text = "12160000" & dr.Item(0) + 1

'Show sa Auto ID

Me.testautoID.Text = "" & dr.Item(0) + 1

Else
Exit Sub
End If
cn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

End Sub

Sub retrieve_picture()
'Dim command As New SqlCommand(" Select * from tblattendanceinfo
where IDNo = '" & txtIDno.Text & " '", cn)
'Dim table As New DataTable()
'Dim adapter As New SqlDataAdapter(command)

'adapter.Fill(table)
'TextBox1.Text = txtIDno.Text
'txtIDno.Text = table.Rows(0)(0).ToString()

'Dim img() As Byte

'img = table.Rows(0)(1)
'Dim ms As New MemoryStream(img)

'pbCapture.Image = Image.FromStream(ms)

searchfilltxtbox()

End Sub

Private Sub IDrestriction(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtIDno.KeyPress

Dim NotAllowed As String = "-,+=/\[]


{};:.,_'qwertyuiopasdfghjklzxcvbnm<>?"
If e.KeyChar <> ControlChars.Back = True Then
If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then
e.Handled = True
End If
End If

If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then


SendKeys.Send("{TAB}")
e.Handled = True
End If
End Sub

Private Sub keypress_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs)

Dim NotAllowed As String = "-,+=/\[]{};:.,_'"

If e.KeyChar <> ControlChars.Back = True Then


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then
e.Handled = True
End If
End If

If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then


SendKeys.Send("{TAB}")
e.Handled = True
End If
End Sub

Private Sub txtIDno_TextChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles txtIDno.TextChanged

searchfilltxtbox()
searchfilltestID()
newid2.Text = txtIDno.Text
retrieve_picture()

End Sub

Private Sub searchfilltxtbox()


cn.Close()
cn.Open()
dr.Close()
Dim ds As New DataSet

Dim cmd As SqlCommand = New SqlCommand("SELECT * FROM


tblregisterinfo WHERE IDNo='" & txtIDno.Text & "'", cn)

'IDNo,Course,ContactNo,LastName,FirstName,Middlename

dr = cmd.ExecuteReader
'Dim cm2 As SqlCommand = New SqlCommand("Select testautoID From
tblattendanceinfo where testautoID='" & txtIDno.Text & "'", cn)

'dr2 = cm2.ExecuteReader
If dr.Read Then
txtIDno.Text = dr("IDNo").ToString
txtLastName.Text = dr("LastName").ToString
txtFirstName.Text = dr("FirstName").ToString
txtMiddleName.Text = dr("MiddleName").ToString
txtCourse.Text = dr("Course").ToString
txtContactNo.Text = dr("ContactNo").ToString

End If

cn.Close()

End Sub

Private Sub searchfilltestID()


cn.Close()
cn.Open()

Dim ds As New DataSet


'Dim cmd As SqlCommand = New SqlCommand("SELECT
IDNo,Course,ContactNo,Lastname,FirstName,Middlename FROM tblregisterinfo
WHERE IDNo='" & txtIDno.Text & "'", cn)

'dr = cmd.ExecuteReader
Dim cm As SqlCommand = New SqlCommand("Select
Lastname,testautoID From tblattendanceinfo Where Lastname='" &
txtLastName.Text & "'", cn)

dr = cm.ExecuteReader
If dr.Read Then
txtLastName.Text = dr("Lastname").ToString
testautoID.Text = dr("testautoID").ToString
End If

cn.Close()

End Sub
Private Sub newid2_TextChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles newid2.TextChanged
Dim sql_server As String
Dim sql_connection As SqlConnection
sql_server = "Data Source = DESKTOP-CPNQCCI;Initial Catalog =
StudentAttendanceSystem;Integrated Security=True"
sql_connection = New SqlConnection(sql_server)

'Dim cn As New SqlConnection("Data Source = EVAJHEAN05-


PC\SQLEXPRESS; integrated Security = true;" & "Initial Catalog =
StudentAttendanceSystem")

Try
Dim READER As SqlDataReader
Dim count As Integer

sql_connection.Open()

Dim query As String


query = "select * from tblregisterinfo where IDNo = '" & newid2.Text &
"'"

sql_command = New SqlCommand(query, sql_connection)


READER = sql_command.ExecuteReader
count = 0

While READER.Read
count = count + 1

pbCapture.Image =
ImageConverter.ByteToImage(TryCast(READER.Item("Picture"), Byte()))
'pbRecordSignature.Image =
imageConverter.ByteToImage(TryCast(READER.Item("Signature"), Byte()))
' TextBox1.Text = Convert.ToString(READER("Firstname"))
End While

sql_connection.Close()
Catch ex As SqlException

MessageBox.Show(ex.Message)
End Try
End Sub

Private Sub attenddate_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles attenddate.Click

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Timer1.Tick
attenddate.Text = Now
End Sub

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnSave.Click

cn.Close()
cn.Open()

Dim cmd As SqlCommand = cn.CreateCommand


cmd.CommandText = "SELECT IDNo FROM tblattendanceinfo WHERE
IDNo ='" & txtIDno.Text & "' And Agenda ='" & txtagenda.Text & "' And testautoID
='" & testautoID.Text & "' "
dr = cmd.ExecuteReader

'AND LastName ='" & txtLastName.Text & "' AND FirstName ='" &
txtFirstName.Text & "' AND MiddleInitial ='" & txtMiddleInitial.Text & "' AND
Password ='" & txtpass.Text & "'

If dr.HasRows Then

'editupdate()

MsgBox("ID Already Exist", MsgBoxStyle.Information)

ElseIf txtIDno.Text = "" Or txtLastName.Text = "" Or txtFirstName.Text =


"" Or txtMiddleName.Text = "" Or txtContactNo.Text = "" Or txtCourse.Text = ""
Then

MsgBox("Empty field is not allowed", MsgBoxStyle.Critical)


Else

save()
pbCapture.Image = My.Resources.a
cleartext()
autoid()

' editupdate()

End If

cn.Close()

'save()

'pbCapture.Image = My.Resources.a
'cleartext()

'btnSave.Text = "HAHAY"
' btnSave.Enabled = False

End Sub

Sub save()

cn.Close()
cn.Open()

Dim Csql As New SqlCommand("INSERT INTO


tblattendanceinfo(IDNo,Course,ContactNo,LastName,FirstName,Middlename,Picture,
Agenda,Date,TimeRange,SigninMorning,SignoutMorning,SigninAfternoon,SignoutAfte
rnoon,Paid,Where1,testautoID) VALUES
(@IDNo,@Course,@ContactNo,@LastName,@FirstName,@Middlename,@Picture,@A
genda,@Date,@TimeRange,@SigninMorning,@SignoutMorning,@SigninAfternoon,@
SignoutAfternoon,@Paid,@Where1,@testautoID);", cn)

Csql.Parameters.AddWithValue("@IDNo", txtIDno.Text.Trim)
Csql.Parameters.AddWithValue("@Course", txtCourse.Text.Trim)
'Csql.Parameters.AddWithValue("@YearLevel", txtYearLevel.Text.Trim)
Csql.Parameters.AddWithValue("@ContactNo", txtContactNo.Text.Trim)
Csql.Parameters.AddWithValue("@LastName", txtLastName.Text.Trim)
Csql.Parameters.AddWithValue("@FirstName", txtFirstName.Text.Trim)
Csql.Parameters.AddWithValue("@Middlename",
txtMiddleName.Text.Trim)
Csql.Parameters.AddWithValue("@Agenda", txtagenda.Text.Trim)
Csql.Parameters.AddWithValue("@Date", attenddate.Text.Trim)
Csql.Parameters.AddWithValue("@TimeRange", txttimerange.Text.Trim)
Csql.Parameters.AddWithValue("@SigninMorning",
txtsigninmorning.Text.Trim)
Csql.Parameters.AddWithValue("@SignoutMorning",
txtsignoutmorning.Text.Trim)
Csql.Parameters.AddWithValue("@SigninAfternoon",
txtsigninafternoon.Text.Trim)
Csql.Parameters.AddWithValue("@SignoutAfternoon",
txtsignoutafternoon.Text.Trim)
Csql.Parameters.AddWithValue("@Where1", txtsigninmorning.Text.Trim)
Csql.Parameters.AddWithValue("@Paid", txtsigninmorning.Text.Trim)
Csql.Parameters.AddWithValue("@testautoID", testautoID.Text.Trim)
Csql.Parameters.Add(New SqlParameter("@Picture",
SqlDbType.Binary)).Value = ImageConverter.ImageToByte(pbCapture.Image)
'Csql.Parameters.Add(New SqlParameter("@Signature",
SqlDbType.Binary)).Value =
ImageConverter.ImageToByte(pbRecordSignature.Image)

'dr.Close()
Csql.ExecuteNonQuery()

MsgBox("The Information has been successfully saved!")

End Sub

Sub editupdate1()

Try
cn.Close()
cn.Open()

Dim cmd As SqlCommand = cn.CreateCommand


cmd.CommandText = "UPDATE tblattendanceinfo SET
SignoutMorning='" & txtsignoutmorning.Text & "' Where IDNo='" & txtIDno.Text &
"'"
cmd.ExecuteNonQuery()

cn.Close()

'ContactNo='" & txtContactNo.Text & "' ,Lastname='" &


txtLastName.Text & "' ,Firstname='" & txtFirstName.Text & "' ,Middlename='" &
txtMiddleName.Text & "' ,

'WHERE Agenda='" & txtIDno.Text & "'


' MsgBox("Yeah")

Catch ex As Exception
MsgBox(ex.Message)
End Try

cn.Close()

End Sub

Sub editupdate2()

Try
cn.Close()
cn.Open()

Dim cmd As SqlCommand = cn.CreateCommand

cmd.CommandText = "UPDATE tblattendanceinfo SET


SigninAfternoon='" & txtsigninafternoon.Text & "' Where IDNo='" & txtIDno.Text &
"'"
cmd.ExecuteNonQuery()

cn.Close()

'ContactNo='" & txtContactNo.Text & "' ,Lastname='" &


txtLastName.Text & "' ,Firstname='" & txtFirstName.Text & "' ,Middlename='" &
txtMiddleName.Text & "' ,

'WHERE Agenda='" & txtIDno.Text & "'


' MsgBox("Yeah")

Catch ex As Exception
MsgBox(ex.Message)
End Try

cn.Close()

End Sub

Sub editupdate3()

Try
cn.Close()
cn.Open()

Dim cmd As SqlCommand = cn.CreateCommand

cmd.CommandText = "UPDATE tblattendanceinfo SET


SignoutAfternoon='" & txtsigninafternoon.Text & "' Where IDNo='" & txtIDno.Text &
"'"
cmd.ExecuteNonQuery()

cn.Close()

'ContactNo='" & txtContactNo.Text & "' ,Lastname='" &


txtLastName.Text & "' ,Firstname='" & txtFirstName.Text & "' ,Middlename='" &
txtMiddleName.Text & "' ,

'WHERE Agenda='" & txtIDno.Text & "'


' MsgBox("Yeah")

Catch ex As Exception
MsgBox(ex.Message)
End Try

cn.Close()

End Sub

Private Sub BackToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles BackToolStripMenuItem2.Click

Agendainfo.Show()
Me.Hide()

cleartext()
pbCapture.Image = My.Resources.a

btnSave.Visible = False
btnup1.Visible = False
btnup2.Visible = False
btn3.Visible = False

End Sub

Sub cleartext()

txtIDno.Text = ""
txtCourse.Text = ""
'txtYearLevel.Text = ""
txtContactNo.Text = ""
txtLastName.Text = ""
txtFirstName.Text = ""
txtMiddleName.Text = ""
txtsigninmorning.Text = ""
txtsignoutmorning.Text = ""
txtsigninafternoon.Text = ""
txtsignoutafternoon.Text = ""

Agendainfo.TextBox1.Text = ""
Agendainfo.txtwhat.Text = ""

End Sub

Private Sub LogoutToolStripMenuItem_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
LogoutToolStripMenuItem.Click
Me.Close()
Logininfo.Show()

cleartext()

End Sub

Private Sub txtpresent_TextChanged(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles txtsigninmorning.TextChanged

End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles TextBox1.TextChanged
TextBox1.Text = txtIDno.Text
'txtIDno.Text = TextBox1.Text

End Sub

Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Label2.Click

End Sub

Private Sub txtContactNo_TextChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles txtContactNo.TextChanged

End Sub

Private Sub btnup1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnup1.Click
' If MsgBox("Are you sure you want to Logout?", MsgBoxStyle.YesNo Or
MsgBoxStyle.DefaultButton2, "Close application") =
Windows.Forms.DialogResult.Yes Then

cn.Close()
cn.Open()

Dim cmd As SqlCommand = cn.CreateCommand


cmd.CommandText = "SELECT IDNo FROM tblattendanceinfo WHERE
IDNo ='" & txtIDno.Text & "' And Agenda ='" & txtagenda.Text & "' And testautoID
='" & testautoID.Text & "' "
dr = cmd.ExecuteReader

'AND LastName ='" & txtLastName.Text & "' AND FirstName ='" &
txtFirstName.Text & "' AND MiddleInitial ='" & txtMiddleInitial.Text & "' AND
Password ='" & txtpass.Text & "'

If dr.HasRows Then

'If MsgBox("ID Already Exist, Do you want to Update?",


MsgBoxStyle.YesNo Or MsgBoxStyle.DefaultButton2, "Close application") =
Windows.Forms.DialogResult.Yes Then

editupdate1()
MsgBox("Update Successfully", MsgBoxStyle.Information)

dr.Close()
ElseIf txtIDno.Text = "" Or txtLastName.Text = "" Or txtFirstName.Text =
"" Or txtMiddleName.Text = "" Or txtContactNo.Text = "" Or txtCourse.Text = ""
Then
MsgBox("Empty field is not allowed")

Else

save()

End If
' End If
cn.Close()

End Sub

Private Sub btnup2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnup2.Click

cn.Close()
cn.Open()

Dim cmd As SqlCommand = cn.CreateCommand


cmd.CommandText = "SELECT IDNo FROM tblattendanceinfo WHERE
IDNo ='" & txtIDno.Text & "' And Agenda ='" & txtagenda.Text & "' And testautoID
='" & testautoID.Text & "' "
dr = cmd.ExecuteReader

'AND LastName ='" & txtLastName.Text & "' AND FirstName ='" &
txtFirstName.Text & "' AND MiddleInitial ='" & txtMiddleInitial.Text & "' AND
Password ='" & txtpass.Text & "'

If dr.HasRows Then

'If MsgBox("ID Already Exist, Do you want to Update?",


MsgBoxStyle.YesNo Or MsgBoxStyle.DefaultButton2, "Close application") =
Windows.Forms.DialogResult.Yes Then

editupdate2()
MsgBox("Update Successfully", MsgBoxStyle.Information)

dr.Close()
ElseIf txtIDno.Text = "" Or txtLastName.Text = "" Or txtFirstNa

MsgBox("Empty field is not allowed


Else
save()
cleartext()
End If
' End If
cn.Close()

End Sub

Private Sub btn3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btn3.Click
cn.Close()
cn.Open()

Dim cmd As SqlCommand = cn.CreateCommand


cmd.CommandText = "SELECT IDNo FROM tblattendanceinfo WHERE
IDNo ='" & txtIDno.Text & "' And Agenda ='" & txtagenda.Text & "' And testautoID
='" & testautoID.Text & "' "
dr = cmd.ExecuteReader

'AND LastName ='" & txtLastName.Text & "' AND FirstName ='" &
txtFirstName.Text & "' AND MiddleInitial ='" & txtMiddleInitial.Text & "' AND
Password ='" & txtpass.Text & "'

If dr.HasRows Then

'If MsgBox("ID Already Exist, Do you want to Update?",


MsgBoxStyle.YesNo Or MsgBoxStyle.DefaultButton2, "Close application") =
Windows.Forms.DialogResult.Yes Then

editupdate3()
MsgBox("Update Successfully", MsgBoxStyle.Information)

dr.Close()
ElseIf txtIDno.Text = "" Or txtLastName.Text = "" Or txtFirstName.Text =
"" Or txtMiddleName.Text = "" Or txtContactNo.Text = "" Or txtCourse.Text = ""
Then

MsgBox("Empty field is not allowed")


Else
save()

End If
' End If
cn.Close()
End Sub
End Class

Imports System.Drawing.Imaging
''' <summary>
''' Image Converter Helper
''' </summary>
''' <remarks>Last update : </remarks>
Public Class ImageConverter

Public Shared Function ImageToByte(ByVal image As Bitmap) As Byte()


If image Is Nothing Then Return Nothing
Dim ms As New IO.MemoryStream
Dim newimg As New Bitmap(image)
newimg.Save(ms, ImageFormat.Jpeg)
Dim data As Byte() = Nothing
data = ms.GetBuffer()
Return data
End Function

Public Shared Function ByteToImage(ByVal _byte As Byte()) As Image


Dim imageData As Byte() = Nothing
Dim bmImage As New Bitmap(640, 480)
imageData = _byte
If Not imageData Is Nothing Then
Using ms As New IO.MemoryStream(imageData, 0,
imageData.Length)
ms.Write(imageData, 0, imageData.Length)
bmImage = Image.FromStream(ms)
End Using
End If
Return bmImage
End Function
End Class

Imports System.Data
Imports System.Data.SqlClient
Imports System.IO

Public Class Logininfo

Dim conn As SqlConnection


Dim cn As New SqlConnection("Data Source = DESKTOP-CPNQCCI;
integrated Security = true;" & "Initial Catalog = StudentAttendanceSystem")
Dim cmd As New SqlCommand
Dim dr As SqlDataReader
Dim dr2 As SqlDataReader
Dim sql_command As SqlClient.SqlCommand

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
cn.Close()
cn.Open()
Dim cmd As New SqlCommand("SELECT * FROM tbllogininfo WHERE
IDNo = @IDNo And Password = @Password", cn)
cmd.Parameters.AddWithValue("@IDNo", txtIDno.Text)
cmd.Parameters.AddWithValue("@Password", txtpass.Text)
Dim sdr As SqlDataReader = cmd.ExecuteReader()
Try
If (sdr.Read() = True) Then
GoTo inn
Else
MsgBox("Invalid ID", MsgBoxStyle.Critical)
txtIDno.Text = ""
txtpass.Text = ""
txtIDno.Focus()
Exit Sub
inn:
If sdr("Authority") = "Councilor" Then
authority.Text = "Councilor"
txtIDno.Text = ""
txtpass.Text = ""
' authority.Text = ""
'MsgBox("Successfully Login")
Agendainfo.Label19.Text = authority.Text

Me.Hide()

Agendainfo.Show()
Agendainfo.Button2.Enabled = True
Agendainfo.FileMaintenanceToolStripMenuItem.Enabled = False
Agendainfo.MasterListToolStripMenuItem.Enabled = True
Agendainfo.Button3.Enabled = True

Else
If sdr("Authority") = "President" Then
authority.Text = "President"
txtIDno.Text = ""
txtpass.Text = ""
'authority.Text = ""

Me.Hide()
Agendainfo.Show()
Agendainfo.btnadd.Enabled = True
Agendainfo.btnsave.Enabled = True
Agendainfo.btnedit.Enabled = True
Agendainfo.btncancel.Enabled = True
Agendainfo.Button2.Enabled = True
Agendainfo.btncancel.Enabled = True
Agendainfo.Button3.Enabled = True
Agendainfo.Label19.Text = authority.Text
Else
If sdr("Authority") = "IT" Then
authority.Text = "IT"
txtIDno.Text = ""
txtpass.Text = ""
'authority.Text = ""

Me.Hide()

Agendainfo.Show()

Agendainfo.btnadd.Enabled = True
Agendainfo.btnsave.Enabled = True
Agendainfo.btnedit.Enabled = True
Agendainfo.btncancel.Enabled = True
Agendainfo.Button2.Enabled = True
Agendainfo.btncancel.Enabled = True
Agendainfo.Label19.Text = authority.Text
Exit Sub
End If
End If
End If
End If
Catch ex As Exception

End Try

cn.Close()

End Sub

'Private Sub keypress_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles Button1.KeyPress,
txtpass.KeyPress

' Dim NotAllowed As String = "-,+=/\[]{};:.,_'"

' If e.KeyChar <> ControlChars.Back = True Then


' If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then
' e.Handled = True
' End If
' End If

' If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then


' SendKeys.Send("{TAB}")
' e.Handled = True
' End If
'End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs)
Me.Close()
End Sub

Private Sub Logininfo_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
txtIDno.Focus()

End Sub

Private Sub IDrestriction(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtIDno.KeyPress

Dim NotAllowed As String = "-,+=/\[]


{};:.,_'qwertyuiopasdfghjklzxcvbnm<>?"

If e.KeyChar <> ControlChars.Back = True Then


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then
e.Handled = True
End If
End If

If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then


SendKeys.Send("{TAB}")
e.Handled = True
End If
End Sub

End Class

Imports System.Data
Imports System.Data.SqlClient
Imports System.IO
Imports Excel = Microsoft.Office.Interop.Excel

Public Class MasterListinfo

Dim conn As SqlConnection


Dim cn As New SqlConnection("Data Source = DESKTOP-CPNQCCI;
integrated Security = true;" & "Initial Catalog = StudentAttendanceSystem")
Dim cmd As New SqlCommand
Dim dr As SqlDataReader
Dim dr2 As SqlDataReader
Dim sql_command As SqlClient.SqlCommand

Private Sub searching()


cn.Close()
cn.Open()
With cmd
.Connection = cn
'.CommandText = "SELECT * FROM tblattendanceinfo WHERE Agenda
like '%" & txtagenda.Text & "%' And Date like '%" & txtagenda.Text & "%' "
.CommandText = "Select * From tblattendanceinfo Where Agenda like
'%" & txtagenda.Text & "%' Or IDNo like '%" & txtagenda.Text & "%' Or Lastname
like '%" & txtagenda.Text & "%' Or Firstname like '%" & txtagenda.Text & "%' Or
Middlename like '%" & txtagenda.Text & "%' Or ContactNo like '%" & txtagenda.Text
& "%' Or Course like '%" & txtagenda.Text & "%' Or Date like '%" & txtagenda.Text &
"%' OR Paid like '%" & txtagenda.Text & "%' "
End With
ListView1.Items.Clear()
dr = cmd.ExecuteReader

While dr.Read
With ListView1
.Items.Add(dr.Item(0))
With .Items(.Items.Count - 1).SubItems
.Add(dr(7))
.Add(dr(3))
.Add(dr(4))
.Add(dr(5))
.Add(dr(2))
.Add(dr(1))
.Add(dr(10))
.Add(dr(11))
.Add(dr(12))
.Add(dr(13))
.Add(dr(14))
'.Add(dr(12))
'.Add(dr(13))

End With
End With
End While

cn.Close()

End Sub

Private Sub searchfilltxtbox()


Dim ds As New DataSet

cn.Close()
cn.Open()

Dim cmd As SqlCommand = New SqlCommand("SELECT Agenda, Date


FROM tblattendanceinfo WHERE Agenda='" & txtagenda.Text & "'", cn)

dr = cmd.ExecuteReader
If dr.Read Then
txtagenda.Text = dr("Agenda").ToString
Label3.Text = dr("Date").ToString

End If

cn.Close()

End Sub

Sub showcontrolbox()
'cn.Close()
'cn.Open()
'Dim dt As New DataTable
'Dim ds As New DataSet

'ds.Tables.Add(dt)
'Dim da1 As New SqlDataAdapter("SELECT Agenda FROM
tblattendanceinfo Order by Agenda", cn) '<--or ("SELECT fname FROM users", conn)

'da1.fill(dt)

'Dim myRow As DataRow


'txtagenda.Items.Clear()
'For Each myRow In dt.Rows
' txtagenda.Items.Add(myRow.Item(0))
'Next

End Sub

Private Sub MasterListinfo_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
'showcontrolbox()
showall()

End Sub

Private Sub showall()


Dim dt As New DataTable
Dim ds As New DataSet

ds.Tables.Add(dt)

Dim da As New SqlDataAdapter("SELECT * FROM tblattendanceinfo", cn)

da.Fill(dt)

Dim myRow As DataRow


ListView1.Items.Clear()
For Each myRow In dt.Rows
ListView1.Items.Add(myRow.Item(0))
ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(7))
ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(3))
ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(4))
ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(5))
ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(2))
ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(1))
ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(10))
ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(11))
ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(12))
ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(13))
ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(14))

Next

End Sub

Private Sub txtagenda_TextChanged(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles txtagenda.TextChanged
searching()
End Sub

Private Sub btnaddstudent_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles btnaddstudent.Click

Form1.btnSave.Enabled = True
Form1.btnupdate.Enabled = False

Form1.btnupdate.Visible = False
Form1.btnSave.Visible = True
Me.Hide()
Form1.Show()

End Sub
Private Sub btnupdatestudent_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnupdatestudent.Click

Form1.btnupdate.Visible = True
Form1.btnSave.Visible = False
Me.Hide()

Form1.btnSave.Enabled = False
Form1.btnupdate.Enabled = True
Form1.Show()

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click

Me.Hide()
Agendainfo.Show()

End Sub
End Class

Imports System.Data
Imports System.Data.SqlClient
Imports System.IO

Imports Excel = Microsoft.Office.Interop.Excel

Public Class Payment

Dim conn As SqlConnection


Dim cn As New SqlConnection("Data Source = DESKTOP-CPNQCCI;
integrated Security = true;" & "Initial Catalog = StudentAttendanceSystem")
Dim cmd As New SqlCommand
Dim dr As SqlDataReader
Dim dr2 As SqlDataReader
Dim sql_command As SqlClient.SqlCommand
Private Sub Payment_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

showall()

End Sub

Private Sub searching()


cn.Close()
cn.Open()
With cmd
.Connection = cn
.CommandText = "SELECT * FROM tblattendanceinfo WHERE IDNo like
'%" & txtIDno.Text & "%'"

End With
ListView1.Items.Clear()
dr = cmd.ExecuteReader

While dr.Read
With ListView1
.Items.Add(dr.Item(0))
With .Items(.Items.Count - 1).SubItems
.Add(dr(1))
.Add(dr(2))
.Add(dr(3))
.Add(dr(4))
.Add(dr(5))
.Add(dr(6))
.Add(dr(7))

End With
End With
End While

cn.Close()

End Sub

Private Sub showall()


Dim dt As New DataTable
Dim ds As New DataSet
ds.Tables.Add(dt)

' Dim da As New SqlDataAdapter("SELECT


ID,Firstname,Middlename,Lastname,Gender,Company,Position,DATE,Agenda FROM
Attende WHERE Agenda='" & txtAgenda.Text & "'", cn)

Dim da As New SqlDataAdapter("SELECT * FROM tblattendanceinfo", cn)

'Dim da As New SqlDataAdapter("SELECT * FROM Attende WHERE


Agenda='" & txtAgenda.Text & "' ORDER BY DATE ASC ", cn)

da.Fill(dt)

Dim myRow As DataRow


ListView1.Items.Clear()
For Each myRow In dt.Rows
ListView1.Items.Add(myRow.Item(7))
ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(3))
ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(4))
ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(5))
ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(10))
ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(11))
ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(12))
ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(13))

Next

End Sub

Sub printagenda()
Dim fileTest As String = Application.StartupPath & "\GeneratedReport\" &
"\Attendance.xlsx"
Dim oExcel As Object
oExcel = CreateObject("Excel.Application")
oExcel.Visible = True
oExcel.Workbooks.Open(fileTest)
Dim oBook As Excel.Workbook
Dim oSheet As Excel.Worksheet
oBook = oExcel.ActiveWorkbook
oSheet = oExcel.Worksheets(1)

Dim dt As New DataTable


Dim nRow As Integer
'Dim nRow1 As Integer
' Dim nRow2 As Integer
Dim cSQL As String = "SELECT * FROM tblattendanceinfo where IDNo ='"
& txtIDno.Text & "' "
'cSQL &= "WHERE Agenda BETWEEN '" & strdatefrom & "' AND '" &
strdateto & "' "
'cSQL = "SELECT * FROM tblattendanceinfo where IDNo = '" &
txtIDno.Text & "' And Agenda = '" & txtagenda.Text & "' "
'cSQL &= "where Agenda='" & TextBox1.Text & "'"

dt = MSSQL.SQLGetDataTable(cSQL)
nRow = 15
'nRow1 = 10
'nRow2 = 12

' oSheet.Range("G" & nRow1).Value = Attendanceinfo.txttimerange.Text

For Each dr As DataRow In dt.Rows

'oSheet.Range("B" & nRow2).Value = dr.Item("TimeRange").ToString


' oSheet.Range("D" & nRow2).Value = dr.Item("Paid").ToString
oSheet.Range("A" & nRow).Value = dr.Item("Agenda").ToString
oSheet.Range("C" & nRow).Value = dr.Item("Lastname").ToString
oSheet.Range("D" & nRow).Value = dr.Item("Firstname").ToString
oSheet.Range("E" & nRow).Value = dr.Item("Middlename").ToString
oSheet.Range("F" & nRow).Value = dr.Item("SigninMorning").ToString
oSheet.Range("G" & nRow).Value =
dr.Item("SignoutMorning").ToString
oSheet.Range("H" & nRow).Value =
dr.Item("SigninAfternoon").ToString
oSheet.Range("I" & nRow).Value =
dr.Item("SignoutAfternoon").ToString
'oSheet.Range("F" & nRow).Value = dr.Item("Course").ToString
oSheet.Range("B" & nRow).Value = dr.Item("Date").ToString
' oSheet.Range("D" & nRow2).Value = dr.Item("Paid").ToString
'Dim strTempPath As String = Application.StartupPath +
"/Temp/temp.jpg"
'Dim bmp As New
Bitmap(ImageConverter.ByteToImage(TryCast(dr.Item("Signature"), Byte())), 85,
oSheet.Range("G" & nRow).Height)
'bmp.Save(strTempPath)
'insertPictureOnCell(strTempPath, oSheet, oSheet.Range("G" & nRow),
Nothing, 80)
'If IO.File.Exists(strTempPath) Then IO.File.Delete(strTempPath)
'nRow += 1

Next

oBook.PrintPreview()
oExcel.DisplayAlerts = False
oBook.Close()
oExcel.Quit()

End Sub

Private Sub txtIDno_TextChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs)

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click

printagenda()
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Me.Hide()
Agendainfo.Show()

End Sub
Private Sub txtIDno_TextChanged_1(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles txtIDno.TextChanged
searching()
End Sub
End Class

Imports System.Data
Imports System.Data.SqlClient
Imports System.IO

Public Class Registeruser

Dim conn As SqlConnection


Dim cn As New SqlConnection("Data Source = DESKTOP-CPNQCCI;
integrated Security = true;" & "Initial Catalog = StudentAttendanceSystem")
Dim cmd As New SqlCommand
Dim dr As SqlDataReader
Dim dr2 As SqlDataReader
Dim sql_command As SqlClient.SqlCommand

Private Sub btnregister_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnregister.Click

cn.Open()

Dim cmd As SqlCommand = cn.CreateCommand


cmd.CommandText = "SELECT IDNo FROM tbllogininfo WHERE IDNo ='"
& txtIDno.Text & "'"
dr = cmd.ExecuteReader

'AND LastName ='" & txtLastName.Text & "' AND FirstName ='" &
txtFirstName.Text & "' AND MiddleInitial ='" & txtMiddleInitial.Text & "' AND
Password ='" & txtpass.Text & "'

If dr.HasRows Then
MsgBox("ID Number Already Exist!")

ElseIf txtIDno.Text = "" Or txtLastName.Text = "" Or txtFirstName.Text =


"" Or txtMiddleInitial.Text = "" Or txtpass.Text = "" Then

MsgBox("Empty field is not allowed")

Else

save()
Agendainfo.Show()
Me.Hide()

End If

cn.Close()

End Sub

Sub save()

cn.Close()
cn.Open()
Dim Csql As New SqlCommand("INSERT INTO
tbllogininfo(IDNo,Contact,LastName,FirstName,MiddleInitial,Password,Authority)
VALUES
(@IDNo,@Contact,@LastName,@FirstName,@MiddleInitial,@Password,@Authority);"
, cn)

Csql.Parameters.AddWithValue("@IDNo", txtIDno.Text.Trim)
Csql.Parameters.AddWithValue("@Contact", txtContactNo.Text.Trim)
Csql.Parameters.AddWithValue("@LastName", txtLastName.Text.Trim)
Csql.Parameters.AddWithValue("@FirstName", txtFirstName.Text.Trim)
Csql.Parameters.AddWithValue("@MiddleInitial",
txtMiddleInitial.Text.Trim)
Csql.Parameters.AddWithValue("@Password", txtpass.Text.Trim)
Csql.Parameters.AddWithValue("@Authority", txtauthority.Text.Trim)

Csql.ExecuteNonQuery()

MsgBox("The Information has been successfully saved!")

End Sub

Private Sub btnback_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnback.Click
Me.Close()
Agendainfo.Show()

End Sub

Private Sub Registeruser_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load

End Sub

Private Sub keypress_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtIDno.KeyPress,
txtContactNo.KeyPress, txtLastName.KeyPress, txtFirstName.KeyPress,
txtMiddleInitial.KeyPress

Dim NotAllowed As String = "-,+=/\[]{};:.,_'<>?!@#$%^&*()~"

If e.KeyChar <> ControlChars.Back = True Then


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then
e.Handled = True
End If
End If

If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then


SendKeys.Send("{TAB}")
e.Handled = True
End If
End Sub

End Class

Imports Excel = Microsoft.Office.Interop.Excel


Module RepAttendance

#Region "ExcelWriter"

Public Class ExcelWriter


Private stream As IO.Stream
Private writer As IO.BinaryWriter

Private clBegin As UShort() = {&H809, 8, 0, &H10, 0, 0}


Private clEnd As UShort() = {&HA, 0}

Private Sub WriteUshortArray(ByVal value As UShort())


For i As Integer = 0 To value.Length - 1
writer.Write(value(i))
Next
End Sub

Public Sub New(ByVal stream As IO.Stream)


Me.stream = stream
writer = New IO.BinaryWriter(stream)
End Sub

Public Sub WriteCell(ByVal row As Integer, ByVal col As Integer, ByVal


value As String)
Dim clData As UShort() = {&H204, 0, 0, 0, 0, 0}
Dim iLen As Integer = value.Length
Dim plainText As Byte() =
System.Text.Encoding.ASCII.GetBytes(value)
clData(1) = CUShort(8 + iLen)
clData(2) = CUShort(row)
clData(3) = CUShort(col)
clData(5) = CUShort(iLen)
WriteUshortArray(clData)
writer.Write(plainText)
End Sub

Public Sub WriteCell(ByVal row As Integer, ByVal col As Integer, ByVal


value As Integer)
Dim clData As UShort() = {&H27E, 10, 0, 0, 0}
clData(2) = CUShort(row)
clData(3) = CUShort(col)
WriteUshortArray(clData)
Dim iValue As Integer = (value << 2) Or 2
writer.Write(iValue)
End Sub

Public Sub WriteCell(ByVal row As Integer, ByVal col As Integer, ByVal


value As Double)
Dim clData As UShort() = {&H203, 14, 0, 0, 0}
clData(2) = CUShort(row)
clData(3) = CUShort(col)
WriteUshortArray(clData)
writer.Write(value)
End Sub

Public Sub WriteCell(ByVal row As Integer, ByVal col As Integer)


Dim clData As UShort() = {&H201, 6, 0, 0, &H17}
clData(2) = CUShort(row)
clData(3) = CUShort(col)
WriteUshortArray(clData)
End Sub

Public Sub BeginWrite()


WriteUshortArray(clBegin)
End Sub

Public Sub EndWrite()


WriteUshortArray(clEnd)
writer.Flush()
End Sub
End Class

#End Region

#Region "REPORTS"
'Public Sub AttendeeReport()
' Dim fileTest As String = Application.StartupPath & "\GeneratedReport\"
& "\Attendance.xlsx"
' Dim oExcel As Object
' oExcel = CreateObject("Excel.Application")
' oExcel.Visible = True
' oExcel.Workbooks.Open(fileTest)
' Dim oBook As Excel.Workbook
' Dim oSheet As Excel.Worksheet
' oBook = oExcel.ActiveWorkbook
' oSheet = oExcel.Worksheets(1)

' Dim dt As New DataTable


' Dim nRow As Integer
' Dim nRow1 As Integer
' Dim cSQL As String = "SELECT * FROM tblattendanceinfo "
' 'cSQL &= "WHERE Agenda BETWEEN '" & strdatefrom & "' AND '" &
strdateto & "' "
' 'cSQL &= "WHERE Agenda='" & Form1.txtAgenda.Text & "'"

' dt = MSSQL.SQLGetDataTable(cSQL)
' nRow = 15
' nRow1 = 10

' oSheet.Range("B" & nRow1).Value = Attendanceinfo.txtagenda.Text


' oSheet.Range("B" & nRow1).Value = Agendainfo.Agenda.Text
' oSheet.Range("G" & nRow1).Value = Attendanceinfo.txttimerange.Text

' For Each dr As DataRow In dt.Rows

' oSheet.Range("A" & nRow).Value = dr.Item("IDNo").ToString


' oSheet.Range("A" & nRow).Value = dr.Item("Course").ToString
' oSheet.Range("A" & nRow).Value = dr.Item("YearLevel").ToString
' oSheet.Range("E" & nRow).Value = dr.Item("ContactNo").ToString
' oSheet.Range("B" & nRow).Value = dr.Item("Lastname").ToString
' oSheet.Range("C" & nRow).Value = dr.Item("Firstname").ToString
' oSheet.Range("D" & nRow).Value = dr.Item("MiddleInitial").ToString
' oSheet.Range("E" & nRow).Value = dr.Item("Agenda").ToString

' 'Dim strTempPath As String = Application.StartupPath +


"/Temp/temp.jpg"
' 'Dim bmp As New
Bitmap(ImageConverter.ByteToImage(TryCast(dr.Item("Signature"), Byte())), 85,
oSheet.Range("G" & nRow).Height)
' 'bmp.Save(strTempPath)
' 'insertPictureOnCell(strTempPath, oSheet, oSheet.Range("G" & nRow),
Nothing, 80)
' 'If IO.File.Exists(strTempPath) Then IO.File.Delete(strTempPath)
' 'nRow += 1

' Next

' oBook.PrintPreview()
' oExcel.DisplayAlerts = False
' oBook.Close()
' oExcel.Quit()
'End Sub
#End Region

#Region "FUNCTIONS REPORT"

Public Sub insertPictureOnCell(ByVal filePath As String, ByVal sheet As


Excel.Worksheet, ByVal range As Excel.Range, Optional ByVal customHeight As
Integer = Nothing, Optional ByVal customWidth As Integer = Nothing)
Try
Dim intHeight As Integer = range.Height
Dim intWidth As Integer = range.Width
If customHeight <> Nothing Then intHeight = customHeight
If customWidth <> Nothing Then intWidth = customWidth
sheet.Shapes.AddPicture(filePath,
Microsoft.Office.Core.MsoTriState.msoFalse,
Microsoft.Office.Core.MsoTriState.msoCTrue,
range.Left,
range.Top,
intWidth,
intHeight)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

#End Region

End Module

Imports System.Management
Imports System.IO.Ports

Imports System.Data
Imports System.Data.SqlClient
Imports System.IO

Public Class SMSinfo

Dim conn As SqlConnection


Dim cn As New SqlConnection("Data Source = DESKTOP-CPNQCCI;
integrated Security = true;" & "Initial Catalog = StudentAttendanceSystem")
'Dim cn As New SqlConnection("Data Source = EVAJHEAN05-
PC\SQLEXPRESS; integrated Security = true;" & "Initial Catalog =
StudentAttendanceSystem")
Dim cmd As New SqlCommand
Dim dr As SqlDataReader
Dim dr2 As SqlDataReader
Dim sql_command As SqlClient.SqlCommand

Dim SerialPort1 As New System.IO.Ports.SerialPort()

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load

Dim ports() As String


ports = Split(ModemsConnected(), "***")
For i As Integer = 0 To ports.Length - 2
ComboBox1.Items.Add(ports(i))

Next

SerialPort1.PortName = Comport.Text
SerialPort1.BaudRate = 9600
SerialPort1.Parity = Parity.None
SerialPort1.StopBits = StopBits.One
SerialPort1.DataBits = 8
SerialPort1.Handshake = Handshake.RequestToSend
SerialPort1.DtrEnable = True
SerialPort1.RtsEnable = True
SerialPort1.NewLine = vbCrLf

'showall()

End Sub

Public Function ModemsConnected() As String


Dim modems As String = ""
Try
Dim searcher As New ManagementObjectSearcher( _
"root\CIMV2", _
"SELECT * FROM Win32_POTSModem")

For Each queryObj As ManagementObject In searcher.Get()


If queryObj("Status") = "OK" Then
modems = modems & (queryObj("AttachedTo") & " - " &
queryObj("Description") & "***")
End If
Next
Catch err As ManagementException
MessageBox.Show("An error occurred while querying for WMI data: "
& err.Message)
Return ""
End Try
Return modems

End Function

Private Sub showall()


Dim dt As New DataTable
Dim ds As New DataSet

ds.Tables.Add(dt)

' Dim da As New SqlDataAdapter("SELECT


ID,Firstname,Middlename,Lastname,Gender,Company,Position,DATE,Agenda FROM
Attende WHERE Agenda='" & txtAgenda.Text & "'", cn)

Dim da As New SqlDataAdapter("SELECT ContactNo FROM


tblattendanceinfo Order by ContactNo", cn)

'Dim da As New SqlDataAdapter("SELECT * FROM Attende WHERE


Agenda='" & txtAgenda.Text & "' ORDER BY DATE ASC ", cn)

da.Fill(dt)

Dim myRow As DataRow


ListView1.Items.Clear()
For Each myRow In dt.Rows
ListView1.Items.Add(myRow.Item(0))
'ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(1))
'ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(2))
'ListView1.Items(ListView1.Items.Count -
1).SubItems.Add(myRow.Item(3))
Next

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim sql As New SqlDataAdapter("SELECT * FROM tblattendanceinfo",
cn)
Dim ds As New DataSet
Dim send As String
Dim dt As New DataTable
sql.Fill(ds, 0)
For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
send = i
send = (ds.Tables(0).Rows(i).Item(2).ToString)

If SerialPort1.IsOpen Then
SerialPort1.Close()

Else

SerialPort1.PortName = Comport.Text.ToString
Try
SerialPort1.Open()

If SerialPort1.IsOpen() Then

SerialPort1.Write("AT" & vbCrLf)


SerialPort1.Write("AT+CMGF=1" & vbCrLf)
SerialPort1.Write("AT+CMGS=" & Chr(34) &
ds.Tables(0).Rows(i).Item(2).ToString & Chr(34) & vbCrLf)
'BussName.Text = BussName.Text + message.Text
SerialPort1.Write(RichTextBox1.Text & Chr(26))
' MsgBox("Message sent successfully")
'BussName.Text = ""
'Contact.Text = ""

SerialPort1.Close()
'Exit Sub
'Selse
End If

Catch ex As Exception
SerialPort1.Close()
' sqlcon.Close()
Exit Sub
MsgBox("Please Insert a Bundle/Broadband!")

Finally

End Try
End If
With ListView1.Items.Add("send ---- " & (ds.Tables(0).Rows(i).Item(2)),
2)

End With
ListView1.Refresh()
MsgBox("Now sending SMS to : " & (ds.Tables(0).Rows(i).Item(4)))
Next
MsgBox("SEND SUCCESSFULLY!")

End Sub

Private Sub ComboBox1_SelectedValueChanged(ByVal sender As Object,


ByVal e As System.EventArgs) Handles ComboBox1.SelectedValueChanged
Comport.Text = Trim(Mid(ComboBox1.Text, 1, 5))
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click

Me.Hide()
Agendainfo.Show()

End Sub
End Class
Appendix B
EVALUATION TOOL OR TEST
DOCUMENTS

QUESTIONNAIRES DURING INTERVIEW

1. If they cannot pay the fines what are the options?

2. It can be hassle in every student to bring attendance card?

3. The SSC Officers will be collecting their fines on the day of signing their
clearance?

4. The SSC officers will inspect their clearance?

5. The SSC provides a copy of their fines?

6. How did you monitor the students with or with/out bias?

Questionnaire for CFCI Library System Users


Direction: Please mark check () the box that corresponds to your answer.

1. Do you prefer to use computerized system in your SSC Office?


Yes No Maybe

2. Is it time consuming for you to take attendance?


Yes No Maybe

3. Do you think this system could help you much in making to be easier?
Yes No Maybe

4. Are you willing to accept changes in your SSC Office?

Yes No Maybe
Appendix C
SAMPLE INPUT/ OUTPUT/
REPORTS
Appendix D
USER GUIDE

LOG IN INTO THE SYSTEM

How to log in?

1 The SSC Scan the ID of the student.

2 SSC will record the attendance of the student through system.


1 Log in security for the System Admin.

2 SSC will pick the Agenda


3 The Student was already Sign In.

4 The Attendance Form has Save.

How to print out the Payment form? Scan the ID and click the print.

1. If the student want to request their fines to the SSC the SSC will print out
the payment form.

How to send SMS Notification?

1 Go to switch Board then click SMS select Modem and Contact no. of the
students then Send.
Appendix E
PROCESS / DATA
INFORMATION FLOW

Current Process
1.1 Disseminating Information
1.2 Purchasing Attendance Card
1.3 Signing of Attendance card

1.4 Signing of Clearance


Proposed Process
1.1 Disseminating Information through SMS

1.2 Signing of Attendance


1.3 Paying of fines
Appendix F
SCREEN LAYOUTS

Log in Form

Log in security for the System Admin


Switch Board

SMS Information Form


Main Form

Attendance Form
Payment Form
Appendix G
TEST RESULT
Appendix H
PICTURES
Appendix I
CURRICULUM VITAE

Daimler B. Fernandez

Personal Information

Gender : Male

Date of Birth : February 5, 1993

Place of Birth : Lout Malapatan, Sarangani Province

Educational Background

Elementary Level :

Secondary Level :

Tertiary Level : Cronasia Foundation College, Inc.

March 2017
Affliations/Achievements

Arnel G. Campoy

San Isidro VSM Phase 1 GSC.

Campoyarnel@gmail.com

09776145114

Personal Information

Gender : Male

Date of Birth : February 5, 1993

Place of Birth : Lout Malapatan, Sarangani Province

Educational Background

Elementary Level : Lagao Central Elementary School.

2005-2006

Secondary Level : National Secondary School Arts and Trades.

2009-2010

Tertiary Level : Cronasia Foundation College, Inc.

2016-2017
Affliations/Achievements

Jessa Mae S. Quistadio

Hermosa Subd. Capricorn St. GSC.

Jessamae_quistadio@y.c

09102163055

Personal Information

Gender : Female

Date of Birth : January 16, 1996

Place of Birth : Doctors Hospital GSC.

Educational Background

Elementary Level : Koronadal Central Elementary School 1

2007-2008

Secondary Level : Koronadal National Comprehensive

HighSchool

2011-2012
Tertiary Level : Cronasia Foundation College, Inc.

2016-2017

Affliations/Achievements