CYBER EYE
ABSTRACT
The basic idea behind this project is to computerize the communication between
the reception section and the internal office. Security takes an important role in
almost all of the organizations. One portion of the security includes recording
information about the visitor, avoiding allowing of needless visitors etc. Cyber
Eye provides an efficient way of implementing the above security system.
Using this system, it is possible to send the information about the visitors to the
higher authority of the organization. The highlight of this project is, not only
sending a textual message, it is possible to send the snapshot of the visitor as an
image.
1
EXISTING SYSTEM:
The existing traditional system provides only a person-to-person
communication. The person who receives the visitor obtain information such as
name, whom to meet, coming from where and it is informed to the higher
authority. Based on the decision made by the higher authority the visitor is
allowed or not allowed. This kind of communication is still used by lower level
organizations.
PROPOSED SYSTEM:
Higher-level organizations use the intercom facility to communicate with
other portions of the organization. This system provides immediate passing and
receiving of information. In both the above cases, it is possible to pass and
record only the name and some additional information about the persons in a
text format. In addition, any bogus information given by the visitor cannot be
used for further future reference.
2
HARDWARE AND SOFTWARE REQUIREMENTS
HARDWARE REQUIREMENT:
Processor : Pentium III
RAM : 64 MB
Hard disk : 20 GB
Monitor : 16” Color Monitor
Keyboard : 108 Key Standard Keyboard
Mouse : Scroll Mouse
Web Camera
SOFTWARE REQUIREMENT:
Operating System : Windows 2000 (or) Higher
Package : Microsoft VisualStudio.NET
(Front End)
Database : Microsoft SQL Server
(Back End)
3
1. INTRODUCTION
1.1 PROBLEM
The existing traditional system provides only a person-to-person
communication. The person who receives the visitor obtain information such as
name, whom to meet, coming from where and it is informed to the higher
authority. Based on the decision made by the higher authority the visitor is
allowed or not allowed. This kind of communication is still used by lower level
organizations.
Higher-level organizations use the intercom facility to communicate with
other portions of the organization. This system provides immediate passing and
receiving of information. In both the above cases, it is possible to pass and
record only the name and some additional information about the persons in a
text format. In addition, any bogus information given by the visitor cannot be
used for further future reference.
4
1.2 SOFTWARE TOOL
We have used the following software tools in developing our project,
Microsoft Visual Basic.Net
Microsoft SQL Server
Microsoft Visual Basic.Net
With its release for the .NET platform, the Visual Basic language has
undergone dramatic changes.
For example:
• The language itself is now fully object-oriented.
• Applications and components written in Visual Basic .NET have full
access to the .NET Framework, an extensive class library that provides
system and application services.
• All applications developed using Visual Basic .NET run within a
managed runtime environment, the .NET common language runtime.
Visual Basic .NET is the next generation of Visual Basic, but it is also a
significant departure from previous generations. Experienced Visual Basic 6
developers will feel comfortable with Visual Basic .NET code and will
recognize most of its constructs. However, Microsoft has made some changes to
make Visual Basic .NET a better language and an equal player in the .NET
world. These include such additions as a Class keyword for defining classes and
an Inherits keyword for object inheritance, among others. Visual Basic 6 code
can't be compiled by the Visual Basic .NET compiler without significant
modification. The good news is that Microsoft has provided a migration tool to
handle the task.
5
Microsoft SQL server
Microsoft SQL server lets you quickly build powerful and reliable
database applications. SQL server 7.0 highly scalable, fully relational, high
performance, multi-user database server. That can be used by enterprise of any
size to manage large amount of data for client\server applications.
The major new and improved features of SQL server 7.0 include the
multi-user support Multi platform support, added memory support, scalability,
integration with MMC, Microsoft Management console and improved multiple
server management. Parallel database backup and restore. Data replication, Data
warehousing distributed queries, distributed transactions, Dynamic cocking
Internet Access, Integrated windows security, Mail integration Microsoft
English Query, ODBC Support.
SQL Server management is accomplished through a set of component
applications. SQL Server introduces a number of new and improved
management tools that are SQL Server Enterprise management, profiles, and
Query Analyzer service manager wizards.
6
2. PROBLEM STATEMENT
Cyber Eye can be used an alternate for the existing system. It stores the
snapshot of the visitor as an image file, along with the textual information. So, it
can be used for future reference. Based on the organization storing of
information can be customized so that information can be periodically deleted.
Cyber Eye can be established and worked only in a network. It needs a
minimum of two systems that is connected through network. One system is
installed in the reception, along with Camera as an additional device. The
snapshot of the visitor is taken through the Web Camera and it is send to
another system which is usually kept on the table of the higher authority, along
with additional information about the visitor such as name, coming from where
etc. The higher authority then takes decision as per his/her willing, whether to
allow the visitor or not. The receptionist allows or not allows the person based
on the decision taken by the higher authority.
It is not only a security system, which passes information to the higher
authority. It also stores the information about the visitor for future reference.
This is a generalized project so that it can be used in any organization like
factories, offices and colleges etc.
7
3. METHODOLOGY
We have technology concepts to implement this project. We use crystal
reports to create reports retrieving it from the database. The inheritance
concepts for reusing the invoked methods are been implemented. Other than this
various object oriented concepts are also included. Several modules are been
developed for doing these functionalities as explained below Some of the
database storing and retrieving concepts are also included in the project
The query is put to the database and the intelligent search gives the
response perfectly to the user. The person who queries the database selects the
appropriate response and delivers to each customer.
Incremental model is the software development technique used for the
development of this project. At initial stages of the project a sample model with
the basic and primary functions was developed. Then the additional
functionalities were added and gradually the application was built. The model
was evolved stage by stage and based on the facts and view gathered from the
reviews in every incremental stage of the project. This method was adopted due
to its greater flexibility for managing dynamicity involved with the application
deployment. And this is the main objective that our methodology is all about.
8
4. PROBLEM DESCRIPTION
The Project entitled “Cyber Eye” has eight modules. They are
1. Login
2. User Manager
3. Dispatcher
4. Receiver
5. Visitor Information
6. User List
7. Send Message
Login
Since the system has been developed as a multi user one, only authorized
users can logon to the system. Existing users enter username and password, and
click on Login button. After verifying the information with user info table any
one of the following will occur.
If the username is “Cymin” then the Dispatcher screen must be
opened. Also the Visitor Information screen must be opened.
If the username is other than “Cyber eye” then Receiver screen
must be opened.
When a user has logged in, then his/her information such as
username, system name, login time etc must be added as a new
record in Log Details table.
In order to create new users Sign Up button must be clicked. Only
“Cymin” user can able to create new users. When clicking on Sign Up button,
after checking whether it is “Cymin” user and its password, User Manager
Screen must be opened.
9
Note that, the “Cymin” user must already exist in the table. Other users
can be created by “Cymin” user.
User Manager
Previously mentioned, only “Cymin” user can able to create new users.
By supplying the user name “Cymin” and its password the user has to click on
Sign Up button. The User Manager screen must be opened. It contains the
following process
New User Creation
Username must be unique
After supplying the other details, Submit button must be clicked.
The details must be stored in User Info table.
Also for the user, xxx Visitor Info and xxx Current Visitor table must
be created. For e.g. if the username is Rao then Rao Visitor Info and
Rao Current Visitor table must be created.
User Modification
User name must be selected from the combo box which is already
built using username field from the User Info table.
After modifying values Modify button must be clicked.
Values must be updated in User Info table.
User Deletion
User name must be selected from the combo box which is already
built using User Name field from the User Info table.
When clicking on Delete button, after confirmation from the user the
selected user details must be deleted from the table User Info and also
the related tables must be deleted.
Dispatcher
10
Used to take a snap shot image of the visitor and to send it to the
corresponding person. Used by the reception/security section. It contains the
following process
On Clicking Snap button it must receive the image of the visitor
through camera.
Other information must be filled.
From whom to meet combo box the person to meet is selected. This
combo box is already built with contents from Log Details table.
When clicking on Send button the following must be done:
1. A filename must be generated automatically to store the image. The image
file must be stored in a separate location and the path of the image must be
stored in table.
2. The information must be stored in the tables xxx Visitor Info, xxx Current
Visitor and Visitor Info. xxx stands for the name, selected from whom to
meet combo box.
3. A notification must be sent to the person whom the visitor wants to meet.
4. If the table xxx Current Visitor already has a record, then it means that the
particular used didn’t receive the previously sent information. In this case the
information must not be sent.
5. Also if the person is busy the information should not be send. It is already
identified when the person click on Disable button, from the Receiver
screen.
Clicking on Hide button must hide the image.
Clicking on Clear button must clear the contents of all the controls.
Clicking on New button must clear the contents and place the current
date and time on the date and in time boxes respectively.
Clicking on Send Message button opens the Send Message screen,
which is used to send message to the other users on the network.
11
Clicking on User List shows list of user information, so that
reception/security section operator can able to know the user name of
all the persons in the organization.
On clicking Logout button the Dispatcher screen must be closed. Also
after confirmation from the user the Visitor Info table contents must
be deleted.
xxx Visitor Info table is a permanent one, and used for future
reference.
xxx Current Visitor table is used to temporarily store the information.
This is used by the Receiver screen.
Visitor Info holds the visitor information only for the current day.
That is on the end of the day Visitor Info table contents must be
deleted.
Receiver
Used by the client systems, to receive information of the visitors from the
reception/security section. It contains the following process
When receiving notification from the reception/security section, the user
has to click on Receive button.
When clicking on Receive button the following must be done:
1. Information must be obtained from the xxx Current Visitor table
and placed in the specified controls. Here xxx stands for the current
Receiver screen user name.
2. Also the image file path must be obtained and the image must be
read and placed in the specific control.
3. The record from the table xxx Current Visitor must be deleted.
After typing the response, the user has to click Notify button. It must
update the necessary fields in the xxx Visitor Info and Visitor Info table.
Clicking on Hide button must hide the image.
12
Clicking on Clear button must clear the contents of all the controls.
Clicking on Logout closes the Receiver screen. When closing it must
update the Logout Time field in Log Details table.
Clicking on Waiting List button shows list of visitor waiting for meet that
person.
Clicking on Send Message button opens the Send Message screen, which
is used to send message to the reception/security section or other users on
the network.
Clicking on Disable disables receiving of visitor information from the
reception/security section, indicating that the person was busy. Also the
button caption changed to enable. When clicking on Enable it enables
receiving of visitor information and caption must be changed to disable.
Visitor Information
Used by the reception/security section, to view the visitor information. It
must display the information such as visitor name, whom to meet, in time etc
from the table Visitor Info. It contains the following process
When departure of a visitor the out time and visited (Yes/No) controls
must be filled.
Then when clicking on Update button the tables Visitor Info and xxx
Visitor Info must be updated with the values out time and visited.
Clicking on Refresh refreshes the display.
User List
Used to list of the user information. This screen is activated from the
Dispatcher screen. It contains the following process
13
When opened shows the information of users. Information is taken
from the table User Info.
Send Message
Used to send messages between the persons on the network. It contains
the following process
The recipient must be selected from the combo box whom to send. It
is already built using the table Log Details.
Message must be typed and when clicking on Send it must be send to
the particular user who is in online.
6. SYSTEM ANALYSIS AND DESIGN
6.1 DATA COLLECTION
14
We had collected various types of data that is to be used with in the
project. First we had collected the statistical data about the software to develop
the project, so that the methods and concepts involved matches with the project.
Next we had done the actual data collection for updating in the database and to
build efficient database. Data from all sort of computer related topics are been
obtained from various books and websites. We had developed our software for a
generalized purpose.
6.2 FLOW CHART
15
Start
Receiver Screen
Dispatcher Screen
Login
Get Visitor Details
Exit
Update Database
Send Details Receive Visitor Details
Option
Send Response
Receive Response
Update Database
Logout Logout
6.3 FEASIBILITY STUDY
16
Feasibility Study is conducted to sea if the proposed system is a feasible one
with all respects. Feasibility Study is lot of the system proposal according to its
workability impact of the organization, ability to meet uses need and effective use of
resources. There are three main aspects in the feasibility study.
Technical Feasibility:
Technical feasibility centers on the existing system and to the
extent it can support the proposed system. The design of the cyber eye is in such
a way that it can be easily managed. If budget is not a serious constraint then the
project is judged technically feasible.
The system is assigned to fit the available software the hard ware. Visual
Basic.NET a Graphical User Interface meets the software Requirement.
VB.NET has more controls which facilitates the creation of user-friendly
screens. VB.NET also feasible and can meet any expansion or revision of this
system in future.
Operational Feasibility:
An operationally feasible system is one that will be used
effectively after it has been developed. If users have difficulty with a new
system, it will not produce the expected benefits. The proposed system is found
to be operationally feasible because of the following reasons. It needs only one
person in the reception section. There is no difficulty in using the front end
which has been developed. Even the users who don’t have any knowledge in
computers the user friendliness provides them convenience and case. The
system is designed, in such a way that not only the person currently handling
this work can operate the system but a person who is new to the system with
case. Hence this system is found to be operationally feasible.
Economic Feasibility:
17
In economic feasibility cost/benefit analysis is done. Here we
determine the benefits and time savings that are expected from the system and
compare them with cost. The proposed system is economically feasible. Since
the cost of the system is only the implementation cost of the system. There is no
need spend any monthly there after. The web cam needed is available at the
least possible cost at the same time reliable. Since benefits outweigh the cost. It
is economically feasible.
6.5 DATA BASE DESIGN
18
A database is a set of related data. It provides flexibility in the storage
and retrieval of data and production of information while designing a database
there are many things to be taken care of. Data shouldn’t be redundant and it
shouldn’t be in consistent. After storing data in the database there should be any
difficulty in accessing data. The data should be secured. Above all the database
should be normalized.
NORMALIZATION:
Normalization is a process of simplifying the relationship between
data elements in a record. Through normalization a collection of the data in a
record structure is replaced by successive record structures that are simple and
more predictable and therefore move manageable.
NEED FOR NORMALIZATION:
To structure the data so that any pertinent relationships
between entities can be represented.
To permit simple retrieval of data in response to query and
report requests.
To simplify the maintenance of the data through updates,
insertions and deletions.
NORMALIZATION IN THE PROPOSED SYSTEM:
In the proposed system, normalization is achieved. The system is
normalized to first and second Normal form.
First Normal Form:
19
First normal form is achieved by removing all repeating groups. So
that a record of fixed length. The repeating group is removed and a separate file
or relation containing the repeating group is created. The original records and
the new records are interrelated by a common data item. In the proposed system
first normal form is achieved.
Second Normal Form:
Second normal form is achieved when a record is in first normal
form and each item in the record is fully dependent on the primary record key
for identification. In other words function dependency should be achieved i.e. a
data item is functionally dependent it‘s value is uniquely associated with a
specific data item. In a proposed system the data items in the relation details are
dependent on the visitor-id, which is primary key. Thus, normalization is
achieved in the proposed system. It contains the following tables
Table Design
20
Column name Data Type Length Allow Nulls
Username varchar 20 SystemName varchar 200 LoginDate varchar 15 LoginTime varchar 15 Logout Time varchar 15
Table 6.5.1 Log Details
Column Name Data Type Length Allow NullVisitorID Numeric 5 VisitorName varchar 50 Address varchar 200 Company varchar 50 Designation varchar 50 Purpose varchar 100 Remarks varchar 250 VisitorImage Image 16
Table 6.5.2 RameshCurrentVisitor
Column name Data Type Length Allow NullUserName varchar 20 Password varchar 20 FullName varchar 50 Department varchar 20 Designation varchar 50 Remarks varchar 200
Table 6.5.3 User Info
21
Column name Data Type Length Allow NullsVisitorID Numeric 9 VisitorName Varchar 50 Address Varchar 200 ContactNo Varchar 20 Company Varchar 50 Designation Varchar 50 Purpose Varchar 100 InDate Datetime 8 InTime Varchar 15 OutTime Varchar 15 Remarks Varchar 100 WhomToMeet Varchar 20 Response Varchar 100 Visited Varchar 1 VisitorImage Image 16
Table 6.5.4 Visitor Info
8. CONCLUSION AND FUTURE ENHANCEMENT
22
7.1 CONCLUSION
Thus the communication between the receptionist and the internal
officers were computerized through Cyber Eye Software. The visitor Records
are stored in the Database for future reference. The Crystal reports are generated
based on the Visitor Information.
7.2 FUTURE ENHANCEMENT
In Future we develop this software to store the conversation between the
visitor and the internal officer as a video streams and also we may change the
communication between the reception section and the internal office as a
wireless communication.
8. REFERENCES
23
BOOKS:
1. Alistair McMonnies, “Object-oriented programming in Visual
Basic.NET”, Pearson Education, and ISBN: 81-297-0649-0, First Indian
Reprint 2004.
2. Jittery R.Shapiro, “The Complete Reference Visual Basic .NET”
Edition 2002, Tata McGraw-Hill, Publishing Company Limited, New
Delhi.
3. Robert D.Schneider, Jettey R.Garbus, “Optimizing SQL Server”,
Second Edition, Pearson Education Asia, ISBN: 981-4035-20-3
WEBSITES:
1. http://www.microsoft.com/dotnet/visual basic
2. http://www.dotnetheaven.com
SOURCE CODE
24
Form login
Imports System.Data.SqlClient
Public Class frmLogin
Inherits System.Windows.Forms.Form
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnClose.Click
End
End Sub
Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLogin.Click
Dim formDispatcher As New frmDispatcher()
Dim formReceiver As New frmReceiver()
Dim formSystemTray As New frmSystemTray()
Dim rdrLogin As sqlDataReader
Dim cmdLogin As New sqlcommand("", conCE)
Dim cmdLogDetails As New SqlCommand("", conCE)
Dim strQuery As String
strQuery = "select * from UserInfo where Username='" &
Trim(txtUserName.Text) & "' and Password='" &
txtPassword.Text & "'"
cmdLogin.CommandText = strQuery
rdrLogin = cmdLogin.ExecuteReader
If rdrLogin.Read Then
rdrLogin.Close()
USERNAME = Trim(txtUserName.Text)
strQuery = "insert into LogDetails values ('" &
txtUserName.Text & "','" & Environment.MachineName & "','" &
DateTime.Now.Day & "/" & DateTime.Now.Month & "/" &
25
DateTime.Now.Year & "','" & DateTime.Now.Hour & ":" &
DateTime.Now.Minute & "','-')"
cmdLogDetails.CommandText = strQuery
cmdLogDetails.ExecuteNonQuery()
If Trim(txtUserName.Text) = "cybereye" Then
formDispatcher.Visible = True
formSystemTray.Show()
Else
formReceiver.Visible = True
End If
Me.Visible = False
Else
MessageBox.Show("Username/Password error", "Error",
MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
rdrLogin.Close()
End Sub
Private Sub btnAdmin_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles bnAdmin.Click
Dim rdrAdmin As SqlDataReader
Dim cmdAdmin As New SqlCommand("", conCE)
Dim strQuery As String
Dim formSystemTray As New frmSystemTray()
Dim formDispatcher As New frmDispatcher()
Dim formReceiver As New frmReceiver()
26
strQuery = "select * from UserInfo where Username='" &
Trim(txtUserName.Text) & "' and Password='" & txtPassword.Text & "'"
cmdAdmin.CommandText = strQuery
rdrAdmin = cmdAdmin.ExecuteReader
If rdrAdmin.Read Then
If Trim(txtUserName.Text) = "cybereye" Then
Me.Visible = False
formSystemTray.Show()
Else
MessageBox.Show("No administrator permission", "Error",
MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Else
MessageBox.Show("Username/Password error", "Error",
MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
rdrAdmin.Close()
End Sub
Private Sub frmLogin_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call ConnectDatabase()
End Sub
End Class
Form dispatcher
Imports System.IO
Imports Scripting
27
Imports System.Data.SqlClient
Public Class frmDispatcher
Inherits System.Windows.Forms.Form
Dim IMAGEFILEPATH As String = ""
Dim strImageFile As String
Private Sub frmReceiver_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If MessageBox.Show("Are you sure to close Cyber Eye?", "Close",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) =
DialogResult.No Then
e.Cancel = True
Else
Call Logout()
End
End If
End Sub
Private Sub frmDispatcher_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
End
End Sub
Private Sub btnSendMessage_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnSendMessage.Click
Dim formSendMessage As New frmSendMessage()
formSendMessage.Show()
End Sub
28
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnClear.Click
Call Clear()
End Sub
Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSend.Click
Dim cmdCurrentVisitor As New SqlCommand("", conCE)
Dim rdrCurrentVisitor As SqlDataReader
Dim cmdVisitorInfo As New SqlCommand("", conCE)
Dim rdrVisitorInfo As SqlDataReader
Dim strQuery As String
Dim stmFile As FileStream
Dim intLength As Integer
Dim strFile As String
Dim intVID As Integer
Try
'Generating VisitorID
cmdVisitorInfo.CommandText = "select Max(VisitorID) from
VisitorInfo"
cmdVisitorInfo.Connection = conCE
rdrVisitorInfo = cmdVisitorInfo.ExecuteReader
Try
If rdrVisitorInfo.Read Then
intVID = rdrVisitorInfo.Item(0)
Else
intVID = 0
End If
29
rdrVisitorInfo.Close()
Catch
rdrVisitorInfo.Close()
intVID = 0
End Try
intVID = intVID + 1
'Checking for existing record available
strQuery = "select * from " & cboWhomToMeet.Text &
"CurrentVisitor"
cmdCurrentVisitor.CommandText = strQuery
rdrCurrentVisitor = cmdCurrentVisitor.ExecuteReader
If rdrCurrentVisitor.Read Then
MessageBox.Show("Receiver is busy. Unable to send",
"Send", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
rdrCurrentVisitor.Close()
strQuery = "insert into " & cboWhomToMeet.Text
& "CurrentVisitor (VisitorID, VisitorName, Address,
Company, Designation, Purpose, Remarks) values (" &
intVID & ",'" & txtVisitorName.Text & "','" &
txtAddress.Text & "','" & txtCompany.Text & "','" &
txtDesignation.Text & "','" & txtPurpose.Text & "','" &
txtRemarks.Text & "')"
cmdCurrentVisitor.CommandText = strQuery
cmdCurrentVisitor.ExecuteNonQuery()
30
cmdCurrentVisitor.CommandText = "update " &
cboWhomToMeet.Text & "CurrentVisitor set
VisitorImage=@img1 where VisitorID=" & intVID
'Getting image from file
strFile = Environment.CurrentDirectory & "\Visitor.jpg"
Dim f As New FileStream(strFile, FileMode.Open)
Dim br As New BinaryReader(f)
Dim buf As Byte()
buf = br.ReadBytes(f.Length - 1)
cmdCurrentVisitor.Parameters.Add("@img1", buf)
cmdCurrentVisitor.ExecuteNonQuery()
strQuery = "insert into VisitorInfo (VisitorID, VisitorName,
Address, ContactNo, Company, Designation, Purpose, InDate,
InTime, OutTime, Remarks, WhomToMeet, Response, Visited)
values (" & intVID & ",'" & txtVisitorName.Text & "','" &
txtAddress.Text & "','" & txtContactNo.Text & "','" &
txtCompany.Text & "','" & txtDesignation.Text & "','" &
txtPurpose.Text & "','" & Format(dtpInDate.Value, "M/d/yyyy") &
"','" & txtInTime.Text & "','-','" & txtRemarks.Text & "','" &
cboWhomToMeet.Text & "','-','N')"
cmdVisitorInfo.CommandText = strQuery
cmdVisitorInfo.ExecuteNonQuery()
'Updating image into VisitorInfo
cmdVisitorInfo.CommandText = "update VisitorInfo set
VisitorImage=@img2 where VisitorID=" & intVID
cmdCurrentVisitor.Parameters.Add("@img2", buf)
cmdCurrentVisitor.ExecuteNonQuery()
31
MessageBox.Show("Send successfully", "Send",
MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
rdrCurrentVisitor.Close()
Catch exnBtnSend As Exception
MsgBox(exnBtnSend.Message)
End Try
End Sub
Private Sub Clear()
txtVisitorName.Text = ""
txtAddress.Text = ""
txtContactNo.Text = ""
txtCompany.Text = ""
txtDesignation.Text = ""
txtPurpose.Text = ""
txtInTime.Text = ""
txtRemarks.Text = ""
cboWhomToMeet.SelectedIndex = -1
End Sub
Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNew.Click
Call Clear()
txtInTime.Text = DateTime.Now.Hour & ":" &
DateTime.Now.Minute
End Sub
Private Sub BuildWhomToMeet()
Dim cmdWhomToMeet As New SqlCommand("", conCE)
32
Dim rdrWhomToMeet As SqlDataReader
Dim strQuery As String
strQuery = "select UserName from LogDetails where LoginDate='"
& DateTime.Now.Day & "/" & DateTime.Now.Month & "/" &
DateTime.Now.Year & "' and LogoutTime='-'"
cmdWhomToMeet.CommandText = strQuery
rdrWhomToMeet = cmdWhomToMeet.ExecuteReader
cboWhomToMeet.Items.Clear()
While rdrWhomToMeet.Read
cboWhomToMeet.Items.Add(rdrWhomToMeet.Item("UserName"))
End While
rdrWhomToMeet.Close()
End Sub
Private Sub frmDispatcher_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call BuildWhomToMeet()
End Sub
Private Sub btnSnap_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSnap.Click
Dim strImageFile As String
Dim fsoFile As New FileSystemObject()
dlgOpen.InitialDirectory = Environment.CurrentDirectory
If dlgOpen.ShowDialog = DialogResult.OK Then
strImageFile = dlgOpen.FileName
fsoFile.CopyFile(strImageFile, Environment.CurrentDirectory &
"\Visitor.jpg")
Try
pctSnap.Image = Image.FromFile(strImageFile)
33
Catch
MessageBox.Show("Invalid image format", "Warning",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Try
End If
End Sub
Private Sub btnHide_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnHide.Click
If btnHide.Text = "Hide" Then
pctSnap.Image = Nothing
btnHide.Text = "Show"
ElseIf btnHide.Text = "Show" Then
Try
pctSnap.Image = Image.FromFile(strImageFile)
Catch
MessageBox.Show("Invalid image format", "Warning",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Try
btnHide.Text = "Hide"
End If
End Sub
End Class
Form receiver
34
Imports System.Threading
Imports System.IO
Imports System.Data.SqlClient
Public Class frmReceiver
Inherits System.Windows.Forms.Form
Dim blnReceiveMessage As Boolean = True
Dim thdListen As New Thread(AddressOf Listen)
Dim rdrListen As SqlDataReader
Dim blnFire As Boolean = False
Dim conThread As SqlConnection
Dim VISITORID As Integer
Dim formHelpReceiver As frmHelpReceiver
Private Sub frmReceiver_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If MessageBox.Show("Are you sure to close Cyber Eye?", "Close",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) =
DialogResult.No Then
e.Cancel = True
Else
Call Logout()
End
End If
End Sub
Private Sub btnHelp_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnHelp.Click
formHelpReceiver = New frmHelpReceiver()
formHelpReceiver.Visible = True
35
End Sub
Private Sub frmReceiver_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
ConnectDatabase()
ConnectThreadDatabase()
thdListen.Start()
End Sub
Private Sub Listen()
While True
strQuery = "select * from " & USERNAME & "CurrentVisitor"
cmdListen.CommandText = strQuery
rdrListen = cmdListen.ExecuteReader
If rdrListen.Read Then
Beep()
btnReceive.Enabled = True
End If
rdrListen.Close()
End While
blnFire = True
End Sub
Private Sub btnReceive_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnReceive.Click
Dim rdrReceive As SqlDataReader
Dim cmdReceive As New SqlCommand("", conCE)
Dim strQuery As String
thdListen.Suspend()
36
rdrListen.Close()
ConnectDatabase()
strQuery = "select VisitorID, VisitorName, Address,
Company, Designation, Purpose, Remarks, VisitorImage as
ImageData from " & USERNAME & "CurrentVisitor"
cmdReceive.Connection = conCE
cmdReceive.CommandText = strQuery
rdrReceive =
cmdReceive.ExecuteReader(CommandBehavior.SequentialAccess)
If rdrReceive.Read Then
VISITORID = rdrReceive("VisitorID")
txtVisitorName.Text = rdrReceive.Item("VisitorName")
txtAddress.Text = rdrReceive.Item("Address")
txtCompany.Text = rdrReceive.Item("Company")
txtDesignation.Text = rdrReceive.Item("Designation")
txtPurpose.Text = rdrReceive.Item("Purpose")
txtRemarks.Text = rdrReceive.Item("Remarks")
'Getting Image
Dim fs As FileStream
Dim bw As BinaryWriter
Dim bufferSize As Integer = 100
Dim outByte(bufferSize - 1) As Byte
Dim retVal As Long
Dim startIndex As Long = 0
Dim pub_id As Integer
fs = New FileStream(Environment.CurrentDirectory & "\" &
txtVisitorName.Text & ".jpg", FileMode.OpenOrCreate,
FileAccess.Write)
bw = New BinaryWriter(fs)
37
startIndex = 0
retVal = rdrReceive.GetBytes(7, startIndex, outByte, 0,
bufferSize)
Do While retVal = bufferSize
bw.Write(outByte)
bw.Flush()
startIndex = startIndex + bufferSize
retVal = rdrReceive.GetBytes(7, startIndex, outByte, 0,
bufferSize)
Loop
bw.Write(outByte)
bw.Flush()
bw.Close()
fs.Close()
pctVisitorImage.Image =
Image.FromFile(Environment.CurrentDirectory & "\" &
txtVisitorName.Text & ".jpg")
End If
rdrReceive.Close()
'Deleting the record after receiving it
strQuery = "delete from " & USERNAME & "CurrentVisitor"
cmdReceive.CommandText = strQuery
cmdReceive.ExecuteNonQuery()
btnReceive.Enabled = False
thdListen.Resume()
'thdListen = New Thread(AddressOf Listen)
'thdListen.Start()
End Sub
38
Private Sub ConnectThreadDatabase()
Try
'conCE = New
SqlConnection("Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=False;Initial
Catalog=CyberEye;Data Source=CHOLAN;")
conThread = New SqlConnection("data source=ada133;initial
catalog=database;integrated security=SSPI;persist security
info=False;workstation id=ada133;packet size=4096")
conThread.Open()
Catch exnConnectDatabase As Exception
MsgBox(exnConnectDatabase.Message)
End Try
End Sub
Private Sub btnLogout_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLogout.Click
If MessageBox.Show("Are you sure to logout and close Cyber Eye?",
"Close", MessageBoxButtons.YesNo, MessageBoxIcon.Question) =
DialogResult.Yes Then
Call Logout()
End
End If
End Sub
End Class
Form user manager
39
Imports System.Data.SqlClient
Public Class frmUserManager
Inherits System.Windows.Forms.Form
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAdd.Click
Dim strUserName As String
Dim intIndex As Integer
Dim cmdUser As New SqlCommand()
Dim strQuery As String
'Check whether user already exists
strUserName = cboUserName.Text
If cboUserName.FindString(strUserName) <> -1 Then
MessageBox.Show("Username already exists", "User Creation",
MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
strQuery = "insert into UserInfo values('" & cboUserName.Text & "','" &
txtPassword.Text & "','" & txtFullName.Text & "','" & txtDepartment.Text
& "','" & txtDesignation.Text & "','" & txtRemarks.Text & "')"
cmdUser.CommandText = strQuery
cmdUser.Connection = conCE
cmdUser.ExecuteNonQuery()
'Creating xxxCurrentVisitor table
strQuery = "Create table " & cboUserName.Text & "CurrentVisitor
(VisitorID numeric(9), VisitorName Varchar(50), Address Varchar(200),
Company Varchar(50), Designation Varchar(50), Purpose Varchar(100),
Remarks Varchar(250), VisitorImage Image)"
cmdUser.CommandText = strQuery
40
cmdUser.ExecuteNonQuery()
MessageBox.Show("User created successfully", "User Creation",
MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnClose.Click
Me.Close()
End Sub
Private Sub BuildComboUserName()
Dim cmdUserName As New SqlCommand()
Dim rdrUserName As SqlDataReader
cmdUserName.Connection = conCE
cmdUserName.CommandText = "Select UserName from UserInfo"
rdrUserName = cmdUserName.ExecuteReader
cboUserName.Items.Clear()
While rdrUserName.Read
cboUserName.Items.Add(rdrUserName.Item("UserName"))
End While
rdrUserName.Close()
End Sub
Private Sub frmUserManager_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
BuildComboUserName()
End Sub
Private Sub cboUserName_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles cboUserName.SelectedIndexChanged
Dim cmdUserName As New SqlCommand()
41
Dim rdrUserName As SqlDataReader
cmdUserName.Connection = conCE
cmdUserName.CommandText = "Select * from UserInfo where
UserName='" & cboUserName.Text & "'"
rdrUserName = cmdUserName.ExecuteReader
If rdrUserName.Read Then
txtPassword.Text = rdrUserName.Item("Password")
txtFullName.Text = rdrUserName.Item("FullName")
txtDepartment.Text = rdrUserName.Item("Department")
txtDesignation.Text = rdrUserName.Item("Designation")
txtRemarks.Text = rdrUserName.Item("Remarks")
End If
rdrUserName.Close()
End Sub
Private Sub btnModify_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnModify.Click
Dim cmdModify As New SqlCommand()
Try
cmdModify.CommandText = "update UserInfo set Password='" &
txtPassword.Text & "', FullName='" & txtFullName.Text & "',
Department='" & txtDepartment.Text & "', Designation='" &
txtDesignation.Text & "', Remarks='" & txtRemarks.Text & "' where
UserName='" & cboUserName.Text & "'"
cmdModify.Connection = conCE
cmdModify.ExecuteNonQuery()
MessageBox.Show("User modified successfully", "Modify",
MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch btnModify_Click As Exception
End Try
42
End Sub
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnDelete.Click
Dim cmdDelete As New SqlCommand()
Try
If MessageBox.Show("Are you sure to delete the user?", "Delete",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) =
DialogResult.Yes Then
cmdDelete.CommandText = "delete from UserInfo where UserName='"
& cboUserName.Text & "'"
cmdDelete.Connection = conCE
cmdDelete.ExecuteNonQuery()
cmdDelete.CommandText = "delete " & cboUserName.Text &
"CurrentVisitor"
MsgBox(cmdDelete.CommandText)
cmdDelete.ExecuteNonQuery()
MessageBox.Show("User deleted successfully", "Delete",
MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
Catch btnDelete_Click As Exception
MsgBox(btnDelete_Click.Message)
End Try
End Sub
End class
Form menu
43
Public Class frmMenu
Inherits System.Windows.Forms.Form
Public formReports As frmReports
Public formUserManager As frmUserManager
Public formSettings As frmSettings
Public formHelpDispatcher As frmHelpDispatcher
Private Sub UserManager_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles pctUserManager.Click, labUserManager.Click
formUserManager = New frmUserManager()
formUserManager.Visible = True '
End Sub
Private Sub Reports_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles pctReports.Click, labReports.Click
formReports = New frmReports()
formReports.Visible = True
End Sub
Private Sub Settings_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles pctSettings.Click, labSettings.Click
formSettings = New frmSettings()
formSettings.Visible = True
End Sub
Private Sub Help_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles pctHelp.Click, labHelp.Click
formHelpDispatcher = New frmHelpDispatcher()
formHelpDispatcher.Visible = True
End Sub
44
Private Sub UserManager_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles
pctUserManager.MouseMove, labUserManager.MouseMove
labUserManager.ForeColor = Color.OrangeRed
End Sub
Private Sub Reports_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles pctReports.MouseMove,
labReports.MouseMove
labReports.ForeColor = Color.OrangeRed
End Sub
Private Sub Settings_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles pctSettings.MouseMove,
labSettings.MouseMove
labSettings.ForeColor = Color.OrangeRed
End Sub
Private Sub Help_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles pctHelp.MouseMove,
labHelp.MouseMove
labHelp.ForeColor = Color.OrangeRed
End Sub
Private Sub frmMenu_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
labUserManager.ForeColor = Color.RoyalBlue
labReports.ForeColor = Color.RoyalBlue
labSettings.ForeColor = Color.RoyalBlue
45
labHelp.ForeColor = Color.RoyalBlue
End Sub
End Class
Form help receiver
Imports System.IO
Public Class frmHelpReceiver
Inherits System.Windows.Forms.Form
Private Sub lnkHowToLogin_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles lnkHowToLogin.Click
SetData("R_ONE.TXT")
End Sub
Private Sub lnkHowToReceiveVisitorInformation_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lnkHowToReceiveVisitorInformation.Click
SetData("R_TWO.TXT")
End Sub
Private Sub lnkHowToLogoutTheSystem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lnkHowToLogoutTheSystem.Click
SetData("R_THREE.TXT")
End Sub
Private Sub lnkHowToSendMessage_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles lnkHowToSendMessage.Click
SetData("R_FOUR.TXT")
End Sub
46
Private Sub lnkHowToShowWaitingList_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lnkHowToShowWaitingList.Click
SetData("R_FIVE.TXT")
End Sub
Private Sub SetData(ByVal strFile As String)
Dim stmReader As StreamReader
Dim strLine As String
Dim strContent As String
Try
rtbHelp.Text = ""
stmReader = New StreamReader(New
FileStream(Environment.CurrentDirectory & "\Help\" & strFile,
FileMode.Open))
strLine = stmReader.ReadLine
strContent = strLine
While strLine <> Nothing
strLine = stmReader.ReadLine
strContent = strContent & vbNewLine & strLine
End While
rtbHelp.Text = strContent
stmReader.Close()
Catch exnSetData As Exception
End Try
End Sub
End Class
Form help dispatcher
47
Imports System.IO
Public Class frmHelpDispatcher
Inherits System.Windows.Forms.Form
Private Sub lnkHowToLogin_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles lnkHowToLogin.Click
SetData("D_ONE.TXT")
End Sub
Private Sub lnkHowToCreateManageAnUser_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lnkHowToCreateManageAnUser.Click
SetData("D_TWO.TXT")
End Sub
Private Sub lnkHowToDispatchVisitorInfomation_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lnkHowToDispatchVisitorInfomation.Click
SetData("D_THREE.TXT")
End Sub
Private Sub lnkHowToLogoutTheSystem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lnkHowToLogoutTheSystem.Click
SetData("D_FOUR.TXT")
End Sub
48
Private Sub lnkHowToEntryVisitorsVisitedStatus_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lnkHowToEntryVisitorsVisitedStatus.Click
SetData("D_FIVE.TXT")
End Sub
Private Sub lnkHowToGenerateReports_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles lnkHowToGenerateReports.Click
SetData("D_SIX.TXT")
End Sub
Private Sub lnkHowToSendMessage_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles lnkHowToSendMessage.Click
SetData("D_SEVEN.TXT")
End Sub
Private Sub lnkHowToShowUserList_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles lnkHowToShowUserList.Click
SetData("D_EIGHT.TXT")
End Sub
Private Sub SetData(ByVal strFile As String)
Dim stmReader As StreamReader
Dim strLine As String
Dim strContent As String
Try
rtbHelp.Text = ""
stmReader = New StreamReader(New
FileStream(Environment.CurrentDirectory & "\Help\" & strFile,
FileMode.Open))
49
strLine = stmReader.ReadLine
strContent = strLine
While strLine <> Nothing
strLine = stmReader.ReadLine
strContent = strContent & vbNewLine & strLine
End While
rtbHelp.Text = strContent
stmReader.Close()
Catch exnSetData As Exception
End Try
End Sub
End Class
Database module code
Imports System.Data.SqlClient
Module modGlobals
Public conCE As SqlConnection
Public USERNAME As String
Public Sub ConnectDatabase()
Try
'conCE = New
SqlConnection("Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=False;Initial Catalog=database;Data
Source=ada133")
50
conCE = New SqlConnection("data source=ada133;initial
catalog=database;integrated security=SSPI;persist security
info=False;workstation id=ada133;packet size=4096")
conCE.Open()
Catch exnConnectDatabase As Exception
MsgBox(exnConnectDatabase.Message)
End Try
End Sub
Public Sub Logout()
Dim cmdLogout As New SqlCommand("", conCE)
cmdLogout.CommandText = "Update LogDetails set LogoutTime='" &
System.DateTime.Now.Hour & ":" & System.DateTime.Now.Minute & ":"
& System.DateTime.Now.Second & "' where LogoutTime='-' and
UserName='" & USERNAME & "'"
cmdLogout.ExecuteNonQuery()
End Sub
End Module
51
System tray
Public Class frmSystemTray
Inherits System.Windows.Forms.Form
Private Sub shtExit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles shtExit.Click
End
End Sub
Private Sub shtOpen_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles shtOpen.Click
Dim formMenu As New frmMenu()
formMenu.Show()
End Sub
Private Sub frmSystemTray_Activated(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Activated
Me.Visible = False
End Sub
Private Sub nfySystemTray_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles
nfySystemTray.MouseDown
If e.Button = MouseButtons.Right Then
End If
End Sub
End Class
52
SCREENS :
Fig 7.1 Dispatcher Login
53
Fig 7.2 Dispatcher Screen
54
Fig 7.3 Dispatcher Confirmation Screen
55
Fig 7.4 Receiver Login Screen
56
Fig 7.7 Dispatcher View Response
57
58
59
60
61
62