Visual Programming COMP 1007: Victoria Health Club Application Report

Verified

Added on  2022/12/02

|14
|2109
|394
Report
AI Summary
Document Page
Visual Programming Comp 1007
May 10
2019
Student ID:
Student Name:
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Report
Introduction
The report is based upon the VB.Net application “Victoria Health Club”. The application is built
upon the Victoria Health Club that manages the clients who come to the Victoria Health Club
and shows reports etc.
There are different forms and reports in the application. The crystal report is used to show the
summarized data. Two reports are being used – client report and parameterized client report. the
client report is showing all clients while parameterized client report is showing the clients
according to the selected membership type- Permanent or Temporary.
Screens
Home Page
Document Page
Public Class Home
Dim attempts As Integer = 0
Public userType As String
Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLogin.Click
Dim objDataAccess As DataAccess = New DataAccess()
Dim exist As Integer
'Dim userType As String
If rdAdmin.Checked Then
userType = "Admin"
Else
userType = "Client"
End If
If attempts >= 3 Then
'maximal attempts reached
MsgBox("You reached the maximum attempts to log in!")
Exit Sub
End If
exist = objDataAccess.checkLogin(txtUserName.Text.ToString(),
txtPwd.Text.ToString(), userType)
If exist = 1 Then
Splash.Show()
Else
MsgBox("Invalid User Name or Password or User Type")
attempts += 1
txtUserName.Text = ""
txtPwd.Text = ""
txtUserName.Focus()
End If
End Sub
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCancel.Click
txtUserName.Text = ""
txtPwd.Text = ""
End Sub
End Class
Document Page
Splash Screen
New Client Screen
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Public Class AddClient
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
' Adding the new client into database
Try
If (txtName.Text = "") Then
MsgBox("Please enter the name!")
txtName.Focus()
Return
End If
If (txtAddress.Text = "") Then
MsgBox("Please enter the address!")
txtAddress.Focus()
Return
End If
If (txtEmail.Text = "") Then
MsgBox("Please enter the email!")
txtEmail.Focus()
Return
End If
If (txtPhone.Text = "") Then
MsgBox("Please enter the phone!")
txtPhone.Focus()
Return
End If
If (cbMember.Text = "") Then
MsgBox("Please select the membership!")
cbMember.Focus()
Return
End If
Dim objDataAccess As DataAccess = New DataAccess()
objDataAccess.addClient(txtName.Text, txtAddress.Text, txtEmail.Text,
txtPhone.Text, cbMember.Text)
errorMessage.Text = "Client Added Successfully!"
Catch ex As Exception
errorMessage.Text = ex.ToString()
End Try
End Sub
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCancel.Click
Me.Close()
End Sub
Document Page
End Class
View Client Screen
Public Class ViewClient
Public clientID As Integer
Public Sub loadData()
Try
Dim ds As DataSet = New DataSet()
Dim objDataAccess As DataAccess = New DataAccess()
ds = objDataAccess.viewClient()
DataGridView1.DataSource = ds
DataGridView1.DataMember = "Client_Table"
Dim btnEdit As New DataGridViewButtonColumn()
DataGridView1.Columns.Add(btnEdit)
btnEdit.HeaderText = ""
btnEdit.Text = "Edit"
btnEdit.Name = "btnEdit"
btnEdit.UseColumnTextForButtonValue = True
Dim btnDelete As New DataGridViewButtonColumn()
DataGridView1.Columns.Add(btnDelete)
btnDelete.HeaderText = ""
btnDelete.Text = "Delete"
btnDelete.Name = "btnDelete"
btnDelete.UseColumnTextForButtonValue = True
Catch ex As Exception
End Try
End Sub
Private Sub ViewClient_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Home.userType = "Client" Then
MenuStrip2.Items.Remove(mnReport)
End If
Try
loadData()
Document Page
Catch ex As Exception
End Try
End Sub
Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
If e.ColumnIndex = 6 Then
clientID = DataGridView1.Rows(e.RowIndex).Cells(0).Value
EditClient.Show()
End If
If e.ColumnIndex = 7 Then
clientID = DataGridView1.Rows(e.RowIndex).Cells(0).Value
Try
Dim objDataAccess As DataAccess = New DataAccess()
objDataAccess.delClient(Convert.ToInt32(clientID))
MsgBox("Client Deleted Successfully!")
'loadData()
Catch ex As Exception
End Try
End If
End Sub
End Class
Edit Client Screen
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Public Class EditClient
Private Sub EditClient_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Home.userType = "Client" Then
MenuStrip1.Items.Remove(mnReport)
End If
' Get client detail
Try
Dim ds As DataSet = New DataSet()
Dim objDataAccess As DataAccess = New DataAccess()
ds =
objDataAccess.getClientDetail(Convert.ToInt32(ViewClient.clientID))
txtName.Text = ds.Tables(0).Rows(0)(1).ToString()
txtAddress.Text = ds.Tables(0).Rows(0)(2).ToString()
txtEmail.Text = ds.Tables(0).Rows(0)(3).ToString()
txtPhone.Text = ds.Tables(0).Rows(0)(4).ToString()
cbMember.SelectedText = ds.Tables(0).Rows(0)(5).ToString()
Catch ex As Exception
errorMessage.Text = ex.ToString()
End Try
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
' Updating the client detail into database
Try
If (txtName.Text = "") Then
MsgBox("Please enter the name!")
txtName.Focus()
Return
End If
If (txtAddress.Text = "") Then
MsgBox("Please enter the address!")
txtAddress.Focus()
Return
End If
If (txtEmail.Text = "") Then
MsgBox("Please enter the email!")
txtEmail.Focus()
Return
End If
If (txtPhone.Text = "") Then
MsgBox("Please enter the phone!")
txtPhone.Focus()
Return
End If
If (cbMember.Text = "") Then
MsgBox("Please select the membership!")
cbMember.Focus()
Return
Document Page
End If
Dim objDataAccess As DataAccess = New DataAccess()
objDataAccess.editClient(Convert.ToInt32(ViewClient.clientID),
txtName.Text, txtAddress.Text, txtEmail.Text, txtPhone.Text, cbMember.Text)
errorMessage.Text = "Client Updated Successfully!"
Catch ex As Exception
errorMessage.Text = ex.ToString()
End Try
End Sub
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCancel.Click
Me.Close()
End Sub
End Class
Client Report
Parameterized Client Report
Document Page
Calculate Burnt Calories Report
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Public Class CalculateCalory
Private Sub CalculateCalory_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
cmbActivity.SelectedText = "Crunch"
cmbTiming.SelectedText = "10 min"
If Home.userType = "Client" Then
MenuStrip1.Items.Remove(mnReport)
End If
End Sub
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCalculate.Click
Dim calory As Integer
If cmbActivity.Text = "Crunch" Then
calory = 20 * CInt(cmbTiming.Text.Substring(0, 2))
'MsgBox("Burned Calories: " & calory)
ElseIf cmbActivity.Text = "Side Plank" Then
calory = 10 * CInt(cmbTiming.Text.Substring(0, 2))
ElseIf cmbActivity.Text = "Row" Then
calory = 15 * CInt(cmbTiming.Text.Substring(0, 2))
ElseIf cmbActivity.Text = "CrossoverRow" Then
calory = 25 * CInt(cmbTiming.Text.Substring(0, 2))
End If
MsgBox("Burned Calories: " & calory)
End Sub
End Class
Data Access Layer
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Public Class DataAccess
'Connection string
Dim strConnection As String = "Data Source=\SQLEXPRESS;Initial
Catalog=Club;Integrated Security=True"
Dim clubConnection As SqlConnection = New SqlConnection(strConnection)
'Adding new client
Public Sub addClient(ByVal name As String, ByVal address As String, ByVal
email As String, ByVal PhoneNumber As String, ByVal Membership As String)
clubConnection.Open()
Dim insertCmd As SqlCommand = New SqlCommand()
insertCmd.Connection = clubConnection
insertCmd.CommandType = CommandType.StoredProcedure
Document Page
insertCmd.CommandText = "p_add_client"
insertCmd.Parameters.Add("@name", SqlDbType.NVarChar, 50).Value = name
insertCmd.Parameters.Add("@address", SqlDbType.NVarChar, 255).Value =
address
insertCmd.Parameters.Add("@email", SqlDbType.NVarChar, 50).Value = email
insertCmd.Parameters.Add("@phone", SqlDbType.NVarChar, 20).Value =
PhoneNumber
insertCmd.Parameters.Add("@membership", SqlDbType.NVarChar, 50).Value =
Membership
insertCmd.ExecuteNonQuery()
clubConnection.Close()
End Sub
'View all clients
Public Function viewClient() As DataSet
clubConnection.Open()
Dim cmd As SqlCommand = New SqlCommand()
cmd = New SqlCommand("p_get_clients", clubConnection)
cmd.CommandType = CommandType.StoredProcedure
Dim ds As DataSet = New DataSet()
Dim dataAdapter As SqlDataAdapter = New SqlDataAdapter(cmd)
dataAdapter.Fill(ds, "Client_Table")
Return ds
End Function
'get the client detail
Public Function getClientDetail(ByVal clientID As Integer) As DataSet
clubConnection.Open()
Dim Cmd As SqlCommand = New SqlCommand()
Cmd = New SqlCommand("p_get_client_detail", clubConnection)
Cmd.CommandType = CommandType.StoredProcedure
Cmd.Parameters.Add("@clientID", SqlDbType.Int).Value = clientID
Dim ds As DataSet = New DataSet()
Dim dataAdapter As SqlDataAdapter = New SqlDataAdapter(Cmd)
dataAdapter.Fill(ds)
Return ds
End Function
'Edit the client detail
Public Sub editClient(ByVal clientID As Integer, ByVal name As String, ByVal
address As String, ByVal email As String, ByVal PhoneNumber As String, ByVal
Membership As String)
clubConnection.Open()
Dim editCmd As SqlCommand = New SqlCommand()
editCmd.Connection = clubConnection
editCmd.CommandType = CommandType.StoredProcedure
editCmd.CommandText = "p_edit_client"
editCmd.Parameters.Add("@clientID", SqlDbType.Int).Value = clientID
editCmd.Parameters.Add("@name", SqlDbType.NVarChar, 50).Value = name
editCmd.Parameters.Add("@address", SqlDbType.NVarChar, 255).Value =
address
editCmd.Parameters.Add("@email", SqlDbType.NVarChar, 50).Value = email
editCmd.Parameters.Add("@phone", SqlDbType.NVarChar, 20).Value =
PhoneNumber
editCmd.Parameters.Add("@membership", SqlDbType.NVarChar, 50).Value =
Membership
editCmd.ExecuteNonQuery()
clubConnection.Close()
End Sub
Document Page
'delete the client detail
Public Sub delClient(ByVal clientID As Integer)
clubConnection.Open()
Dim delCmd As SqlCommand = New SqlCommand()
delCmd.Connection = clubConnection
delCmd.CommandType = CommandType.StoredProcedure
delCmd.CommandText = "p_del_client"
delCmd.Parameters.Add("@clientID", SqlDbType.Int).Value = clientID
delCmd.ExecuteNonQuery()
clubConnection.Close()
End Sub
'Check login
Public Function checkLogin(ByVal userName As String, ByVal pwd As String,
ByVal userType As String) As Integer
clubConnection.Open()
Dim cmd As SqlCommand = New SqlCommand()
cmd = New SqlCommand("p_login", clubConnection)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@username", SqlDbType.NVarChar, 50).Value = userName
cmd.Parameters.Add("@password", SqlDbType.NVarChar, 20).Value = pwd
cmd.Parameters.Add("@usertype", SqlDbType.NVarChar, 20).Value = userType
Dim ds As DataSet = New DataSet()
Dim dataAdapter As SqlDataAdapter = New SqlDataAdapter(cmd)
dataAdapter.Fill(ds)
If (ds.Tables(0).Rows.Count > 0) Then
Return 1
Else
Return 0
End If
End Function
End Class
Conclusion
The report is showing complete working of Victoria Health Club. All information regarding
clients, reports etc. have been shown in the report. after studying the report, a user can easily
understand the complete application.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
References
Go4Expert. (2016), Introduction to DataGridView Control in VB.NET, [Online]. Available:
http://www.go4expert.com/articles/introduction-datagridview-control-vbnet-t30219/. [Accessed:
9-May-2019]
net-informations.com (2016), VB.NET DataGridView Binding – SQL Server, [Online].
Available: http://vb.net-informations.com/datagridview/vb.net_datagridview_binding.htm.
[Accessed: 9-May-2019]
Microsoft (2017), How to: Create a Password Text Box with the Windows Forms TextBox
Control, [Online]. Available:
https://docs.microsoft.com/en-us/dotnet/framework/winforms/controls/how-to-create-a-
password-text-box-with-the-windows-forms-textbox-control. [Accessed: 9-May-2019]
chevron_up_icon
1 out of 14
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]