This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Table of ContentsIntroduction..........................................................................................................................3
Work Breakdown Structure...........................................................................................68
2
Introduction
There is a lot of different parking system in the world whereby our objective of
the whole project is to produce a different type of parking system for the management of
UCTI as the construction of a three storey car park has completed which can
accommodate 90 cars in total and each level would have 30 parking spaces. Students
would be able to rent a parking lot by using this parking system. Each of the group
members Eugene Chan Zhirong, Foo Shu Ying and Lim Yi Sing has their own task of
work.
This includes producing the registration system to handle the registration of
students for each available car park for each semester by registering their student ID, car
number, and date of registration and so on. After that, we would also need to set the
duration of the car park for the student to park at their particular spot for 150 days by
locating the parking space ID. Each student’s information would be stored in a database
table created by us using Visual Basic framework and SQL database structure. By
creating the database, we would also create relationships between each of the different
tables which include students, parking spaces as well as users. This parking system would
be used by the parking administrative office to register students who wishes to park at the
car park.
3
Screen Designs
Input Designs
4
5
6
7
8
9
10
11
12
13
Output Screen Design
Multiple Document Interface (MDI) form
Login page
14
Forgotten Password
Parking lot condition Level 1 – Level 3
15
Admin Editor
New admin register
16
Password changer
New Student Registration
17
Update and delete information
Search Student form
18
About the application
Crystal Reporter
19
User Manual
User Login
First of all, user would need to go through the login page in order to log into the
application main page. The initial first start-up of the program should be empty database.
User will need to register in order to login. If the database is empty and there are no
registered users in the database, the login page would be as follow:
As shown in the above picture, the “Cancel” button would automatically be
changed to “Register” button. After the first user register, the first registered user would
be automatically assigned as the Admin.
20
User Register
It is advisable to complete the recruitment system before starting the access of the
system. Recruitment can be done by clicking the add button and fill in the information
specified. Once the users clicked save, the information that input by the user will store
into the database.
Please note that only administrator has the right to access the staff registration and
check it. You may also browse through the record and update the record that has been
outdated or delete the information that is no longer needed.
21
Forget Password
If the user forgotten his/her password, the user are allowed to click on the
“Forgotten Username/Password”, and then the user are allow to input his/her email
address. After that, an email will be send to the individuals email.
22
Change Password
Password changing for the admin user is possible in this application. If the current
user wants to change his/her password, the user would only need to go to the toolbar and
choose admin control to change password. However, if the user wants to change the other
user password, the current would need to go to the admin control and choose edit all
admin, after that, he/she would need to click on set password in order to change, but that
doesn’t mean the user are allow to change the password straight away, he/she would need
to input the old password first and then input the new password in order to change.
23
Admin Edit
As for editing the admin, user are allow to edit the admin through the toolbar and
choosing “Edit all admin”, after that, a window will pop up as “AdminEdit”. In this
window, users are allowed to add new user, edit user and delete the user. However, the
current user would not be able to delete his/her record as the admin or moderator.
24
Student Register
Before you are able to make any registration, you must first choose the parking lot
from the MDI, and then input all the information of the student including Student ID,
First Name, Last Name, Contact Number, E-mail Address and Car Number. After that,
only the student would be able to register.
25
Search
Users are allowed to search the students registered through the database by using
the search form as shown above in order to update the details. User would need to only
input the Student ID of the student, then all the details of the student would be shown in
the group box.
26
Update/Delete
When user want to update the student information, user can update here. User just
need to click the update button, then can update the student information. Besides, user
just clicks the delete button, and then the student information will be deleted.
27
Delete Expired User
When the user is expired, we will use this function to delete it. This is because we
don’t want waste the database space. This can save the database space. When we found
that the database has expired user, we will delete it.
28
Critical Assessment
In our new system, we realize that problem in our new system does exists. One of
the major problems would be the crystal report. All works well when running the
program on the development machine but when the program is deployed to another
computer, the crystal report will not be able to generate. We had tried to solve this
problem, but it seems that there were no solutions to solve this problem.
29
Conclusion
As for our conclusion, we had found that Visual Basic is a very well organized
application. We had learned a lot during producing the parking system using Visual
Basic. As we are the learners of using Visual Basic, we found that in the programming
world, it’s all about creating a program that is stable. However, error do occurs during the
process of creating the program, but we had gone through lots of havocs and trying to
resolve each of the problems that occur during the producing time. It is a very good
experience for us to produce such a program with all our hard work.
30
Printout of the Source Code
Splash Screen
Public NotInheritable Class SplashScreen1 'TODO: This form can easily be set as the splash screen for the application by going to the "Application" tab ' of the Project Designer ("Properties" under the "Project" menu). Private Sub SplashScreen1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'Set up the dialog text at runtime according to the application's assembly information. 'TODO: Customize the application's assembly information in the "Application" pane of the project ' properties dialog (under the "Project" menu). 'Application title If My.Application.Info.Title <> "" Then ApplicationTitle.Text = My.Application.Info.Title Else 'If the application title is missing, use the application name, without the extension ApplicationTitle.Text = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName) End If 'Format the version information using the text set into the Version control at design time as the ' formatting string. This allows for effective localization if desired. ' Build and revision information could be included by using the following code and changing the ' Version control's designtime text to "Version {0}.{1:00}.{2}.{3}" or something similar. See ' String.Format() in Help for more information. ' ' Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor, My.Application.Info.Version.Build, My.Application.Info.Version.Revision) Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor) 'Copyright info Copyright.Text = My.Application.Info.Copyright End Sub Private Sub SplashScreen1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing 'Hold the form on screen approximately 5 second before closed System.Threading.Thread.Sleep(7000) End Sub Private Sub ApplicationTitle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ApplicationTitle.Click End SubEnd Class
31
32
User Login
'Project: Login Form for Car Park registration system'Programmer: Spencerlim'Date Finish: 26 September 2010'Status: Stable and Running Well (DONE)'Description: This program will allow user to login Apiit Car Park System;Navigate to Register new admin form and Forgotten username/password form' In case of wrond match of username and password, the application will shut down immediately' When user forget password or username , there is a link will open up the form of forgotten U.P. ' When validation successful, user allowed to enter SystemImports System.Data.OleDbPublic Class Login Dim cnn As OleDbConnection Dim cmd As OleDbCommand Dim dr As OleDbDataReader Dim str As String Private Sub Login_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing 'prompt confirmation with message alert sound when the program closing MessageBeep(AlertExclamation) Dim ConfirmExit As New MisCode Dim answer As String answer = ConfirmExit.ConfirmExit If answer = False Then 'if not close then clear all box e.Cancel = True txtPassword.Clear() With txtUsername .Clear() .Focus() End With End If End Sub Private Sub Login_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim CheckAdminExist As New MisCode 'before start check whether admin is exist CheckAdminExist.CheckAdminExist() 'if yes the hide register box If AdminExist = 1 Then btnRegister.Hide() btnCancel.Show() Else 'if no hide cancel box btnRegister.Show() btnCancel.Hide() End If End Sub Private Sub Loginbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
33
'connection start here cn.Open() 'command to select password row from the users table when the username is matched with username textbox input cmd = New OleDbCommand("select [userid], [username], [password], [userfname], [userlname], [position] from [users] where [username] ='" & txtUsername.Text & "'", cn) dr = cmd.ExecuteReader dr.Read() 'if dr has a row mean the password for the username is exist If dr.HasRows Then 'if data table at column 1 is matched with password textbox input If dr(2) = txtPassword.Text Then 'then hide the login form and display main page 'and retrieve important data for use inside the program userid = dr(0).ToString LoginID = dr(1).ToString ResetPass = dr(2).ToString FirstName = dr(3).ToString LastName = dr(4).ToString position = dr(5) cn.Close() Me.Hide() MasterMDI.Show() Else 'else pop up a massage box with massage invalid password MsgBox("Invalid password") cn.Close() End If Else 'if no row mean invalid username MsgBox("Invalid user name") cn.Close() End If End Sub Private Sub registerbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRegister.Click 'show register form RegisterForm.Show() End Sub Private Sub ForgotpwdLink_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LnkForgotten.LinkClicked MessageBeep(AlertExclamation) 'show username or password forgotten form ForgottenUP.Show() End Sub Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click Me.Close() End SubEnd Class
34
Forgotten Password
'Project: Admin Forgotten Username Password Email Sender form for CarPark Registration Application'Programmer: Spencerlim'Date Finish: 1 October 2010'Status: Done'Description: When the user forgotten username and password, this program will execute and sent the information to userImports System.Net.MailImports System.Net.Mail.MailMessageImports System.Net.NetworkCredentialImports System.Text.RegularExpressionsPublic Class ForgottenUP Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click Dim retriever As New MisCode mailto = txtEmail.Text 'Get some function from MisCode retriever.RetrieveUP() 'Gmail Basic Setting Const GmailPort As Integer = 587 Const U As String = "[email protected]" Const P As String = "visualbasic" 'Email Content Dim Mail As MailMessage Dim smtp As SmtpClient Dim From As String = "[email protected]" Dim Receiver As String = mailto Dim Subject As String = "APIIT CAR PARK ADMIN USERNAME PASSWORD RETRIEVER " 'Message include Username and password Dim MailBody As String = "Your Username and Password are " & UsernameRetrieve & " and " & PasswordRetrieve & vbNewLine & "Please Reset Immediately for security purpose. " Dim Body As String = MailBody.ToString 'line up setting Mail = New MailMessage(From, Receiver, Subject, Body) 'most important of mailing system -- Smtp smtp = New SmtpClient("smtp.gmail.com", GmailPort) 'Enable SSL connection smtp.EnableSsl = True smtp.DeliveryMethod = SmtpDeliveryMethod.Network 'use to login gmail smtp.Credentials = New System.Net.NetworkCredential(U, P) Try 'send mail here and receive error inside catch smtp.Send(Mail) MsgBox("E-mail has been suceessfully send to " & Receiver, MsgBoxStyle.OkOnly, "success") Catch ex As SmtpFailedRecipientException 'need to verify what problem easily...mainly will cause by recipient exception MsgBox(ex.Message) Catch ex As SmtpException 'and also smtp exception MsgBox(ex.Message)
35
Catch ex As Exception 'rest of error will call up this MsgBox(ex.Message) End Try End Sub Private Sub txtEmail_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtEmail.Validating Dim success As String Dim email As String Dim MailVerify As New MisCode email = txtEmail.Text 'cancel any previous error ErrorProvider1.SetError(txtEmail, "") 'assign the value email to email address check function and return value to success success = MailVerify.EmailAddressCheck(email) 'cancel the event when the email is failed to past the fomat test If success = False Then e.Cancel = True ErrorProvider1.SetError(txtEmail, "Please input a valid Email address") End If 'http://www.homeandlearn.co.uk/net/nets9p5.html End Sub Private Sub ForgottenUP_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End SubEnd Class
36
Change Your Password
'Project: Password Changing Form For Car Park Admin System'Programmer: Spencerlim'Date Finish: 2 October 2010'Status: Stable and Running Well (DONE)'Description: This main form is used to allow user change their password for security purposeImports System.DataImports System.Data.OleDbPublic Class ChangeNewPass Private Sub btnChangePass_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnChangePass.Click If keyWord = "adminedit" Then temp = "" temp = LoginID LoginID = "" LoginID = LoginIdX LoginIdX = "" LoginIdX = temp tempX = ResetPass ResetPass = "" ResetPass = ResetPassX ResetPassX = "" ResetPassX = tempX tempX = "" End If 'check if field is empty If txtOldPass.Text.Trim = "" Or txtNewPass.Text.Trim = "" Then MsgBox("There are an Empty fields.", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Error") Exit Sub End If 'check if both field is same If Not txtNewPass.Text = txtNewConfirm.Text Then MsgBox("Please re-input New Password or New Confirm Password" & vbNewLine & "Both of Them should be the same", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Error") Exit Sub End If ' check if old password is correct If Not txtOldPass.Text = ResetPass Then MsgBox("Invalid Old Password.", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Error") Exit Sub End If 'update the new password Dim dbCommand As New OleDbCommand Dim strsql As String = "UPDATE [users] SET " & "[password]='" & txtNewPass.Text & "' " & "where [username]='" & LoginID & "'" dbCommand.CommandText = strsql.ToString dbCommand.Connection = cn dbCommand.Connection.Open() dbCommand.ExecuteNonQuery() dbCommand.Connection.Close()
37
MessageBeep(AlertAsterix) MsgBox("Password for username = " & LoginID & vbNewLine & "has been successfully Changed.", MsgBoxStyle.OkOnly, "Success!") Me.Close() If keyWord = "adminedit" Then temp = "" temp = LoginID LoginID = "" LoginID = LoginIdX LoginIdX = "" LoginIdX = temp tempX = ResetPass ResetPass = "" ResetPass = ResetPassX ResetPassX = "" ResetPassX = tempX tempX = "" keyWord = "NULL" End If End Sub Private Sub ChangeNewPass_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed MasterMDI.Text = "Apiit Car Park Administration" End Sub Private Sub ChangeNewPass_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load MasterMDI.Text = "Change New Password || Apiit Car Park Administration" End SubEnd Class
38
User Register
'Project: Admin Register form for CarPark Registration Application
'Programmer: Spencerlim
'Date Finish: 23 September 2010
'Status: DONE
'Description: This program will register admin/ moderator for Apiit Car Park System
' We aspect that the carpark department is not incharge by one admin only and The system
should protected by authentication
' By ease admin department manage application user, we create this to allow them to register
' The first member should automatically assign as position 1 ( Admin ) and the rest will assign
as moderator
' This is to protect the admin user data will not delete accidently by other user
'Project: About box with info combine from assembly information'Programmer: Spencerlim'Date Finish: 1 october 2010'Status: Done'Description: To display information from assembly informationPublic NotInheritable Class BoxAbout Private Sub AboutBox1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Set the title of the form. Dim ApplicationTitle As String If My.Application.Info.Title <> "" Then ApplicationTitle = My.Application.Info.Title Else ApplicationTitle = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName) End If Me.Text = String.Format("About {0}", ApplicationTitle) ' Initialize all of the text displayed on the About Box. ' TODO: Customize the application's assembly information in the "Application" pane of the project ' properties dialog (under the "Project" menu). Me.LabelProductName.Text = My.Application.Info.ProductName Me.LabelVersion.Text = String.Format("Version {0}", My.Application.Info.Version.ToString) Me.LabelCopyright.Text = My.Application.Info.Copyright Me.LabelCompanyName.Text = My.Application.Info.CompanyName Me.TextBoxDescription.Text = My.Application.Info.Description End Sub Private Sub OKButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OKButton.Click Me.Close() End SubEnd Class
64
Crystal Report
Public Class CrystalReporter Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Load Dim Reporter As New CrystalReport CrystalReportViewer1.ReportSource = Reporter CrystalReportViewer1.Refresh() End Sub Private Sub CrystalReporter_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End SubEnd Class
65
References
Home and Learn, 2009, Visual Basic. Net Programming for Beginners: How to Create
Function in VB. Net [online], Available from
http://www.homeandlearn.co.uk/net/nets9p5.html, [Accessed 9th August 2010].
Stack Overflow Internet Services, Inc., 2010, Visual Basic 2008 Control Array [online],
Available from http://stackoverflow.com/questions/2304817/visual-basic-2008-
control-arrays, [Accessed 9th August 2010].
Matthew A. Stoecker, 2010, Creating Control Arrays in Visual Basic.Net and Visual