Professional Documents
Culture Documents
For Book Thesis
For Book Thesis
________________________________________
________________________________________
By:
ASUNCION, LILIBETH G.
DAKILA, GAILLE SANDRA R.
VINARAO, JUNEYCO A.
JANUARY 2019
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
APPROVAL SHEET
In partial fulfilment of the academic requirements for the degree of Bachelor of Science
in Information Technology, this thesis entitled “BARANGAY PROFILING SYSTEM OF
BARANGAY SAN ESTEBAN, ALCALA, CAGAYAN ” has been prepared and submitted by
LILIBETH G. ASUNCION, GAILLE SANDRA R. DAKILA, and JUNEYCO A VINARAO
who here by recommended for Oral Examination.
Accepted and approved in partial fulfilment of the requirements for the degree of
Bachelor of Science in Information Technology.
Acknowledgement
The researcher and developer gratefully acknowledge the invaluable support and
assistance extended by the following persons for without them the study would not reach the
ladder of success.
To the parents that support, love and encourage us to study and finished this book.
And to the Barangay of San Esteban and to their barangay officials to be led by Captain
Francisco Verzola who accepted our proposal to be the sample area of our research and give
information and cooperation in the time of interviewing and gathering information.
To Mr. Christian Gregory Carag who made the new logo of the barangay.
To our friends and classmates who joined us while doing this project and give us support.
Above all, to our Almighty God for the grace and for giving the necessary wisdom and
intelligence, as well as the health which greatly helped in the accomplishment of this project.
- The Researchers
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
Dedication
This piece of work is truly dedicated to the following for their most valuable assistance in
the improvement of this project.
To our friends.
Above all, to our Almighty God who gave us strength for us to finish work, Despite of
the hardships and challenges of time.
-The Researchers
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
ABSTRACT
The system development process was used as the system development model.
Interview, library research and the inter research were used in the data gathering
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
1. INTRODUCTION
1.1 Project Context
The barangay is the most basic government unit in the Philippines. As a basic
political unit, is the primary planning and implementing unit of the government policies,
plants, programs, projects and activities in the community. It also serves as the forum for
an expression, crystallization and consideration of the views of the people and the
amicable settlement of disputes among its residents.
The Barangay San Esteban of Alcala, Cagayan is aware that computer is an
essential element to be more competitive nowadays. They do believe that
computerization will hasten the processing capabilities, gives correct and accurate
information and reports in quick manner.
However, the barangay profiling system is still done manually. They could not
comply with the latest trend in verifying, searching and checking each document
efficiently.
Barangay San Esteban, Alcala, Cagayan has more than 2,700 residents found in
the calendar year 2017-2018. Because of this number of population they have, their
barangay officials were encountering different problems when it comes in finding and
storing the records of their residents. The records of the residents in their barangay are
not also properly secured. The residents are also suffering because of this problem; the
files of information that they need to get in their barangay hall was getting delayed. And
best solution of this is to build and install a computerized barangay profiling system.
Computerized Barangay Profiling System is a software that allows the barangay
officials to clean with resident’s data on the computer; the names and information about
the residents that are needed in their barangay. This will help the barangay as well as the
workers and the residents of the said barangay. The system will be the census like system
of the barangay for all of the constituents and new people to live in the barangay. And
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
this will be effective in maintaining, securing, searching and storing of records of all the
residents which will benefits the workers for having an easy time on accessing files and
records they need.
This research was conducted to create and design a computerized barangay
profiling system. Specially the system does the following; minimize the time consumed
in updating the records, difficulty in rewriting their records, to have an electronic device
to be used instead of filing in cabinets to keep the forms and records, to prevent lost of
files, and inefficient in it. And to have an updated database of the barangay data and
upgrade its internal operation system for an effective delivery of basic services.
1.2 Purpose and Description
The researchers seek to solve and improve the existing manual records of the barangay
and missing records.
The system has its bar graph which contains the statistics of the residents and
automatically update every time you change the records.
1.3 Objectives
it can help them to do their work more efficiently and lessen their time to
spent on doing the manual report system which assures the safety of their
files/records of the barangay
It gives specific and complete records.
1. To avoid time and effort consuming, resulting into a number of work accomplish.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
2. To have an easy and faster preparation of the residents profile without going to
traditional way of searching an residents information.
This profiling system of the said barangay will make permanent, accurate and
systematic in gathering information. Effective in maintaining, securing, searching and
storing of records of all the residents.
Computerized Barangay Profiling System is a proposed system for barangay San Esteban
that will help the officials to handle records of the residents in an orderly way. Thus, the
study will benefit the following:
Residents of the Barangay- knowledge of studying will assure them that their records are
kept well and organized.
Researchers-result of the study will develop their skills in developing a system and
programming in particular.
Future Researchers- result of the study will give them an idea how to create such a system.
These terminologies were gathered by the researcher for better and understanding about
the study.
Computer. Machine capable of the following the instruction to alter data, programmable
electronic device that can perform calculations and processing information.
Computer System. To equip the user from electronic computer facilitate or automated
procedures it is an easy to produce printed output or data.
Input. Refers to information that given to a computer that acts on information to a computer.
Output. Refers to the information to the convention for transmitting data between a computer
and its peripherals.
Password. A secret combination of characters, a user must type into the computer in order to
start a program or open a file.
Profiling. It is a set of techniques or estimating the amount of time spent in various portions of
your program.
Program. An algorithm that can computer can both follow directly and follow the translated
version.
Records. It is a collection of related fields with information that usually pertains to only one
subject.
User. The person who uses a computer for word processing, communication and other
application.
User Friendly. A program easy to use even though an individual is not knowledgeable about the
system.
Visual Basic Net. Scripting language or programming language this is used to design the system.
This chapter presents related literature and studies that serves as the basis in completion
of the study.
Intano (1999) Cantilan, Surigao del Sur is needed an information of barangay residents
and as a result she recommended that a school-based information system be established in one of
the colleges’ library near the area. As several researchers studied the Library Information
Science literature, they found that there were identified uses for information needs. Close to the
research in the Barangay setting.
information used in one or ore business process. It, means that information technology has a
business significant only when it is used as a part of an information system that supporting some
part of a business process. “Competing through information technology” it means that
“competing through business process that make especially effective use of information system
that involved in information technology”.
Peterson and Alexander (2001:15) pointed out that results from needs assessments “can
offer useful information for a wide range of reorganizational considerations, including
organizational placement of programs with an agency and service delivery approaches”. Though
this demonstrates a broad application and diversity of use for community information needs
assessment data, community information profile assessments have particularly important
implications in community service delivery. This is also useful in “ provide useful information
on information use patterns as well as the overall importance of information problems and above
all the potential to complement efforts of government and international organizations “(World
Bank,2008). Reviews the changes taking place in the library and information profession globally,
as a result of the social and political changes taking place, considers the degree to which the
profession is considering its role as an agent of positive change. It is further argued that the
provision of information in this context should be aimed at communities with the central idea
that the public library and potential venues could provide community information which is
relevant and supportive of the what is needed in a community information which is relevant and
supportive of the what is needed in a community information service.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
Pade-Khene et.al (2010:272) explained that “information needs can be elicited from
what is said; and from there, it should be possible to understand the kind of information that
would want to share”. The information needs can be further categorized and analyzed to provides
a general macro-level view, supplemented with macro—level analysis during the planning stage
to facilitate the understanding of how information program and centers may be used to support
the local needs.
Pade-Khene et.al (2010). Moreover, Pade, Mallinson and Sewry (2006) elucidated that
as the community interacts with the technology, a local demand driven needs analysis should be
carried out to pinpoint emerging information needs in the community, so as to promote the
sustainability of the programs in the long term Buchanan and Gibb (2007) identifying
information needs is “central to the effective organizational management of information”.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
Murder et.al (2008) suggested that rich insights can be gained for understanding a
community through eliciting what they value and challenges in the community that they are more
familiar with, rather that focusing on the potential of innovation and technology.
A Practical Guide to Needs Assesment, by Kavita Gupta and Heekap Lee (2007) initially
discussed historic foundation data gathering methods, for need assessment approaches and a
toolkit that could be use by the reader in the assessment. The four needs assessment approaches
denote that there are different types of needs that lead to the different results. Identifying the
objective of the needs assessments is critical and Gupta has outlined the factors that should be
presented to distinguish what assessment the reader should use. She further explains that the
strategic assessment focuses in business strategy and performance evaluation. Competency base
assessments are needed to find what leads to excelling performers. The job and task analysis
identifiers what essential tasks are needed to create a training plan. Lastly, training needs
assessments are done to gaps in current training.
3. TECHNICAL BACKGROUND
Overview of the current technologies (hardware/software/network) used in the current
system
Discussions on the current trends and technologies to be used in developing and
implementing the proposed system
o Hardware
Personal Computer/Laptop
Printer
o Software
Vb.net
Access
Photoshop
o Peopleware
Administrator – Owner of the organization.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
4. METHODOLOGY
o The system should be able to add, edit, delete, and print records records.
o The system should be able to have a single admin and multiple user.
o The system should be able to search and viewed the records that needed.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
Flowchart
The user should create an account before Logging-in the system to make a records.
When they successfully log-in to the system, they can viewed the records they want
according to the main form which consist of Set-up, transaction, reports ad about the
system. They can also add, edit, delete and print records/list. When the user log-out
the system will go back to the log-in form.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
The resident comes to provides all necessary information of him/her, upon the providing
system and further produces the output or the feedback of the resident and finally produce
a report.
The resident provide information; those information will deliver to the sub process.
Once the resident give his her information it will go in the verify resident information
process. When there’s a new resident, it is required to provide his/her detail information.
That information will go to the verification process and will proceed to the next step which is
the process of register information resident and will immediately store the details of the new
resident in the list of residents. From there, it will generate the report. In establishing a
business in the barangay, the owner needs to provide his/her information; that information
will go to the verification process and check the owner in the list of residents. After that the
business will be registered. When the business registered it will issue the business permit to
Functions (Provide the requirements of each function. What each module or function
must do? Enumerate all functions and describe each.)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
Add – The admin can add a record of the residents to the user interface.
Edit – The admin can edit the names, age and other information etc.. of the residents
of the barangay.
Archive – The admin can delete and restored the records of the residents of the
barangay.
Search – The admin can search the different information of the barangay.
Print – The admin can print records of the barangay.
Projects ID Integer 1
Zone String Zone 1
Project Type String Road
Funded By String Vinarao, Juneyco A.
Name of Donor String Vinarao Juneyco A.
Budget Integer 1,000,000
Date Started Date/Time 10/10/2019
Date Finish Date/Time 10/10/2020
Status String Proposal
Migrated ID Integer 1
Person Full Name String Vinarao, Juneyco A.
Zone String Zone 1
Sex String Male
Date of Birth Date/Time 10/23/1998
Age Integer 20
Civil Status String Single
Date Migrated Date/Time 10/17/2018
Archive ID Integer 1
Projects Zone String Zone 1
Project Type String Road
Funded By String Vinarao, Juneyco A.
Name of Donor String Vinarao Juneyco A.
Budget Integer 1,000,000
Date Started Date/Time 10/10/2019
Date Finish Date/Time 10/10/2020
Status String Finish
Barangay ID AutoNumbe 1
Clearance Full Name r Vinarao,Juneyco A.
Zone String Zone 6
Purpose String School Purpose
Date of Birth String 09/08/1998
Age Date/Time 20
Secretary Number Gaille Sandra R. Dakila
Captain String Hon. Lilibeth Asuncion
Year String 2018
Date Number 20
Day String Thursday
String
Business ID AutoNumbe 2
Permit Full Name r Vinarao, Juneyco A.
Name of Business String Sari-Sari Store
Issued Name String Vinarao, Juneyco A.
Issued Day String 08
Issued Month String June
Issued Year String 2018
Captain Name Number Hon. Lilibeth Asuncion
Short Text
Indigence ID AutoNumbe 3
Full Name r Vinarao, Juneyco A.
Day Issued String 13
Month String June
Year String 2019
Captain Name Number Hon. Lilibeth Asuncion
String
Explain how the information domain of your system is transformed into data
structures. Describe how the major data or system entities are stored, processed and
organized. List the database(s) or data storage items. For a small system, there is
normally only one database. It consists of all the tables.
Entity Relationship Diagram has two main Entities. Employee and DTR. The
Employee entity includes a more detailed set of attributes or fields such as Employee
Code, Last Name, First Name, Middle Name, Position, and Picture. The DTR entity
includes Employee Code, Am in, Am out, Pm in, Pm out, DTR Date, and Remarks.
The relationship is one to one because an instance of an employee timing in or out is
considered as one transaction. The cardinality for the relationship is both mandatory
because one transaction is a valid instance at the time an employee time in and out.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
The (sign up) allows the admin and other users to create their account for them viewed
the records. In creating an account, the admin and other users must fill out the needed
information such as fullname, username, password, confirm password, account type,
security question and answer.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
The (login page) shows a username and password windows that allows the admin
and user to open their records.
The (main form) consist of Set-up, transaction, Reports and About System.
Figure 5.1.4: Add form
The (Edit form) show the different information of a resident where you can change and
update if needed.
Figure 5.1.6: Archive Form
The (archive form) shows the deleted record. The deleted records will stored here
like the records of barangay officials, residents etc.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
The (activity log form) show the previous activities you did like: deleting records,
adding records.
5. RECOMMENDATIONS
1. Training maybe conducted to barangay captain, officials and the secretary of the
barangay for them to familiarize on how to use and manage the developed system.
2. The administrators should be knowledgeable in programming for managing and
maintaining the system.
3. For future researchers who will conduct similar study may expand the scope to
include the video map in locating a resident’s house and for information..
APPENDICES
A. Source Code
Function UnlockSystem()
Call frmlogin.CheckSystemLock()
Call Log()
MsgBox("System unlock successful!", MsgBoxStyle.Information,
"System Message")
txtUName.Clear()
txtPword.Clear()
Me.Close()
Else
MsgBox("Invalid Username/Password", MsgBoxStyle.Information,
"System Message")
End If
Else
MsgBox("Empty Username/Password field not allowed",
MsgBoxStyle.Information, "System Message")
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
End If
Return True
End Function
Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
sql = "insert into tblSystemLog values('" & txtUName.Text & "','" &
act & "','" & currDate & "','" & currTime & "')"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()
Return True
End Function
End Sub
lblPword.Visible = False
Else
lblPword.Visible = True
End If
End Sub
End Sub
Private Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
End Sub
Private Sub GroupBox2_Enter(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles GroupBox2.Enter
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Label1.Click
End Sub
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Label2.Click
End Sub
Private Sub CMSAdminUnlock_Opening(ByVal sender As System.Object, ByVal e
As System.ComponentModel.CancelEventArgs) Handles CMSAdminUnlock.Opening
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles GroupBox1.Enter
End Sub
End Class
for add an account on security
Imports System.Data.OleDb
End Sub
Function clear()
txtFName.Clear()
txtUName.Clear()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
txtPword.Clear()
txtPwordMatch.Clear()
cboAccType.Text = ""
cboSQ.Text = ""
txtSQA.Clear()
Return True
End Function
Function FillComboBox()
cboAccType.Items.Clear()
cboAccType.Items.Add("Administrator")
cboAccType.Items.Add("User")
cboSQ.Items.Clear()
cboSQ.Items.Add("What is your nickname?")
cboSQ.Items.Add("What is your favorite food?")
cboSQ.Items.Add("What is your favorite book?")
cboSQ.Items.Add("What is your favorite color?")
cboSQ.Items.Add("What is the name of your pet?")
Return True
End Function
Function save()
If Trim(txtResientID.Text) <> "" And Trim(txtFName.Text) <> "" And
Trim(txtUName.Text) <> "" And Trim(txtPword.Text) <> "" And
Trim(txtPwordMatch.Text) <> "" And Trim(cboAccType.Text) <> "" And
Trim(cboSQ.Text) <> "" And Trim(txtSQA.Text) <> "" Then
If Trim(txtUName.Text.Length) >= 8 Then
If Trim(txtPword.Text.Length) >= 8 Then
If Trim(txtSQA.Text.Length) >= 8 Then
If lblPwordMatch.Text = "Passwords matched" Then
If AEswitch = "a" Then
sql = "insert into tblSecurity values('" &
txtResientID.Text & "','" & txtFName.Text & "','" & txtUName.Text & "','" &
txtPword.Text & "','" & cboAccType.Text & "','" & cboSQ.Text & "','" &
txtSQA.Text & "')"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()
Call frmUserAccount.FillDataGrid()
MsgBox("Record successfully saved.",
MsgBoxStyle.Information, "System Message")
Call AddLog()
AEswitch = ""
Me.Close()
Else
sql = "update tblSecurity set ResidentID='" &
txtResientID.Text & "',FName='" & txtFName.Text & "',UName='" & txtUName.Text
& "',Pword='" & txtPword.Text & "',AccType='" & cboAccType.Text & "',SQ='" &
cboSQ.Text & "',SQA='" & txtSQA.Text & "' where UName='" &
frmUserAccount.txtSelectedCode.Text & "'"
cmd = New OleDbCommand(sql, kon)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
cmd.ExecuteNonQuery()
If frmMain.Label23.Text =
frmUserAccount.txtSelectedCode.Text Then
frmMain.Label23.Text = txtUName.Text
frmMain.lblaccess.Text = cboAccType.Text
End If
Call frmUserAccount.FillDataGrid()
frmMain.lblaccess.Text = cboAccType.Text
Function Pwordmatch()
If Trim(txtPword.Text) <> "" And Trim(txtPwordMatch.Text) <> "" Then
If Trim(txtPwordMatch.Text) = Trim(txtPword.Text) Then
lblPwordMatch.Text = "Passwords matched"
lblPwordMatch.ForeColor = Color.Green
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
Else
lblPwordMatch.Text = "Passwords do not match"
lblPwordMatch.ForeColor = Color.Red
End If
Else
lblPwordMatch.Text = ""
End If
Return True
End Function
Function PwordStrength()
If txtPword.Text.Length > 0 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
Dim numDigits As Integer = 0
Dim numAlpha As Integer = 0
Dim x As Integer
Dim s As String = Trim(txtPword.Text)
For x = 0 To s.Length - 1
If Char.IsNumber(s(x)) Then
numDigits = numDigits + 1
End If
If Char.IsLetter(s(x)) Then
numAlpha = numAlpha + 1
End If
Next
If numDigits > 4 And numAlpha > 4 Then
lblPwordStrength.Text = "Strong"
lblPwordStrength.ForeColor = Color.Green
ElseIf numDigits > 2 And numAlpha > 2 Then
lblPwordStrength.Text = "Moderate"
lblPwordStrength.ForeColor = Color.Orange
ElseIf numDigits > 2 And numAlpha = 0 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
ElseIf numDigits = 0 And numAlpha > 2 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
End If
Else
lblPwordStrength.Text = ""
End If
Return True
End Function
Function AddLog()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
act = "Added new system user account. Username: " & txtUName.Text
Function EditLog()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
save()
End If
End If
End Sub
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCancel.Click
AEswitch = ""
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
Me.Close()
End Sub
txtSQA.UseSystemPasswordChar = True
End If
End Sub
If Asc(e.KeyChar) = 13 Then
cboAccType.Focus()
End If
e.Handled = True
End If
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim frm As New frmseach23
frm.Text = "Select Person"
frmseach23.ShowDialog()
End Sub
End Class
Imports System.Data.OleDb
Public Class frmAEdeadnotes
Dim kom As New OleDbCommand
Dim da As New OleDbDataAdapter
Dim dset As New DataSet
Sub save()
If Trim(Me.Text) = "Add Dead Person" Then
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tbldeadnotes([FullName],
[BirthDate],[Age],[dateofDeath],[Zone]) values ('" & txtfullname.Text & "','"
& txtdateofbirth.Text & "'," & txtage.Text & ",'" & DateTimePicker1.Text &
"','" & txtzone.Text & "')"
kom.ExecuteNonQuery()
kom.CommandText = "Delete * from tblresidents where ResidentID=" &
txtid.Text
kom.ExecuteNonQuery()
Call frmRecord.pupulate()
MsgBox("Record Succesfully added!", MsgBoxStyle.Information +
MsgBoxStyle.OkOnly, "Add Record")
Log()
Me.Close()
Else
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "update [tbldeadnotes] set [FullName]='" &
txtfullname.Text & "', [BirthDate]='" & txtdateofbirth.Text & "', [Age]=" &
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
txtage.Text & ", [dateofDeath]='" & DateTimePicker1.Text & "', [Zone]='" &
txtzone.Text & "' Where [ID]=" & txtsel.Text
kom.ExecuteNonQuery()
MsgBox("Record Updated!", MsgBoxStyle.Information, "Saved")
Log1()
Me.Close()
End If
End Sub
Function Log1()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = "Updated Dead Person: " + txtfullname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = "Added Dead Person: " + txtfullname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Private Sub btnsave_Click(sender As Object, e As EventArgs) Handles
btnsave.Click
save()
End Sub
Imports System.Data.OleDb
Public Class frmAEofficials
Dim kom As New OleDbCommand
Dim da As New OleDbDataAdapter
Dim dset As New DataSet
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles
btnSave.Click
saveRecord()
End Sub
Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = " Added Officials: " + cmbPostion.Text + ": " + txtlname.Text +
" " + txtfname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Function Log1()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = "Updated Official: " + cmbPostion.Text + ": " + txtlname.Text +
" " + txtfname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Sub saveRecord()
'trapping
Dim a As String
a = "Active"
If txtresidentID.Text = "" Or cmbPostion.Text = "" Or cmbTerm.Text =
"" Or cmbDateStart.Text = "" Or cmdateEnd.Text = "" Then
MsgBox("Cannot save. Required field missing!",
MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Empty fields")
Exit Sub
End If
If Trim(Me.Text) = "Add Officials" Then
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
End If
End If
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblOfficials([ResidentID],
[Position],[Term],[DateStart],[DateEnd],[Status]) values (" &
txtresidentID.Text & ",'" & cmbPostion.Text & "','" & cmbTerm.Text & "','" &
cmbDateStart.Text & "','" & cmdateEnd.Text & "','" & a & "')"
kom.ExecuteNonQuery()
MsgBox("Record Succesfully added!", MsgBoxStyle.Information +
MsgBoxStyle.OkOnly, "Add Record")
Log()
clear()
Me.Close()
Else
txtresidentID.Text = ""
txtzone.Text = ""
End Sub
End Sub
End Sub
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub
End Sub
End Sub
End Class
“for add residents
Imports System.Data.OleDb
Public Class frmAEresidents
Dim kom As New OleDbCommand
Dim da As New OleDbDataAdapter
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
End Sub
Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = " Added Resident: " + txtLname.Text + ": " + txtFName.Text + " "
+ txtMname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Function Log1()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = "Updated Resident: " + txtLname.Text + ": " + txtFName.Text + "
" + txtMname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Sub clear()
txtage.Text = ""
txteduca.Text = ""
txtemplo.Text = ""
txtFName.Text = ""
txtID.Text = ""
txtLname.Text = ""
txtMname.Text = ""
txtnationality.Text = ""
txtoccu.Text = ""
cmbcivil.Text = ""
cmbdate.Text = ""
cmbsex.Text = ""
cmbzone.Text = ""
cmreligion.Text = ""
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
End Sub
Sub saveRecord()
If txtLname.Text = "" Or txtFName.Text = "" Or txtMname.Text = "" Or
cmbsex.Text = "" Or cmbcivil.Text = "" Or txtage.Text = "" Or cmbzone.Text =
"" Or cmbsex.Text = "" Or cmreligion.Text = "" Or txtoccu.Text = "" Or
txteduca.Text = "" Then
MsgBox("Cannot save. Required field missing!",
MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Empty fields")
Exit Sub
End If
End If
Else
txtage.Text = x
End If
End Sub
Private Sub frmAEresidents_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
FillComboBoxes("SELECT DISTINCT (rLN) from tblResidents", cmreligion,
"rLN")
'fillreligion()
fillcivilStatus()
fillzone()
fillgender()
educatt()
End Sub
Function fillreligion()
cmreligion.Items.Clear()
cmreligion.Items.Add("Catholic")
cmreligion.Items.Add("Jehova Witnesses")
cmreligion.Items.Add("Dating Daan")
cmreligion.Items.Add("Born Again")
cmreligion.Items.Add("Dating Daan")
cmreligion.Items.Add("Penticost")
cmreligion.Items.Add("Methodist")
cmreligion.Items.Add("Islam")
Return True
End Function
Function fillgender()
cmbsex.Items.Clear()
cmbsex.Items.Add("Male")
cmbsex.Items.Add("Female")
Return True
End Function
Function fillzone()
cmbzone.Items.Clear()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
cmbzone.Items.Add("Zone 1")
cmbzone.Items.Add("Zone 2")
cmbzone.Items.Add("Zone 3")
cmbzone.Items.Add("Zone 4")
cmbzone.Items.Add("Zone 5")
cmbzone.Items.Add("Zone 6")
cmbzone.Items.Add("Zone 7")
Return True
End Function
Function fillcivilStatus()
cmbcivil.Items.Clear()
cmbcivil.Items.Add("SINGLE")
cmbcivil.Items.Add("MARRIED")
cmbcivil.Items.Add("SEPERATED")
cmbcivil.Items.Add("WIDOWED")
Return True
End Function
Function educatt()
txteduca.Items.Clear()
txteduca.Items.Add("NONE")
txteduca.Items.Add("PRE-SCHOOL")
txteduca.Items.Add("ELEMENTARY LEVEL")
txteduca.Items.Add("HIGH SCHOOL LEVEL")
txteduca.Items.Add("VOCATIONAL")
txteduca.Items.Add("COLLEGE LEVEL")
txteduca.Items.Add("COLLEGE GRADUATE")
txteduca.Items.Add("POST BACCALAUREATE")
Return True
End Function
Private Sub txtLname_KeyPress(sender As Object, e As KeyPressEventArgs)
Handles txtLname.KeyPress
If Asc(e.KeyChar) = 13 Then
txtLname.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub
Private Sub txtFName_KeyPress(sender As Object, e As KeyPressEventArgs)
Handles txtFName.KeyPress
If Asc(e.KeyChar) = 13 Then
txtFName.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
If allowchar.IndexOf(e.KeyChar) = -1 Then
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
e.Handled = True
End If
End If
End Sub
End Sub
End Sub
End Sub
End Sub
End Class
End Sub
Private Sub frmArchives_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
Call konneksyon()
Call pupulate()
End Sub
Sub formatdgv()
With DataGridView1
.Font = dgFont
.Columns(0).HeaderText = "House No"
.Columns(0).Width = 120
.Columns(1).HeaderText = "Zone"
.Columns(1).Width = 120
.Columns(2).HeaderText = "T-House"
.Columns(2).Width = 120
.Columns(3).HeaderText = "T-Lot"
.Columns(3).Width = 120
.Columns(4).HeaderText = "Water Resources"
.Columns(4).Width = 200
.Columns(5).HeaderText = "Number of Family"
.Columns(5).Width = 250
.Columns(6).HeaderText = "Electric"
.Columns(6).Width = 120
.Columns(7).HeaderText = "Water Sealed"
.Columns(7).Width = 250
.Columns(8).HeaderText = "House Made-Up"
.Columns(8).Width = 230
.Columns(9).HeaderText = "Auto Vehicle"
.Columns(9).Width = 120
.Columns(10).HeaderText = "Business"
.Columns(10).Width = 120
.Columns(11).HeaderText = "Pets"
.Columns(11).Width = 220
.Columns(12).HeaderText = "Family OFW"
.Columns(12).Width = 220
.Columns(13).HeaderText = "Farms"
.Columns(13).Width = 120
.Columns(14).HeaderText = "Family OFW"
.Columns(14).Width = 220
.Columns(15).Visible = False
.Columns(16).HeaderText = "Head Name"
.Columns(16).Width = 220
.Columns(17).HeaderText = "Sex"
.Columns(17).Width = 120
.Columns(18).HeaderText = "Date of Birth"
.Columns(18).Width = 200
.Columns(19).HeaderText = "Age"
.Columns(19).Width = 120
.Columns(20).HeaderText = "Civil Status"
.Columns(20).Width = 120
.Columns(21).HeaderText = "Religion"
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
.Columns(21).Width = 120
.Columns(22).HeaderText = "Nationality"
.Columns(22).Width = 120
.Columns(23).HeaderText = "Occupation"
.Columns(23).Width = 120
.Columns(24).HeaderText = "Employement"
.Columns(24).Width = 120
End With
End Sub
Sub formatgrid()
Select Case Trim(Me.Text)
Case "Residents"
DataGridView1.ForeColor = Color.Green
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).HeaderText = "Last Name"
DataGridView1.Columns(1).Width = 120
DataGridView1.Columns(2).HeaderText = "First Name"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "Last Name"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Zone"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Sex"
DataGridView1.Columns(5).Width = 120
DataGridView1.Columns(6).HeaderText = "Date of Birth"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Age"
DataGridView1.Columns(7).Width = 120
DataGridView1.Columns(8).HeaderText = "Status"
DataGridView1.Columns(8).Width = 120
DataGridView1.Columns(9).HeaderText = "Religion"
DataGridView1.Columns(9).Width = 100
DataGridView1.Columns(10).HeaderText = "Nationality"
DataGridView1.Columns(10).Width = 120
DataGridView1.Columns(11).HeaderText = "Educational
Attaintment"
DataGridView1.Columns(11).Width = 200
DataGridView1.Columns(12).HeaderText = "Occupation"
DataGridView1.Columns(12).Width = 120
DataGridView1.Columns(13).HeaderText = "Employement"
DataGridView1.Columns(13).Width = 120
Case "Officials"
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).Visible = False
DataGridView1.Columns(2).HeaderText = "Last Name"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "First Name"
DataGridView1.Columns(3).Width = 120
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
txtsearch.Text & "%'or rZone Like '%" & txtsearch.Text & "%'or rSex Like '%" &
txtsearch.Text & "%'", DataGridView1)
Case "HouseHold"
Call LoadRecord(dt, dtset, "qryHouseHold", "Select * from
qryHouseHolds1 Where HouseNo like '%" & txtsearch.Text & "%'", DataGridView1)
End Select
End Sub
Private Sub GroupBox5_Enter(sender As Object, e As EventArgs) Handles
GroupBox5.Enter
End Sub
End Sub
End Class
“for issuances/certificates
Imports System.Data.OleDb
Public Class frmCer
Dim dt As New OleDbDataAdapter
Dim da As New DataSet
Private Sub frmCer_Activated(sender As Object, e As EventArgs) Handles
MyBase.Activated
Call LoadRecord(dt, da, "tblResidents", "Select * from tblResidents",
dgvresident)
End Sub
End Sub
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
End Class
“under seucirty
Public Class frmChangePassword
End Sub
Function clear()
txtFName.Clear()
txtUName.Clear()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
txtPword.Clear()
txtPwordMatch.Clear()
cboAccType.Text = ""
cboSQ.Text = ""
txtSQA.Clear()
Return True
End Function
Function FillComboBox()
cboAccType.Items.Clear()
cboAccType.Items.Add("Administrator")
cboAccType.Items.Add("User")
cboSQ.Items.Clear()
cboSQ.Items.Add("What is your nickname?")
cboSQ.Items.Add("What is your favorite food?")
cboSQ.Items.Add("What is your favorite book?")
cboSQ.Items.Add("What is your favorite color?")
cboSQ.Items.Add("What is the name of your pet?")
Return True
End Function
Function save()
If Trim(txtResientID.Text) <> "" And Trim(txtFName.Text) <> "" And
Trim(txtUName.Text) <> "" And Trim(txtPword.Text) <> "" And
Trim(txtPwordMatch.Text) <> "" And Trim(cboAccType.Text) <> "" And
Trim(cboSQ.Text) <> "" And Trim(txtSQA.Text) <> "" Then
If Trim(txtUName.Text.Length) >= 8 Then
If Trim(txtPword.Text.Length) >= 8 Then
If Trim(txtSQA.Text.Length) >= 8 Then
If lblPwordMatch.Text = "Passwords matched" Then
If AEswitch = "a" Then
sql = "insert into tblSecurity values('" &
txtResientID.Text & "','" & txtFName.Text & "','" & txtUName.Text & "','" &
txtPword.Text & "','" & cboAccType.Text & "','" & cboSQ.Text & "','" &
txtSQA.Text & "')"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()
Call frmUserAccount.FillDataGrid()
MsgBox("Record successfully saved.",
MsgBoxStyle.Information, "System Message")
Call AddLog()
AEswitch = ""
Me.Close()
Else
sql = "update tblSecurity set ResidentID='" &
txtResientID.Text & "',FName='" & txtFName.Text & "',UName='" & txtUName.Text
& "',Pword='" & txtPword.Text & "',AccType='" & cboAccType.Text & "',SQ='" &
cboSQ.Text & "',SQA='" & txtSQA.Text & "' where UName='" &
frmUserAccount.txtSelectedCode.Text & "'"
cmd = New OleDbCommand(sql, kon)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
cmd.ExecuteNonQuery()
If frmMain.Label23.Text =
frmUserAccount.txtSelectedCode.Text Then
frmMain.Label23.Text = txtUName.Text
frmMain.lblaccess.Text = cboAccType.Text
End If
Call frmUserAccount.FillDataGrid()
frmMain.lblaccess.Text = cboAccType.Text
Function Pwordmatch()
If Trim(txtPword.Text) <> "" And Trim(txtPwordMatch.Text) <> "" Then
If Trim(txtPwordMatch.Text) = Trim(txtPword.Text) Then
lblPwordMatch.Text = "Passwords matched"
lblPwordMatch.ForeColor = Color.Green
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
Else
lblPwordMatch.Text = "Passwords do not match"
lblPwordMatch.ForeColor = Color.Red
End If
Else
lblPwordMatch.Text = ""
End If
Return True
End Function
Function PwordStrength()
If txtPword.Text.Length > 0 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
Dim numDigits As Integer = 0
Dim numAlpha As Integer = 0
Dim x As Integer
Dim s As String = Trim(txtPword.Text)
For x = 0 To s.Length - 1
If Char.IsNumber(s(x)) Then
numDigits = numDigits + 1
End If
If Char.IsLetter(s(x)) Then
numAlpha = numAlpha + 1
End If
Next
If numDigits > 4 And numAlpha > 4 Then
lblPwordStrength.Text = "Strong"
lblPwordStrength.ForeColor = Color.Green
ElseIf numDigits > 2 And numAlpha > 2 Then
lblPwordStrength.Text = "Moderate"
lblPwordStrength.ForeColor = Color.Orange
ElseIf numDigits > 2 And numAlpha = 0 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
ElseIf numDigits = 0 And numAlpha > 2 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
End If
Else
lblPwordStrength.Text = ""
End If
Return True
End Function
Function AddLog()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
act = "Added new system user account. Username: " & txtUName.Text
Function EditLog()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
save()
End If
End If
End Sub
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCancel.Click
AEswitch = ""
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
Me.Close()
End Sub
txtSQA.UseSystemPasswordChar = True
End If
End Sub
If Asc(e.KeyChar) = 13 Then
cboAccType.Focus()
End If
e.Handled = True
End If
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim frm As New frmseach23
frm.Text = "Select Person"
frmseach23.ShowDialog()
End Sub
End Class
Imports System.Data.OleDb
Public Class frmAEdeadnotes
Dim kom As New OleDbCommand
Dim da As New OleDbDataAdapter
Dim dset As New DataSet
Sub save()
If Trim(Me.Text) = "Add Dead Person" Then
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tbldeadnotes([FullName],
[BirthDate],[Age],[dateofDeath],[Zone]) values ('" & txtfullname.Text & "','"
& txtdateofbirth.Text & "'," & txtage.Text & ",'" & DateTimePicker1.Text &
"','" & txtzone.Text & "')"
kom.ExecuteNonQuery()
kom.CommandText = "Delete * from tblresidents where ResidentID=" &
txtid.Text
kom.ExecuteNonQuery()
Call frmRecord.pupulate()
MsgBox("Record Succesfully added!", MsgBoxStyle.Information +
MsgBoxStyle.OkOnly, "Add Record")
Log()
Me.Close()
Else
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "update [tbldeadnotes] set [FullName]='" &
txtfullname.Text & "', [BirthDate]='" & txtdateofbirth.Text & "', [Age]=" &
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
txtage.Text & ", [dateofDeath]='" & DateTimePicker1.Text & "', [Zone]='" &
txtzone.Text & "' Where [ID]=" & txtsel.Text
kom.ExecuteNonQuery()
MsgBox("Record Updated!", MsgBoxStyle.Information, "Saved")
Log1()
Me.Close()
End If
End Sub
Function Log1()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = "Updated Dead Person: " + txtfullname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = "Added Dead Person: " + txtfullname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Private Sub btnsave_Click(sender As Object, e As EventArgs) Handles
btnsave.Click
save()
End Sub
Imports System.Data.OleDb
Public Class frmAEofficials
Dim kom As New OleDbCommand
Dim da As New OleDbDataAdapter
Dim dset As New DataSet
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles
btnSave.Click
saveRecord()
End Sub
Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = " Added Officials: " + cmbPostion.Text + ": " + txtlname.Text +
" " + txtfname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Function Log1()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = "Updated Official: " + cmbPostion.Text + ": " + txtlname.Text +
" " + txtfname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Sub saveRecord()
'trapping
Dim a As String
a = "Active"
If txtresidentID.Text = "" Or cmbPostion.Text = "" Or cmbTerm.Text =
"" Or cmbDateStart.Text = "" Or cmdateEnd.Text = "" Then
MsgBox("Cannot save. Required field missing!",
MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Empty fields")
Exit Sub
End If
If Trim(Me.Text) = "Add Officials" Then
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
End If
End If
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblOfficials([ResidentID],
[Position],[Term],[DateStart],[DateEnd],[Status]) values (" &
txtresidentID.Text & ",'" & cmbPostion.Text & "','" & cmbTerm.Text & "','" &
cmbDateStart.Text & "','" & cmdateEnd.Text & "','" & a & "')"
kom.ExecuteNonQuery()
MsgBox("Record Succesfully added!", MsgBoxStyle.Information +
MsgBoxStyle.OkOnly, "Add Record")
Log()
clear()
Me.Close()
Else
txtresidentID.Text = ""
txtzone.Text = ""
End Sub
End Sub
End Sub
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub
End Sub
End Sub
End Sub
Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = " Added Resident: " + txtLname.Text + ": " + txtFName.Text + " "
+ txtMname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Function Log1()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = "Updated Resident: " + txtLname.Text + ": " + txtFName.Text + "
" + txtMname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Sub clear()
txtage.Text = ""
txteduca.Text = ""
txtemplo.Text = ""
txtFName.Text = ""
txtID.Text = ""
txtLname.Text = ""
txtMname.Text = ""
txtnationality.Text = ""
txtoccu.Text = ""
cmbcivil.Text = ""
cmbdate.Text = ""
cmbsex.Text = ""
cmbzone.Text = ""
cmreligion.Text = ""
End Sub
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
Sub saveRecord()
If txtLname.Text = "" Or txtFName.Text = "" Or txtMname.Text = "" Or
cmbsex.Text = "" Or cmbcivil.Text = "" Or txtage.Text = "" Or cmbzone.Text =
"" Or cmbsex.Text = "" Or cmreligion.Text = "" Or txtoccu.Text = "" Or
txteduca.Text = "" Then
MsgBox("Cannot save. Required field missing!",
MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Empty fields")
Exit Sub
End If
End If
Else
txtage.Text = x
End If
End Sub
Private Sub frmAEresidents_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
FillComboBoxes("SELECT DISTINCT (rLN) from tblResidents", cmreligion,
"rLN")
'fillreligion()
fillcivilStatus()
fillzone()
fillgender()
educatt()
End Sub
Function fillreligion()
cmreligion.Items.Clear()
cmreligion.Items.Add("Catholic")
cmreligion.Items.Add("Jehova Witnesses")
cmreligion.Items.Add("Dating Daan")
cmreligion.Items.Add("Born Again")
cmreligion.Items.Add("Dating Daan")
cmreligion.Items.Add("Penticost")
cmreligion.Items.Add("Methodist")
cmreligion.Items.Add("Islam")
Return True
End Function
Function fillgender()
cmbsex.Items.Clear()
cmbsex.Items.Add("Male")
cmbsex.Items.Add("Female")
Return True
End Function
Function fillzone()
cmbzone.Items.Clear()
cmbzone.Items.Add("Zone 1")
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
cmbzone.Items.Add("Zone 2")
cmbzone.Items.Add("Zone 3")
cmbzone.Items.Add("Zone 4")
cmbzone.Items.Add("Zone 5")
cmbzone.Items.Add("Zone 6")
cmbzone.Items.Add("Zone 7")
Return True
End Function
Function fillcivilStatus()
cmbcivil.Items.Clear()
cmbcivil.Items.Add("SINGLE")
cmbcivil.Items.Add("MARRIED")
cmbcivil.Items.Add("SEPERATED")
cmbcivil.Items.Add("WIDOWED")
Return True
End Function
Function educatt()
txteduca.Items.Clear()
txteduca.Items.Add("NONE")
txteduca.Items.Add("PRE-SCHOOL")
txteduca.Items.Add("ELEMENTARY LEVEL")
txteduca.Items.Add("HIGH SCHOOL LEVEL")
txteduca.Items.Add("VOCATIONAL")
txteduca.Items.Add("COLLEGE LEVEL")
txteduca.Items.Add("COLLEGE GRADUATE")
txteduca.Items.Add("POST BACCALAUREATE")
Return True
End Function
Private Sub txtLname_KeyPress(sender As Object, e As KeyPressEventArgs)
Handles txtLname.KeyPress
If Asc(e.KeyChar) = 13 Then
txtLname.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub
Private Sub txtFName_KeyPress(sender As Object, e As KeyPressEventArgs)
Handles txtFName.KeyPress
If Asc(e.KeyChar) = 13 Then
txtFName.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
End If
End If
End Sub
End Sub
End Sub
End Sub
End Class
.Columns(22).HeaderText = "Nationality"
.Columns(22).Width = 120
.Columns(23).HeaderText = "Occupation"
.Columns(23).Width = 120
.Columns(24).HeaderText = "Employement"
.Columns(24).Width = 120
End With
End Sub
'Case "SeniorCitizen"
' DataGridView1.Font = dgFont
' DataGridView1.Columns(0).HeaderText = "Resident ID"
' DataGridView1.Columns(0).Width = 120
' DataGridView1.Columns(1).HeaderText = "Last Name"
' DataGridView1.Columns(1).Width = 120
' DataGridView1.Columns(2).HeaderText = "First Name"
' DataGridView1.Columns(2).Width = 120
' DataGridView1.Columns(3).HeaderText = "Last Name"
' DataGridView1.Columns(3).Width = 120
' DataGridView1.Columns(4).HeaderText = "Zone"
' DataGridView1.Columns(4).Width = 70
' DataGridView1.Columns(5).HeaderText = "Sex"
' DataGridView1.Columns(5).Width = 70
' DataGridView1.Columns(6).HeaderText = "Date of Birth"
' DataGridView1.Columns(6).Width = 120
' DataGridView1.Columns(7).HeaderText = "Age"
' DataGridView1.Columns(7).Width = 50
' DataGridView1.Columns(8).Visible = False
' DataGridView1.Columns(9).Visible = False
' DataGridView1.Columns(10).Visible = False
' DataGridView1.Columns(11).Visible = False
' DataGridView1.Columns(12).Visible = False
' DataGridView1.Columns(13).Visible = False
Sub formatgrid()
Select Case Trim(Me.Text)
Case "Residents"
DataGridView1.ForeColor = Color.Green
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).HeaderText = "Last Name"
DataGridView1.Columns(1).Width = 120
DataGridView1.Columns(2).HeaderText = "First Name"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "Last Name"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Zone"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Sex"
DataGridView1.Columns(5).Width = 120
DataGridView1.Columns(6).HeaderText = "Date of Birth"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Age"
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
DataGridView1.Columns(7).Width = 120
DataGridView1.Columns(8).HeaderText = "Status"
DataGridView1.Columns(8).Width = 120
DataGridView1.Columns(9).HeaderText = "Religion"
DataGridView1.Columns(9).Width = 100
DataGridView1.Columns(10).HeaderText = "Nationality"
DataGridView1.Columns(10).Width = 120
DataGridView1.Columns(11).HeaderText = "Educational
Attaintment"
DataGridView1.Columns(11).Width = 200
DataGridView1.Columns(12).HeaderText = "Occupation"
DataGridView1.Columns(12).Width = 120
DataGridView1.Columns(13).HeaderText = "Employement"
DataGridView1.Columns(13).Width = 120
Case "Officials"
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).Visible = False
DataGridView1.Columns(2).HeaderText = "Last Name"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "First Name"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Middle Name"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Position"
DataGridView1.Columns(5).Width = 120
DataGridView1.Columns(6).HeaderText = "Term"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Date Start"
DataGridView1.Columns(7).Width = 120
DataGridView1.Columns(8).HeaderText = "Date End"
DataGridView1.Columns(8).Width = 120
DataGridView1.Columns(9).HeaderText = "Status"
DataGridView1.Columns(9).Width = 120
Case "Projects"
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).HeaderText = "Zone"
DataGridView1.Columns(1).Width = 120
DataGridView1.Columns(2).HeaderText = "Project type"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "Funded By"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Name of Donor"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Budget"
DataGridView1.Columns(5).Width = 120
DataGridView1.Columns(6).HeaderText = "Date Started"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Date Finish"
DataGridView1.Columns(7).Width = 120
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
DataGridView1.Columns(8).HeaderText = "Status"
Case "Household"
Call frmHouseholds.formatdgv()
End Select
End Sub
End Sub
End Sub
End Class
“for issuances/certificates
Imports System.Data.OleDb
Public Class frmCer
Dim dt As New OleDbDataAdapter
Dim da As New DataSet
Private Sub frmCer_Activated(sender As Object, e As EventArgs) Handles
MyBase.Activated
Call LoadRecord(dt, da, "tblResidents", "Select * from tblResidents",
dgvresident)
'Call LoadRecord(dt, da, "tblBusPer", "Select * from tblBusPer", dgvp)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
End Sub
End Class
“under seucirty
Public Class frmChangePassword
numDigits = numDigits + 1
End If
If Char.IsLetter(s(x)) Then
numAlpha = numAlpha + 1
End If
Next
If numDigits > 4 And numAlpha > 4 Then
lblPwordStrength.Text = "Strong"
lblPwordStrength.ForeColor = Color.Green
ElseIf numDigits > 2 And numAlpha > 2 Then
lblPwordStrength.Text = "Moderate"
lblPwordStrength.ForeColor = Color.Orange
ElseIf numDigits > 2 And numAlpha = 0 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
ElseIf numDigits = 0 And numAlpha > 2 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
End If
Else
lblPwordStrength.Text = ""
End If
End Sub
cmbpet.Items.Add("Yes")
cmbpet.Items.Add("No")
End Sub
Sub housemade()
cmbhmadeup.Items.Clear()
cmbhmadeup.Items.Add("Concrete")
cmbhmadeup.Items.Add("Semi Concrete")
cmbhmadeup.Items.Add("Bamboo Wood")
End Sub
Sub waterseal()
cmbwaterseal.Items.Clear()
cmbwaterseal.Items.Add("W/ Water Seal")
cmbwaterseal.Items.Add("W/out Water Seal")
End Sub
Sub electric()
cmbElectric.Items.Clear()
cmbElectric.Items.Add("W/ Electric")
cmbElectric.Items.Add("W/out Electric")
End Sub
Sub ofw()
cmbOFW.Items.Clear()
cmbOFW.Items.Add("Yes")
cmbOFW.Items.Add("No")
End Sub
Sub farm()
cmbFarm.Items.Clear()
cmbFarm.Items.Add("Yes")
cmbFarm.Items.Add("No")
End Sub
Sub ReloadRecords()
executeSQLStatement("select * from qryHouseHolds1 order by HouseNo")
dgv.DataSource = MyDataSet.Tables(0)
lblRecFound.Text = "Record(s) found: " &
MyDataSet.Tables(0).Rows.Count
formatdgv()
End Sub
Sub formatdgv()
dgv.Font = dgFont
dgv.Columns(0).HeaderText = "House No"
dgv.Columns(0).Width = 120
dgv.Columns(1).HeaderText = "Zone"
dgv.Columns(1).Width = 120
dgv.Columns(2).HeaderText = "T-House"
dgv.Columns(2).Width = 120
dgv.Columns(3).HeaderText = "T-Lot"
dgv.Columns(3).Width = 120
dgv.Columns(4).HeaderText = "Water Resources"
dgv.Columns(4).Width = 200
dgv.Columns(5).HeaderText = "Number of Family"
dgv.Columns(5).Width = 250
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
dgv.Columns(6).HeaderText = "Electric"
dgv.Columns(6).Width = 120
dgv.Columns(7).HeaderText = "Water Sealed"
dgv.Columns(7).Width = 250
dgv.Columns(8).HeaderText = "House Made-Up"
dgv.Columns(8).Width = 230
dgv.Columns(9).HeaderText = "Auto Vehicle"
dgv.Columns(9).Width = 120
dgv.Columns(10).HeaderText = "Business"
dgv.Columns(10).Width = 120
dgv.Columns(11).HeaderText = "Pets"
dgv.Columns(11).Width = 220
dgv.Columns(12).HeaderText = "Family OFW"
dgv.Columns(12).Width = 220
dgv.Columns(13).HeaderText = "Farms"
dgv.Columns(13).Width = 120
dgv.Columns(14).HeaderText = "Family OFW"
dgv.Columns(14).Width = 220
dgv.Columns(15).Visible = False
dgv.Columns(16).HeaderText = "Head Name"
dgv.Columns(16).Width = 220
dgv.Columns(17).HeaderText = "Sex"
dgv.Columns(17).Width = 120
dgv.Columns(18).HeaderText = "Date of Birth"
dgv.Columns(18).Width = 200
dgv.Columns(19).HeaderText = "Age"
dgv.Columns(19).Width = 120
dgv.Columns(20).HeaderText = "Civil Status"
dgv.Columns(20).Width = 120
dgv.Columns(21).HeaderText = "Religion"
dgv.Columns(21).Width = 120
dgv.Columns(22).HeaderText = "Nationality"
dgv.Columns(22).Width = 120
dgv.Columns(23).HeaderText = "Occupation"
dgv.Columns(23).Width = 120
dgv.Columns(24).HeaderText = "Employement"
dgv.Columns(24).Width = 120
End Sub
Sub Formatdgv2()
dgv2.Font = dgFont
dgv2.Columns(0).HeaderText = "Member Type" : dgv2.Columns(0).Width =
130
dgv2.Columns(1).HeaderText = "Member Family" : dgv2.Columns(1).Width =
140
dgv2.Columns(2).HeaderText = "Relationship" : dgv2.Columns(2).Width =
120
dgv2.Columns(3).HeaderText = "Name" : dgv2.Columns(3).Width = 250
dgv2.Columns(4).HeaderText = "Sex" : dgv2.Columns(4).Width = 75
dgv2.Columns(5).HeaderText = "Date of Birth" : dgv2.Columns(5).Width =
120
dgv2.Columns(6).HeaderText = "Age" : dgv2.Columns(6).Width = 75
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
End Sub
Sub MemberRecords()
executeSQLStatement("select * from qryHmembers where HouseNo=" &
Val(txtHouseNos.Text) & " order by ResidentID")
dgv2.DataSource = MyDataSet.Tables(0)
lblMemberCtr.Text = "Household Member(s): " &
MyDataSet.Tables(0).Rows.Count + 1
Formatdgv2()
End Sub
Sub tempMemberRecords()
executeSQLStatement("select * from qryTHmembers where HouseNo=" &
Val(txtHouseNos.Text) & " order by ResidentID")
dgv2.DataSource = MyDataSet.Tables(0)
If Trim(txtHID.Text) <> "" Then
lblMemberCtr.Text = "Household Member(s): " &
MyDataSet.Tables(0).Rows.Count + 1
Else
lblMemberCtr.Text = "Household Member(s): " &
MyDataSet.Tables(0).Rows.Count
End If
''Formatdgv2()
End Sub
Sub ClearH()
txtHouseNos.Clear()
txtZone.Clear() : ComboBox1.Text = ""
txtTSHouses.Clear() : cboTSHouse.Text = ""
txtTSLot.Clear() : cboTSLot.Text = ""
txtWResources.Text = ""
txtAIncome.Clear()
txtNoFmly.Clear()
txtHID.Clear()
txtHName.Clear()
txtHSex.Clear()
txtHDOB.Clear()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
txtHAge.Clear()
txtHCivilStatus.Clear()
txtHReligion.Clear()
txtHNationality.Clear()
txtHEduc.Clear()
txtHOcc.Clear()
txtHEmp.Clear()
cmAutoVehicle.Text = ""
cmbElectric.Text = ""
cmbFarm.Text = ""
cmbhmadeup.Text = ""
cmbOFW.Text = ""
cmbpet.Text = ""
cmbwaterseal.Text = ""
txtbusiness.Clear()
End Sub
Sub ClearM()
txtMID.Clear()
txtMFamily.Clear() : cboMFamily.Text = ""
txtMType.Clear()
txtHRelationship.Clear()
txtMName.Clear()
txtMSex.Clear()
txtMDOB.Clear()
txtMAge.Clear()
txtMCivilStatus.Clear()
txtMReligion.Clear()
txtMNationality.Clear()
txtMEduc.Clear()
txtMOcc.Clear()
txtMEmp.Clear()
End Sub
Sub View()
txtHouseNos.ReadOnly = True
ComboBox1.Enabled = False
txtWResources.Enabled = False
txtAIncome.ReadOnly = True
txtNoFmly.ReadOnly = True
cboTSHouse.Enabled = False
cboTSLot.Enabled = False
txtHRelationship.ReadOnly = True
cboMFamily.Enabled = False
rdo1.Enabled = False
rdo2.Enabled = False
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
btnElip1.Enabled = False
btnElip2.Enabled = False
btnAddNew.Enabled = False : btnAddNew.Text = "ADD NEW"
btnUpdate.Enabled = False : btnUpdate.Text = "UPDATE"
btnRemove.Enabled = False : btnRemove.Text = "REMOVE FROM LIST"
btnNew.Enabled = True
btnEdit.Enabled = True
btnDelete.Enabled = True
btnSave.Enabled = False
btnClose.Text = "CLOSE"
txtSearch.ReadOnly = False
dgv.Enabled = True
End Sub
Sub AddEdit()
txtHouseNos.ReadOnly = False
ComboBox1.Enabled = True
txtWResources.Enabled = True
txtAIncome.ReadOnly = False
txtNoFmly.ReadOnly = False
cboTSHouse.Enabled = True
cboTSLot.Enabled = True
btnElip1.Enabled = True
btnAddNew.Enabled = True
btnUpdate.Enabled = True
btnRemove.Enabled = True
btnNew.Enabled = False
btnEdit.Enabled = False
btnDelete.Enabled = False
btnSave.Enabled = True
btnClose.Text = "CANCEL"
txtSearch.ReadOnly = True
dgv.Enabled = False
End Sub
Sub Save()
If txtHouseNos.Text = "" Or cmbwaterseal.Text = "" Or
cmAutoVehicle.Text = "" Or cmbpet.Text = "" Or cmbwaterseal.Text = "" Or
txtZone.Text = "" Or cmbElectric.Text = "" Or txtbusiness.Text = "" Or
cmbOFW.Text = "" Or txtTSHouses.Text = "" Or txtTSLot.Text = "" Then
MsgBox("Required fields missing!", MsgBoxStyle.Information,
"Missing Information")
Exit Sub
End If
If AEswitch = "a" Then
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
End Sub
cboMFamily.Text = ""
txtHRelationship.ReadOnly = False
cboMFamily.Enabled = True
rdo1.Enabled = True
rdo2.Enabled = True
btnAddNew.Text = "SAVE"
btnUpdate.Text = "CANCEL"
btnRemove.Enabled = False
btnElip2.Enabled = True
Else
ClearM()
txtHRelationship.ReadOnly = True
cboMFamily.Enabled = False
rdo1.Enabled = False
rdo2.Enabled = False
btnAddNew.Enabled = True
btnAddNew.Text = "ADD NEW"
btnUpdate.Text = "UPDATE"
btnRemove.Text = "REMOVE FROM LIST"
btnRemove.Enabled = True
btnElip2.Enabled = False
End If
End Sub
rdo1.Enabled = False
rdo2.Enabled = False
btnAddNew.Enabled = True
btnAddNew.Text = "ADD NEW"
btnUpdate.Text = "UPDATE"
btnRemove.Text = "REMOVE FROM LIST"
btnElip2.Enabled = False
End If
End Sub
Function archive()
If Trim(txtHouseNos.Text) <> "" Then
If MsgBox("Do you want to move this record to archives?",
MsgBoxStyle.Question + MsgBoxStyle.YesNo, "System Message") = MsgBoxResult.Yes
Then
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblhHarchive ([HouseNo],
[ResidentID],[Electric],[WaterSealled],[MadeHouse],[AutoVehicle],[Business],
[Pets],[FamilyOFW],[WaterStyle],[Farms],[numberofFamily],[Zone],[thouse],
[tlot]) values (" & txtHouseNos.Text & "," & txtHID.Text & ",'" &
cmbElectric.Text & "','" & cmbwaterseal.Text & "','" & cmbhmadeup.Text & "','"
& cmAutoVehicle.Text & "','" & txtbusiness.Text & "','" & cmbpet.Text & "','"
& cmbOFW.Text & "','" & txtWResources.Text & "','" & cmbFarm.Text & "','" &
txtNoFmly.Text & "','" & txtZone.Text & "','" & txtTSHouses.Text & "','" &
txtTSLot.Text & "')"
kom.ExecuteNonQuery()
kom.CommandText = "Delete * from tblHouseHold where HouseNo="
& txtHouseNos.Text
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
kom.ExecuteNonQuery()
Call ClearH()
Call ClearM()
'Call FilldgHouseholds()
MsgBox("Record moved to archives", MsgBoxStyle.Information,
"System Message")
End If
Else
MsgBox("No record selected", MsgBoxStyle.Information, "System
Message")
End If
Return True
End Function
'Function FilldgHouseholds()
' sql = "select * from tblHousehold order by HouseNo"
' da = New OleDbDataAdapter(sql, kon)
' ds = New DataSet
' da.Fill(ds, "Household")
' dgv.DataSource = ds.Tables("Household")
' lblRecFound.Text = "Record(s) found: " &
ds.Tables("Households").Rows.Count
' 'Call Formatdgv()
' Return True
'End Function
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
Save()
End Sub
cmbwaterseal.Text = dgv.CurrentRow.Cells(7).Value.ToString
cmbhmadeup.Text = dgv.CurrentRow.Cells(8).Value.ToString
txtHID.Text = dgv.CurrentRow.Cells(14).Value.ToString
HID = txtHID.Text
txtHName.Text = dgv.CurrentRow.Cells(15).Value.ToString
cmAutoVehicle.Text = dgv.CurrentRow.Cells(9).Value.ToString
txtbusiness.Text = dgv.CurrentRow.Cells(10).Value.ToString()
txtHDOB.Text =
Date.Parse(dgv.CurrentRow.Cells(17).Value.ToString).ToString("M'/'d'/'yyyy")
cmbpet.Text = dgv.CurrentRow.Cells(11).Value.ToString
cmbOFW.Text = dgv.CurrentRow.Cells(12).Value.ToString
cmbFarm.Text = dgv.CurrentRow.Cells(13).Value.ToString
txtHSex.Text = dgv.CurrentRow.Cells(16).Value.ToString
txtHAge.Text = dgv.CurrentRow.Cells(18).Value.ToString
txtHCivilStatus.Text = dgv.CurrentRow.Cells(19).Value.ToString
txtHReligion.Text = dgv.CurrentRow.Cells(20).Value.ToString
txtHNationality.Text = dgv.CurrentRow.Cells(21).Value.ToString
txtHEduc.Text = dgv.CurrentRow.Cells(22).Value.ToString
txtHOcc.Text = dgv.CurrentRow.Cells(23).Value.ToString
txtHEmp.Text = dgv.CurrentRow.Cells(24).Value.ToString
txtname.Text = txtHName.Text
MemberRecords()
End Sub
End Sub
End Sub
cboMFamily.Items.Clear()
If Val(txtNoFmly.Text) = 1 Then
cboMFamily.Items.Add("1st family")
ElseIf Val(txtNoFmly.Text) = 2 Then
cboMFamily.Items.Add("1st family")
cboMFamily.Items.Add("2nd family")
ElseIf Val(txtNoFmly.Text) = 3 Then
cboMFamily.Items.Add("1st family")
cboMFamily.Items.Add("2nd family")
cboMFamily.Items.Add("3rd family")
ElseIf Val(txtNoFmly.Text) >= 4 Then
cboMFamily.Items.Add("1st family")
cboMFamily.Items.Add("2nd family")
cboMFamily.Items.Add("3rd family")
Dim x As Integer
Dim y As String
For x = 4 To Val(txtNoFmly.Text)
y = x & "th family"
cboMFamily.Items.Add(y)
Next
End If
End Sub
End Sub
e.Handled = True
End If
End If
End Sub
End Sub
End Sub
Search()
End Sub
Sub Search()
Call LoadRecord(dt, dset, "qryHouseHolds1", "Select * from
qryHouseHolds1 Where HouseNo like '%" & txtSearch.Text & "%'", dgv)
lblRecFound.Text = dset.Tables("qryHouseholds1").Rows.Count & "
Record(s) found!"
End Sub
Sub ReloadRecords1()
executeSQLStatement("select * from qryHouseHolds1 order by HeadName")
dgv.DataSource = MyDataSet.Tables(0)
lblRecFound.Text = "Record(s) found: " &
MyDataSet.Tables(0).Rows.Count
'Formatdgv()
End Sub
End Sub
panelHMI.Visible = False
panelHI.Visible = True
panelLHM.Visible = False
End Sub
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub
End Class
“list of data
Imports System.Data.OleDb
Public Class FrmListofResident
Dim dt As New OleDbDataAdapter
Dim dtset As DataSet
Dim kom As New OleDbCommand
Dim dgFont As New Font("Cambria", 10)
Private Sub btnclose_Click(sender As Object, e As EventArgs) Handles
btnclose.Click
Close()
End Sub
Sub formatgrid()
dgvlist.Font = dgFont
dgvlist.Columns(0).Visible = False
dgvlist.Columns(1).HeaderText = "Last Name"
dgvlist.Columns(1).Width = 120
dgvlist.Columns(2).HeaderText = "First Name"
dgvlist.Columns(2).Width = 120
dgvlist.Columns(3).HeaderText = "Last Name"
dgvlist.Columns(3).Width = 120
dgvlist.Columns(4).HeaderText = "Zone"
dgvlist.Columns(4).Width = 120
dgvlist.Columns(5).HeaderText = "Sex"
dgvlist.Columns(5).Width = 120
dgvlist.Columns(6).HeaderText = "Date of Birth"
dgvlist.Columns(6).Width = 120
dgvlist.Columns(7).HeaderText = "Age"
dgvlist.Columns(7).Width = 120
dgvlist.Columns(8).HeaderText = "Status"
dgvlist.Columns(8).Width = 120
dgvlist.Columns(9).HeaderText = "Religion"
dgvlist.Columns(9).Width = 100
dgvlist.Columns(10).HeaderText = "Nationality"
dgvlist.Columns(10).Width = 120
dgvlist.Columns(11).HeaderText = "Educational Attaintment"
dgvlist.Columns(11).Width = 220
dgvlist.Columns(12).HeaderText = "Occupation"
dgvlist.Columns(12).Width = 120
dgvlist.Columns(13).HeaderText = "Employement"
dgvlist.Columns(13).Width = 120
End Sub
Private Sub FrmListofResident_Load(sender As Object, e As EventArgs)
Handles MyBase.Load
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
Call populate()
Call konneksyon()
End Sub
Sub populate()
Select Case Trim(Me.Text)
Case "PWD"
lblist.Text = "Person with Disability"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents Where PWD='Yes'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
formatgrid()
Case "4ps"
lblist.Text = "Member of Pantawid Pamilya Fund"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents Where PPF='Yes'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
formatgrid()
Case "Browse"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
formatgrid()
Case "ResidentList"
lblist.Text = "San Esteban Resident list"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
formatgrid()
Case "Male"
lblist.Text = "San Esteban Male list"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents where rSex='Male'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
formatgrid()
Case "female"
lblist.Text = "San Esteban Female list"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents where rSex='Female'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
formatgrid()
Case "Senior"
lblist.Text = "San Esteban Senior Citizen list"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents where rAge>=60", dgvlist)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
formatgrid()
End Select
End Sub
Case "Male"
Call konneksyon()
Dim male As New crmale
dt = New OleDbDataAdapter("Select * from tblResidents where
rSex='male' ", kon)
dtset = New DataSet
dt.Fill(dtset)
male.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = male
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case "female"
Call konneksyon()
Dim female As New crFemale
dt = New OleDbDataAdapter("Select * from tblResidents where
rSex='female' ", kon)
dtset = New DataSet
dt.Fill(dtset)
female.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = female
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case "Senior"
Call konneksyon()
Dim Senior As New crSenior
dt = New OleDbDataAdapter("Select * from tblResidents where
rAge>=60 ", kon)
dtset = New DataSet
dt.Fill(dtset)
Senior.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = Senior
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case 1
Call konneksyon()
Dim zone1 As New crzone1
dt = New OleDbDataAdapter("Select * from tblResidents where
rZone='Zone 1'", kon)
dtset = New DataSet
dt.Fill(dtset)
zone1.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = zone1
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case 2
Call konneksyon()
Dim zone1 As New crzone2
dt = New OleDbDataAdapter("Select * from tblResidents where
rZone='Zone 2'", kon)
dtset = New DataSet
dt.Fill(dtset)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
zone1.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = zone1
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case 3
Call konneksyon()
Dim zone1 As New crZone3
dt = New OleDbDataAdapter("Select * from tblResidents where
rZone='Zone 3'", kon)
dtset = New DataSet
dt.Fill(dtset)
zone1.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = zone1
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case 4
Call konneksyon()
Dim zone1 As New crzone4
dt = New OleDbDataAdapter("Select * from tblResidents where
rZone='Zone 4'", kon)
dtset = New DataSet
dt.Fill(dtset)
zone1.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = zone1
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case 5
Call konneksyon()
Dim zone1 As New crzone4
dt = New OleDbDataAdapter("Select * from tblResidents where
rZone='Zone 5'", kon)
dtset = New DataSet
dt.Fill(dtset)
zone1.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = zone1
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case 6
Call konneksyon()
Dim zone1 As New crZone6
dt = New OleDbDataAdapter("Select * from tblResidents where
rZone='Zone 6'", kon)
dtset = New DataSet
dt.Fill(dtset)
zone1.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = zone1
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case 7
Call konneksyon()
Dim zone1 As New crZone7
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
End Sub
End Class
“under security
Imports System.Data.OleDb
Public Class frmLogin
Dim uname, pword As String
Dim x, m, s As Integer
Private Sub Login_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call konneksyon()
lblAttempts.Text = ""
Call CheckSystemLock()
txtUName.Focus()
frmMain.tmrMain.Start()
Me.Text = "Login Form"
End Sub
Function Login()
'to check if the log-in information entered is valid
If Trim(txtUName.Text) <> "" And Trim(txtPword.Text) <> "" Then
sql = "select * from tblSecurity where UName='" & txtUName.Text &
"' and Pword='" & txtPword.Text & "'"
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
lblAttempts.Text = "You have " & x & " attempts left to Log-
in"
MsgBox("Access Denied. Empty Entry not Allowed",
MsgBoxStyle.Exclamation, "Login Failed")
End If
End If
Return True
End Function
Function CheckSystemLock()
'checks if the system is still locked or not
sql = "Select * from LockTime"
da = New OleDbDataAdapter(sql, kon)
ds = New DataSet
da.Fill(ds, "LockTime")
If ds.Tables("LockTime").Rows.Count <> 0 Then
LoginTimer.Start()
m =
Val(ds.Tables("LockTime").Rows(0).Item("MinutesLeft").ToString)
s =
Val(ds.Tables("LockTime").Rows(0).Item("SecondsLeft").ToString)
grpLogin.Enabled = False
lblForgotPassword.Text = "Administrator Unlock"
Else
LoginTimer.Stop()
x = 5 : lblAttempts.Text = "You have " & x & " attempts to Log-in"
grpLogin.Enabled = True
lblForgotPassword.Text = "Forgot your password?"
End If
Return True
End Function
Function LockSystem()
'locks the system and save the locktime to the database
sql = "select * from SetLockTime"
da = New OleDbDataAdapter(sql, kon)
ds = New DataSet
da.Fill(ds, "SetLockTime")
m = ds.Tables("SetLockTime").Rows(0).Item("Minutes").ToString
s = ds.Tables("SetLockTime").Rows(0).Item("Seconds").ToString
sql = "insert into LockTime values('" & m & "','" & s & "')"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()
txtUName.Clear()
txtPword.Clear()
LoginTimer.Start()
grpLogin.Enabled = False
lblForgotPassword.Text = "Administrator Unlock"
lblAttempts.Text = "System Unlocks in " & m & ":" & "0" & s
Return True
End Function
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
sql = "insert into tblSystemLog values('" & txtUName.Text & "','" &
act & "','" & currDate & "','" & currTime & "')"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()
Return True
End Function
Function UnlockSystem()
'unlocks the system when timer reaches zero
If s = 0 Then
m = m - 1
s = 60
End If
s = s - 1
If s > 9 Then
lblAttempts.Text = "System Unlocks in " & m & ":" & s
Else
lblAttempts.Text = "System Unlocks in " & m & ":" & "0" & s
End If
If m = 0 And s = 0 Then
lblAttempts.Text = "System Unlocks in " & m & ":" & "0" & s
LoginTimer.Stop()
grpLogin.Enabled = True
lblForgotPassword.Text = "Forgot your password?"
x = 5 : lblAttempts.Text = "You have " & x & " attempts to Log-in"
End Sub
End Sub
End Sub
End Sub
End Sub
End Class
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
Me.Close()
End If
End Sub
End Class
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "Sex"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Date of Birth"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Age"
DataGridView1.Columns(5).Width = 50
DataGridView1.Columns(6).HeaderText = "Status"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Date of Migrated"
DataGridView1.Columns(7).Width = 250
Case "DeadNotes"
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).HeaderText = "Full Name"
DataGridView1.Columns(1).Width = 150
DataGridView1.Columns(2).HeaderText = "Date of Birth"
DataGridView1.Columns(2).Width = 150
DataGridView1.Columns(3).HeaderText = "Age"
DataGridView1.Columns(3).Width = 150
DataGridView1.Columns(4).HeaderText = "Date of death"
DataGridView1.Columns(4).Width = 170
DataGridView1.Columns(5).HeaderText = "Zone"
DataGridView1.Columns(5).Width = 150
Case "SeniorCitizen"
DataGridView1.Font = dgFont
DataGridView1.Columns(0).HeaderText = "Resident ID"
DataGridView1.Columns(0).Width = 120
DataGridView1.Columns(1).HeaderText = "Last Name"
DataGridView1.Columns(1).Width = 120
DataGridView1.Columns(2).HeaderText = "First Name"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "Last Name"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Zone"
DataGridView1.Columns(4).Width = 70
DataGridView1.Columns(5).HeaderText = "Sex"
DataGridView1.Columns(5).Width = 70
DataGridView1.Columns(6).HeaderText = "Date of Birth"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Age"
DataGridView1.Columns(7).Width = 50
DataGridView1.Columns(8).Visible = False
DataGridView1.Columns(9).Visible = False
DataGridView1.Columns(10).Visible = False
DataGridView1.Columns(11).Visible = False
DataGridView1.Columns(12).Visible = False
DataGridView1.Columns(13).Visible = False
Case "Residents"
DataGridView1.Font = dgFont
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).HeaderText = "Last Name"
DataGridView1.Columns(1).Width = 120
DataGridView1.Columns(2).HeaderText = "First Name"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "Last Name"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Zone"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Sex"
DataGridView1.Columns(5).Width = 120
DataGridView1.Columns(6).HeaderText = "Date of Birth"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Age"
DataGridView1.Columns(7).Width = 120
DataGridView1.Columns(8).HeaderText = "Status"
DataGridView1.Columns(8).Width = 120
DataGridView1.Columns(9).HeaderText = "Religion"
DataGridView1.Columns(9).Width = 100
DataGridView1.Columns(10).HeaderText = "Nationality"
DataGridView1.Columns(10).Width = 120
DataGridView1.Columns(11).HeaderText = "Educational
Attaintment"
DataGridView1.Columns(11).Width = 270
DataGridView1.Columns(12).HeaderText = "Occupation"
DataGridView1.Columns(12).Width = 120
DataGridView1.Columns(13).HeaderText = "Employement"
DataGridView1.Columns(13).Width = 120
Case "Officials"
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).Visible = False
DataGridView1.Columns(2).HeaderText = "Last Name"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "First Name"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Last Name"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Zone"
DataGridView1.Columns(5).Width = 120
DataGridView1.Columns(6).HeaderText = "Sex"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Position"
DataGridView1.Columns(7).Width = 120
DataGridView1.Columns(8).HeaderText = "Term"
DataGridView1.Columns(8).Width = 120
DataGridView1.Columns(9).HeaderText = "Date Start"
DataGridView1.Columns(9).Width = 120
DataGridView1.Columns(10).HeaderText = "Date End"
DataGridView1.Columns(10).Width = 120
Case "Projects"
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).HeaderText = "Zone"
DataGridView1.Columns(1).Width = 120
DataGridView1.Columns(2).HeaderText = "Project type"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "Funded By"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Name of Donor"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Budget"
DataGridView1.Columns(5).Width = 120
DataGridView1.Columns(6).HeaderText = "Date Started"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Date Finish"
DataGridView1.Columns(7).Width = 120
DataGridView1.Columns(8).HeaderText = "Status"
Case "Security"
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).HeaderText = "Name"
DataGridView1.Columns(1).Width = 200
DataGridView1.Columns(2).HeaderText = "User Name"
DataGridView1.Columns(2).Width = 100
DataGridView1.Columns(3).Visible = False
DataGridView1.Columns(4).HeaderText = "Access Level"
DataGridView1.Columns(4).Width = 150
Case "HouseHold"
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).HeaderText = "House ID"
DataGridView1.Columns(1).Width = 120
DataGridView1.Columns(2).Visible = False
DataGridView1.Columns(3).HeaderText = "Last Name"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "First Name"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Last Name"
DataGridView1.Columns(5).Width = 120
DataGridView1.Columns(6).HeaderText = "Zone"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Sex"
DataGridView1.Columns(7).Width = 120
DataGridView1.Columns(8).HeaderText = "Date of Birth"
DataGridView1.Columns(8).Width = 200
DataGridView1.Columns(9).HeaderText = "Age"
DataGridView1.Columns(9).Width = 120
DataGridView1.Columns(10).HeaderText = "Occupation"
DataGridView1.Columns(10).Width = 150
DataGridView1.Columns(11).HeaderText = "Electric"
DataGridView1.Columns(11).Width = 120
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
Case "DeadNotes"
frmAEdeadnotes.Text = "Add Dead Person"
frmAEdeadnotes.btnBrowse.Enabled = True
frmAEdeadnotes.ShowDialog()
End Select
End Sub
Private Sub DataGridView1_CellClick(sender As Object, e As
DataGridViewCellEventArgs) Handles DataGridView1.CellClick
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
End If
Case "Browse"
If e.RowIndex <> -1 Then
frmAEofficials.txtresidentID.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(0).ToString()
frmAEofficials.txtlname.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(1).ToString()
frmAEofficials.txtfname.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(2).ToString()
frmAEofficials.txtmname.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(3).ToString()
frmAEofficials.txtGender.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(5).ToString()
frmAEofficials.txtzone.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(4).ToString()
frmAEdeadnotes.txtfullname.Text =
DataGridView1.CurrentRow.Cells(1).Value + "," +
DataGridView1.CurrentRow.Cells(2).Value + " " +
DataGridView1.CurrentRow.Cells(3).Value
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
frmAEdeadnotes.txtdateofbirth.Text =
DataGridView1.CurrentRow.Cells(6).Value
frmAEdeadnotes.txtage.Text =
DataGridView1.CurrentRow.Cells(7).Value
frmAEdeadnotes.txtzone.Text =
DataGridView1.CurrentRow.Cells(4).Value
frmAEdeadnotes.txtid.Text =
DataGridView1.CurrentRow.Cells(0).Value
Me.Close()
End If
Case "browse1"
If e.RowIndex <> -1 Then
frmAEHouseHold.txtResidentID.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(0).ToString()
frmAEHouseHold.txtlname.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(1).ToString()
frmAEHouseHold.txtfname.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(2).ToString()
frmAEHouseHold.txtage.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(3).ToString()
frmAEHouseHold.txtzone.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(4).ToString()
frmAEHouseHold.txtsex.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(5).ToString()
frmAEHouseHold.txtdob.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(6).ToString()
frmAEHouseHold.txtages.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(7).ToString()
frmAEHouseHold.txtocc.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(12).ToString()
Me.Close()
End If
Case "Projects"
If e.RowIndex <> -1 Then
frmAEprojects.txtsel.Text =
dtset.Tables("tblProject").Rows(e.RowIndex).Item(0).ToString()
txtzoness.Text = DataGridView1.CurrentRow.Cells(1).Value
txtpro.Text = DataGridView1.CurrentRow.Cells(2).Value
txtfund.Text = DataGridView1.CurrentRow.Cells(3).Value
txtdonor.Text = DataGridView1.CurrentRow.Cells(4).Value
txtbud.Text = DataGridView1.CurrentRow.Cells(5).Value
txtdatest.Text = DataGridView1.CurrentRow.Cells(6).Value
txtdtend.Text = DataGridView1.CurrentRow.Cells(7).Value
txtidds.Text = DataGridView1.CurrentRow.Cells(0).Value
frmAEprojects.txtstat.Text =
DataGridView1.CurrentRow.Cells(8).Value
txtstatus.Text = DataGridView1.CurrentRow.Cells(8).Value
' txtoff.Text =
dtset.Tables("tblProject").Rows(e.RowIndex).Item(2).ToString()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
End If
Case "Officials"
If e.RowIndex <> -1 Then
frmAEofficials.txtID.Text =
dtset.Tables("qryOfficials").Rows(e.RowIndex).Item(0).ToString()
txtoff.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("rLN").
ToString()
txtresidentID.Text =
DataGridView1.CurrentRow.Cells(1).Value
txtlastName.Text = DataGridView1.CurrentRow.Cells(2).Value
txtfname.Text = DataGridView1.CurrentRow.Cells(3).Value
txtmname.Text = DataGridView1.CurrentRow.Cells(4).Value
txtPosition.Text = DataGridView1.CurrentRow.Cells(7).Value
txtterm.Text = DataGridView1.CurrentRow.Cells(8).Value
txtFinish.Text =
Date.Parse(DataGridView1.CurrentRow.Cells(9).Value.ToString).ToString("M'/'d'/
'yyyy")
txtdateEnd.Text =
Date.Parse(DataGridView1.CurrentRow.Cells(10).Value.ToString).ToString("M'/'d'
/'yyyy")
End If
Case "HouseHold"
If e.RowIndex <> -1 Then
frmAEHouseHold.txtResidentID.Text =
dtset.Tables("qryHouseHold").Rows(e.RowIndex).Item(0).ToString()
txth.Text =
dtset.Tables("qryHouseHold").Rows(e.RowIndex).Item(0).ToString()
txtHousID.Text =
dtset.Tables("qryHouseHold").Rows(e.RowIndex).Item(1).ToString()
txtiDs.Text = DataGridView1.CurrentRow.Cells(0).Value
txtHhouseID.Text = DataGridView1.CurrentRow.Cells(1).Value
txtHResidentID.Text =
DataGridView1.CurrentRow.Cells(2).Value
txtHLN.Text = DataGridView1.CurrentRow.Cells(3).Value
txtHFN.Text = DataGridView1.CurrentRow.Cells(4).Value
txtMN.Text = DataGridView1.CurrentRow.Cells(5).Value
txtelectric.Text =
DataGridView1.CurrentRow.Cells(11).Value
txtwaterSealed.Text =
DataGridView1.CurrentRow.Cells(12).Value
txtmadeup.Text = DataGridView1.CurrentRow.Cells(13).Value
txtauto.Text = DataGridView1.CurrentRow.Cells(14).Value
txtbusiness.Text =
DataGridView1.CurrentRow.Cells(15).Value
txtpets.Text = DataGridView1.CurrentRow.Cells(16).Value
txtofw.Text = DataGridView1.CurrentRow.Cells(17).Value
txtwaterstyle.Text =
DataGridView1.CurrentRow.Cells(18).Value
txtfarms.Text = DataGridView1.CurrentRow.Cells(19).Value
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
txthead.Text = DataGridView1.CurrentRow.Cells(20).Value
End If
Case "DeadNotes"
If e.RowIndex <> -1 Then
txts.Text = DataGridView1.CurrentRow.Cells(0).Value
End If
End Select
End Sub
Sub EditRecord()
Select Case Trim(Me.Text)
Case "Residents"
If frmAEresidents.txtID.Text = "" Then
MsgBox("Please Select a record", MsgBoxStyle.Information,
"System Message")
Else
frmAEresidents.Text = "Edit Residents"
frmAEresidents.cmreligion.Text =
DataGridView1.CurrentRow.Cells(9).Value
frmAEresidents.cmpwd.Text =
DataGridView1.CurrentRow.Cells(14).Value
frmAEresidents.txtLname.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rLN").
ToString()
frmAEresidents.txtFName.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rFN").
ToString()
frmAEresidents.txtMname.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rMN").
ToString()
frmAEresidents.cmbzone.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rZone"
).ToString()
frmAEresidents.cmbsex.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rSex")
.ToString()
frmAEresidents.cmbdate.Text =
Date.Parse(DataGridView1.CurrentRow.Cells(6).Value.ToString).ToString("M'/'d'/
'yyyy")
frmAEresidents.txtage.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rAge")
.ToString()
frmAEresidents.cmbcivil.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rCstat
us").ToString()
frmAEresidents.cmreligion.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rRelig
ion").ToString()
frmAEresidents.txtnationality.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rNatio
nality").ToString()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
frmAEresidents.txteduca.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rEduca
tt").ToString()
frmAEresidents.txtoccu.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("roccup
tion").ToString()
frmAEresidents.txtemplo.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rEmplo
yment").ToString()
frmAEresidents.cmb4ps.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("PPF").
ToString()
frmAEresidents.ShowDialog()
End If
Case "Officials"
If txtoff.Text = "" Then
MsgBox("Please Select a record", MsgBoxStyle.Information,
"System Message")
Else
frmAEofficials.Text = "Edit Officials"
frmAEofficials.txtresidentID.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("Reside
ntID").ToString()
frmAEofficials.txtlname.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("rLN").
ToString()
frmAEofficials.txtfname.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("rFN").
ToString()
frmAEofficials.txtmname.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("rMN").
ToString()
frmAEofficials.txtGender.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("rSex")
.ToString()
frmAEofficials.txtzone.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("rZone"
).ToString()
frmAEofficials.cmbPostion.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("Positi
on").ToString()
frmAEofficials.cmbTerm.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("Term")
.ToString()
frmAEofficials.cmbDateStart.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("DateSt
art").ToString()
frmAEofficials.cmdateEnd.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("DateEn
d").ToString()
frmAEofficials.ShowDialog()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
End If
Case "Projects"
If frmAEprojects.txtsel.Text = "" Then
MsgBox("Please Select a record", MsgBoxStyle.Information,
"System Message")
Else
frmAEprojects.Text = "Edit Projects"
frmAEprojects.cmbzone.Text =
dtset.Tables("tblProject").Rows(DataGridView1.CurrentRow.Index).Item("Zone").T
oString()
frmAEprojects.txtpro.Text =
dtset.Tables("tblProject").Rows(DataGridView1.CurrentRow.Index).Item("ProjectT
ype").ToString()
frmAEprojects.txtfun.Text =
dtset.Tables("tblProject").Rows(DataGridView1.CurrentRow.Index).Item("FundedBy
").ToString()
frmAEprojects.txtdonor.Text =
dtset.Tables("tblProject").Rows(DataGridView1.CurrentRow.Index).Item("NameOfDo
nor").ToString()
frmAEprojects.txtbud.Text =
dtset.Tables("tblProject").Rows(DataGridView1.CurrentRow.Index).Item("Budget")
.ToString()
frmAEprojects.txtstat.Text =
Date.Parse(DataGridView1.CurrentRow.Cells(6).Value.ToString).ToString("M'/'d'/
'yyyy")
frmAEprojects.txtdatef.Text =
Date.Parse(DataGridView1.CurrentRow.Cells(7).Value.ToString).ToString("M'/'d'/
'yyyy")
frmAEprojects.txtstat.Text =
DataGridView1.CurrentRow.Cells(8).Value
frmAEprojects.Show()
End If
Case "HouseHold"
If txth.Text = "" Then
MsgBox("Please Select a record", MsgBoxStyle.Information,
"System Message")
Else
frmAEHouseHold.Text = "Edit houseHold"
frmAEHouseHold.txtlname.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("rLN").
ToString()
frmAEHouseHold.txtfname.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("rFN").
ToString()
frmAEHouseHold.txtages.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("rMN").
ToString()
frmAEHouseHold.txtzone.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("rZone"
).ToString()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
frmAEHouseHold.txtsex.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("rSex")
.ToString()
frmAEHouseHold.txtdob.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("rDOB")
.ToString()
frmAEHouseHold.txtage.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("rAge")
.ToString()
frmAEHouseHold.txtocc.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("roccup
tion").ToString()
frmAEHouseHold.txtHouseID.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("houseI
D").ToString()
frmAEHouseHold.txtResidentID.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("Reside
ntID").ToString()
frmAEHouseHold.cmbElectric.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("Electr
ic").ToString()
frmAEHouseHold.cmbwaterseal.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("waterS
ealled").ToString()
frmAEHouseHold.cmbhmadeup.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("MadeHo
use").ToString()
frmAEHouseHold.cmAutoVehicle.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("AutoVe
hicle").ToString()
frmAEHouseHold.txtbusiness.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("Busine
ss").ToString()
frmAEHouseHold.cmbpet.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("Pets")
.ToString()
frmAEHouseHold.cmbOFW.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("Family
OFW").ToString()
frmAEHouseHold.cmbwater.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("WaterS
tyle").ToString()
frmAEHouseHold.cmbFarm.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("Farms"
).ToString()
frmAEHouseHold.txthead.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("Head")
.ToString()
frmAEHouseHold.ShowDialog()
End If
Case "Browse"
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
frmAEHouseHold.txtHouseID.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("Reside
ntID").ToString()
Case "DeadNotes"
frmAEdeadnotes.Text = "Edit Dead Person"
frmAEdeadnotes.btnBrowse.Enabled = False
frmAEdeadnotes.txtfullname.Text =
DataGridView1.CurrentRow.Cells(1).Value
frmAEdeadnotes.txtdateofbirth.Text =
DataGridView1.CurrentRow.Cells(2).Value
frmAEdeadnotes.txtage.Text =
DataGridView1.CurrentRow.Cells(3).Value
frmAEdeadnotes.DateTimePicker1.Text =
DataGridView1.CurrentRow.Cells(4).Value
frmAEdeadnotes.txtzone.Text =
DataGridView1.CurrentRow.Cells(5).Value
frmAEdeadnotes.txtsel.Text =
DataGridView1.CurrentRow.Cells(0).Value
frmAEdeadnotes.ShowDialog()
Case "Security"
frmAEsecurity.txtfullname.Text =
DataGridView1.CurrentRow.Cells(1).Value
frmAEsecurity.txtUname.Text =
DataGridView1.CurrentRow.Cells(2).Value
frmAEsecurity.txtPword.Text =
DataGridView1.CurrentRow.Cells(3).Value
frmAEsecurity.cmbACClevel.Text =
DataGridView1.CurrentRow.Cells(4).Value
frmAEsecurity.txtID.Text =
DataGridView1.CurrentRow.Cells(0).Value
frmAEsecurity.ShowDialog()
Case "Migrated Person"
frmMigrate.Text = "Edit Migrated Person"
frmMigrate.btnBrowse.Enabled = False
frmMigrate.txtIDs.Text =
DataGridView1.CurrentRow.Cells(0).Value
frmMigrate.txtfuname.Text =
DataGridView1.CurrentRow.Cells(1).Value
frmMigrate.cmbzone.Text =
DataGridView1.CurrentRow.Cells(2).Value
frmMigrate.cmbsex.Text =
DataGridView1.CurrentRow.Cells(3).Value
frmMigrate.cmbdate.Text =
Date.Parse(DataGridView1.CurrentRow.Cells(4).Value.ToString).ToString("M'/'d'/
'yyyy")
frmMigrate.txtage.Text =
DataGridView1.CurrentRow.Cells(5).Value
frmMigrate.cmbcivil.Text =
DataGridView1.CurrentRow.Cells(6).Value
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
frmMigrate.DateTimePicker1.Text =
Date.Parse(DataGridView1.CurrentRow.Cells(7).Value.ToString).ToString("M'/'d'/
'yyyy")
frmMigrate.ShowDialog()
End Select
End Sub
Sub delete()
Select Case Trim(Me.Text)
Case "Migrated Person"
If txtauto.Text = "" Then
MsgBox("Unenable to Transfer ", MsgBoxStyle.Information,
"System Message")
End If
Case "DeadNotes"
If txtauto.Text = "" Then
MsgBox("Unenable to Transfer ", MsgBoxStyle.Information,
"System Message")
End If
Case "HouseHold"
If txtiDs.Text = "" Then
MsgBox("Please select a Record", MsgBoxStyle.Information,
"System Message")
Else
If MsgBox("Do you want to move this record from
archives?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "System Message") =
MsgBoxResult.Yes Then
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblHouseHoldArchive
(HouseID,ResidentID,Lname,lfname,lmname,Electric,WaterSealled,MadeHouse,AutoVe
hicle,Business,Pets,FamilyOFW,WaterStyle,Farms,Head) values (" &
txtHousID.Text & "," & txtHResidentID.Text & ",'" & txtHLN.Text & "','" &
txtHFN.Text & "','" & txtMN.Text & "','" & txtelectric.Text & "','" &
txtwaterSealed.Text & "','" & txtmadeup.Text & "','" & txtauto.Text & "','" &
txtbusiness.Text & "','" & txtpets.Text & "','" & txtofw.Text & "','" &
txtwaterstyle.Text & "','" & txtfarms.Text & "','" & txthead.Text & "')"
kom.ExecuteNonQuery()
kom.CommandText = "delete * from tblHouseHold Where
ID=" & txtiDs.Text
kom.ExecuteNonQuery()
Call pupulate()
End If
End If
Case "Residents"
Dim a As String
a = "Deleted"
If txtsss.Text = "" Then
MsgBox("Please Select a Record", MsgBoxStyle.Information,
"System Message")
Else
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
txtsearch.Text & "%'or rZone Like '%" & txtsearch.Text & "%'or rSex Like '%" &
txtsearch.Text & "%'", DataGridView1)
End Select
End Sub
Private Sub frmRecord_Activated(sender As Object, e As EventArgs) Handles
Me.Activated
Call pupulate()
End Sub
Sub print()
Select Case Trim(Me.Text)
Case "Residents"
reports = 1
Case "Officials"
reports = 2
Case "Projects"
reports = 3
Case "DeadNotes"
reports = 4
Case "Migrated Person"
reports = 5
End Select
frmRecordPrint.ShowDialog()
End Sub
frmAEdeadnotes.txtzone.Text = ""
frmAEdeadnotes.txtid.Text = ""
End Sub
Private Sub picadd1_Click(sender As Object, e As EventArgs) Handles
picadd1.Click
cleardeadnotes()
frmAEprojects.clear()
frmAEofficials.clear()
frmAEHouseHold.clear()
frmAEresidents.clear()
AddRecord()
End Sub
End Sub
End Class
“for print the data
Imports System.Data.OleDb
Public Class frmRecordPrint
Dim dt, dreport As New OleDbDataAdapter
Dim dset, dsreport As New DataSet
End Sub
Official.SetDataSource(dset.Tables("tblOfficials"))
CrystalReportViewer1.ReportSource = Official
CrystalReportViewer1.RefreshReport()
Case 3
Call konneksyon()
Dim project As New crproject
dt = New OleDbDataAdapter("Select * from tblProject ", kon)
dset = New DataSet
dt.Fill(dset)
project.SetDataSource(dset.Tables("tblProject"))
CrystalReportViewer1.ReportSource = project
CrystalReportViewer1.RefreshReport()
Case 4
Call konneksyon()
Dim deadnotes As New crDeadNotes
dt = New OleDbDataAdapter("Select * from tbldeadnotes ", kon)
dset = New DataSet
dt.Fill(dset)
deadnotes.SetDataSource(dset.Tables("tbldeadnotes"))
CrystalReportViewer1.ReportSource = deadnotes
CrystalReportViewer1.RefreshReport()
Case 5
Call konneksyon()
Dim migrated As New crMigrated
dt = New OleDbDataAdapter("Select * from tblMigrated ", kon)
dset = New DataSet
dt.Fill(dset)
migrated.SetDataSource(dset.Tables("tblMigrated "))
CrystalReportViewer1.ReportSource = migrated
CrystalReportViewer1.RefreshReport()
End Select
End Sub
End Class
“under security
Public Class frmReset
Dim x, m, s As Integer
End Sub
End Sub
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
End Class
Mctr(19) += 1
Case "Female"
'for female
If xAge = 0 Then
Fctr(1) += 1
ElseIf xAge <= 4 Then
Fctr(2) += 1
ElseIf xAge <= 9 Then
Fctr(3) += 1
ElseIf xAge <= 14 Then
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
Fctr(4) += 1
ElseIf xAge <= 19 Then
Fctr(5) += 1
ElseIf xAge <= 24 Then
Fctr(6) += 1
ElseIf xAge <= 29 Then
Fctr(7) += 1
ElseIf xAge <= 34 Then
Fctr(8) += 1
ElseIf xAge <= 39 Then
Fctr(9) += 1
ElseIf xAge <= 44 Then
Fctr(10) += 1
ElseIf xAge <= 49 Then
Fctr(11) += 1
ElseIf xAge <= 54 Then
Fctr(12) += 1
ElseIf xAge <= 59 Then
Fctr(13) += 1
ElseIf xAge <= 64 Then
Fctr(14) += 1
ElseIf xAge <= 69 Then
Fctr(15) += 1
ElseIf xAge <= 74 Then
Fctr(16) += 1
ElseIf xAge <= 79 Then
Fctr(17) += 1
ElseIf xAge <= 80 Then
Fctr(18) += 1
End If
Fctr(19) += 1
End Select
'for both sexes
If xAge = 0 Then
Bctr(1) += 1
ElseIf xAge <= 4 Then
Bctr(2) += 1
ElseIf xAge <= 9 Then
Bctr(3) += 1
ElseIf xAge <= 14 Then
Bctr(4) += 1
ElseIf xAge <= 19 Then
Bctr(5) += 1
ElseIf xAge <= 24 Then
Bctr(6) += 1
ElseIf xAge <= 29 Then
Bctr(7) += 1
ElseIf xAge <= 34 Then
Bctr(8) += 1
ElseIf xAge <= 39 Then
Bctr(9) += 1
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
For b = 1 To 19
If x = 0 Then
Mp(b) = 0
Fp(b) = 0
Else
Mp(b) = Mctr(b) / x * 100
Fp(b) = Fctr(b) / x * 100
End If
Next b
For c = 1 To 19
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = ("update tblDPage set a_BothSexes=" & Bctr(c) &
",a_Male=" & Mctr(c) & ",a_Mpercent=" & Mp(c) & ",a_Female=" & Fctr(c) &
",a_Fpercent=" & Fp(c) & " where ID=" & c & "")
kom.ExecuteNonQuery()
Next
Call LoadRecord(da, dtset, "tblDPage", "Select * from tblDPage",
dgvage)
dgvage.DataSource = dtset.Tables(0)
dgvage.ColumnHeadersDefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleCenter
dgvage.DefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleCenter
dgvage.Columns(0).Visible = False
dgvage.Rows(19).Height = 40
dgvage.Columns(1).HeaderText = "Age Group"
dgvage.Columns(1).Width = 120
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
EA(0) = "NONE"
EA(1) = "PRE-SCHOOL"
EA(2) = "ELEMENTARY LEVEL"
EA(3) = "ELEMENTARY GRADUATE"
EA(4) = "HIGH SCHOOL LEVEL"
EA(5) = "HIGH SCHOOL GRADUATE"
EA(6) = "VOCATIONAL"
EA(7) = "COLLEGE LEVEL"
EA(8) = "COLLEGE GRADUATE"
EA(9) = "POST BACCALAUREATE"
Mctr(2) += 1
Case "ELEMENTARY GRADUATE"
Mctr(3) += 1
Case "HIGH SCHOOL LEVEL"
Mctr(4) += 1
Case "HIGH SCHOOL GRADUATE"
Mctr(5) += 1
Case "VOCATIONAL"
Mctr(6) += 1
Case "COLLEGE LEVEL"
Mctr(7) += 1
Case "COLLEGE GRADUATE"
Mctr(8) += 1
Case "POST BACCALAUREATE"
Mctr(9) += 1
End Select
Case "Female"
'for female
Select Case xEA
Case "NONE"
Fctr(0) += 1
Case "PRE-SCHOOL"
Fctr(1) += 1
Case "ELEMENTARY LEVEL"
Fctr(2) += 1
Case "ELEMENTARY GRADUATE"
Fctr(3) += 1
Case "HIGH SCHOOL LEVEL"
Fctr(4) += 1
Case "HIGH SCHOOL GRADUATE"
Fctr(5) += 1
Case "VOCATIONAL"
Fctr(6) += 1
Case "COLLEGE LEVEL"
Fctr(7) += 1
Case "COLLEGE GRADUATE"
Fctr(8) += 1
Case "POST BACCALAUREATE"
Fctr(9) += 1
End Select
End Select
Bctr(3) += 1
Case "HIGH SCHOOL LEVEL"
Bctr(4) += 1
Case "HIGH SCHOOL GRADUATE"
Bctr(5) += 1
Case "VOCATIONAL"
Bctr(6) += 1
Case "COLLEGE LEVEL"
Bctr(7) += 1
Case "COLLEGE GRADUATE"
Bctr(8) += 1
Case "POST BACCALAUREATE"
Bctr(9) += 1
End Select
Next a
For b = 0 To 9
If x = 0 Then
Mp(b) = 0
Fp(b) = 0
Else
Mp(b) = Mctr(b) / x * 100
Fp(b) = Fctr(b) / x * 100
End If
Next b
For c = 0 To 9
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = ("update tblDPeduc set a_BothSexes=" & Bctr(c) &
",a_Male=" & Mctr(c) & ",a_Mpercent=" & Mp(c) & ",a_Female=" & Fctr(c) &
",a_Fpercent=" & Fp(c) & " where a_Educ='" & EA(c) & "'")
kom.ExecuteNonQuery()
Next
dgveduc.Columns(4).HeaderText = "Female"
dgveduc.Columns(4).Width = 95
dgveduc.Columns(5).HeaderText = "(%)"
dgveduc.Columns(5).Width = 95
dgveduc.Columns(5).DefaultCellStyle.Format = "##.##"
End Sub
Private Sub btnagsex_Click(sender As Object, e As EventArgs) Handles
btnagsex.Click
lblmess.Visible = False
lblinfo.Text = "Distribution of Population According to Age and Sex"
Chart1.Visible = False
dgvage.Visible = True
dgvzones.Visible = False
dgveduc.Visible = False
dgvcivil.Visible = False
DpAge()
End Sub
Sub DPzone()
'compute distribution of population according to Zone and Sex
Dim Mctr(6), Fctr(6), Bctr(6), x, a, b, c As Integer
Dim Mp(6), Fp(6) As Double
Dim Zone(6), xSex, xZone As String
Mctr(4) += 1
Case "Zone 6"
Mctr(5) += 1
Case "Zone 7"
Mctr(6) += 1
End Select
Case "Female"
Select Case xZone
'for Female
Case "Zone 1"
Fctr(0) += 1
Case "Zone 2"
Fctr(1) += 1
Case "Zone 3"
Fctr(2) += 1
Case "Zone 4"
Fctr(3) += 1
Case "Zone 5"
Fctr(4) += 1
Case "Zone 6"
Fctr(5) += 1
Case "Zone 7"
Fctr(6) += 1
End Select
End Select
'for Both Sexes
Select Case xZone
Case "Zone 1"
Bctr(0) += 1
Case "Zone 2"
Bctr(1) += 1
Case "Zone 3"
Bctr(2) += 1
Case "Zone 4"
Bctr(3) += 1
Case "Zone 5"
Bctr(4) += 1
Case "Zone 6"
Bctr(5) += 1
Case "Zone 7"
Bctr(6) += 1
End Select
Next a
For b = 0 To 6
If x = 0 Then
Mp(b) = 0
Fp(b) = 0
Else
Mp(b) = Mctr(b) / x * 100
Fp(b) = Fctr(b) / x * 100
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
End If
Next b
For c = 0 To 6
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = ("update tblDPzone set a_BothSexes=" & Bctr(c) &
",a_Male=" & Mctr(c) & ",a_Mpercent=" & Mp(c) & ",a_Female=" & Fctr(c) &
",a_Fpercent=" & Fp(c) & " where a_Zone='" & Zone(c) & "'")
kom.ExecuteNonQuery()
Next
End Sub
EA(0) = "SINGLE"
EA(1) = "MARRIED"
EA(2) = "SEPERATED "
EA(3) = "WIDOWED"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from tblResidents
", dgvrecord)
x = dtset.Tables(0).Rows.Count
For a = 0 To dtset.Tables(0).Rows.Count - 1
xcivil = dtset.Tables(0).Rows(a).Item(5).ToString
xEA = dtset.Tables(0).Rows(a).Item(8).ToString
Fctr(3) += 1
End Select
End Select
Next a
For b = 0 To 3
If x = 0 Then
Mp(b) = 0
Fp(b) = 0
Else
Mp(b) = Mctr(b) / x * 100
Fp(b) = Fctr(b) / x * 100
End If
Next b
For c = 0 To 3
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = ("update tblCivilStatus set a_BothSexes=" &
Bctr(c) & ",a_Male=" & Mctr(c) & ",a_Mpercent=" & Mp(c) & ",a_Female=" &
Fctr(c) & ",a_Fpercent=" & Fp(c) & " where a_Civil='" & EA(c) & "'")
kom.ExecuteNonQuery()
Next c
dgvcivil.Columns(3).HeaderText = "(%)"
dgvcivil.Columns(3).Width = 95
dgvcivil.Columns(3).DefaultCellStyle.Format = "##.##"
dgvcivil.Columns(4).HeaderText = "Female"
dgvcivil.Columns(4).Width = 95
dgvcivil.Columns(5).HeaderText = "(%)"
dgvcivil.Columns(5).Width = 95
dgvcivil.Columns(5).DefaultCellStyle.Format = "##.##"
End Sub
Private Sub btncivil_Click(sender As Object, e As EventArgs) Handles
btncivil.Click
Chart1.Visible = False
lblinfo.Text = "Barangay Informations"
dgvzones.Visible = False
dgvage.Visible = False
dgvzones.Visible = False
dgveduc.Visible = False
dgvcivil.Visible = True
lblmess.Visible = False
DpcivilStatus()
End Sub
dt.Fill(dtset)
educ.SetDatabaseLogon("Admin", "helloworld")
educ.SetDataSource(dtset.Tables("tblDPzone"))
frmRecordPrint.CrystalReportViewer1.ReportSource = educ
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.ShowDialog()
ElseIf lblinfo.Text = "Barangay Informations" Then
Dim civil As New crcivil
dt = New OleDbDataAdapter("Select * from tblCivilStatus ", kon)
dtset = New DataSet
dt.Fill(dtset)
civil.SetDatabaseLogon("Admin", "helloworld")
civil.SetDataSource(dtset.Tables("tblCivilStatus"))
frmRecordPrint.CrystalReportViewer1.ReportSource = civil
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.ShowDialog()
Else
MsgBox("Unenable to Print!", MsgBoxStyle.Information, "System
Message")
End If
End Sub
End Class
“systemlog of the system
Imports System.Data.OleDb
Public Class frmSystemLog
Dim dgFont As New Font("Cambria", 10)
Dim sDate As String
Dim eDate As String
Dim sTime As String
Dim kom As New OleDbCommand
Dim da As New OleDbDataAdapter
Dim dset As New DataSet
Private Sub frmSystemLog_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
Me.Text = "Activity Log"
Call konneksyon()
DTPfrom.Text = FormatDateTime(Now, DateFormat.ShortDate)
DTPto.Text = FormatDateTime(Now, DateFormat.ShortDate)
Call FilldgLog()
End Sub
Function FilldgLog()
sDate = Date.Parse(DTPfrom.Text).ToString("MM'/'dd'/'yyyy")
eDate = Date.Parse(DTPto.Text).ToString("MM'/'dd'/'yyyy")
kom = New OleDbCommand
kom.Connection = kon
Call LoadRecord(da, dset, "tblSystemLog", "Select * from tblSystemLog
Where ActFDate>=#" & sDate & "# and ActFDate <= #" & eDate & "# order by
ActFDate DESC, ActTime DESC", dgLog)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
'kom.CommandText = "select * from where ActFDate >= #" & sDate & "#
and ActFDate <= #" & eDate & "# order by ActFDate DESC,ActTime DESC"
'kom.ExecuteNonQuery()
'da.Fill(dset, "tblSystemLog")
'dgLog.DataSource = dset.Tables("tblSystemLog")
lblRecFound.Text = "Record(s) found: " &
dset.Tables("tblSystemLog").Rows.Count
Call FormatdgLog()
Return True
End Function
Function FormatdgLog()
dgLog.ReadOnly = True
dgLog.Font = dgFont
dgLog.ForeColor = Color.Black
dgLog.ColumnHeadersDefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleCenter
dglog.Columns(0).HeaderText = "Logger"
dglog.Columns(1).HeaderText = "Activity"
dgLog.Columns(2).HeaderText = "Date"
dgLog.Columns(3).HeaderText = "Time"
dglog.Columns(0).Width = 150
dglog.Columns(1).Width = 380
dglog.Columns(2).Width = 80
dgLog.Columns(3).Width = 90
dgLog.Columns(3).DefaultCellStyle.Format = "hh:mm:ss tt"
Return True
End Function
“under security
Imports System.Data.OleDb
Public Class SetTimeLock
Dim m, s As String
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
Function CheckTimeLock()
sql = "select * from SetLockTime"
da = New OleDbDataAdapter(sql, kon)
ds = New DataSet
da.Fill(ds, "SetLockTime")
txtMinutes.Text =
ds.Tables("SetLockTime").Rows(0).Item("Minutes").ToString
txtSeconds.Text =
ds.Tables("SetLockTime").Rows(0).Item("Seconds").ToString
Return True
End Function
Function SaveTimeLock()
If Trim(txtMinutes.Text) <> "" And Trim(txtSeconds.Text) <> "" Then
If Val(txtMinutes.Text) <= 60 Then
If Val(txtMinutes.Text) >= 1 Then
sql = "update SetLockTime set Minutes='" & txtMinutes.Text
& "',Seconds='" & txtSeconds.Text & "'"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()
MsgBox("Setting of System lock duration successfull",
MsgBoxStyle.Information, "System Message")
Call Log()
Me.Close()
Else
MsgBox("System lock duration must be minimum of 1 minute",
MsgBoxStyle.Information, "System Message")
End If
Else
MsgBox("System lock duration must be maximum of 60 minutes",
MsgBoxStyle.Information, "System Message")
End If
Else
Republic of the Philippines
Cagayan State University
www.csu.edu.ph
Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
If Asc(e.KeyChar) = 13 Then
txtSeconds.Focus()
End If