You are on page 1of 32

(SOURCE CODE OF CRS)

SPLASH SCREEN
Public Class splash
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Timer1.Tick
pb1.Value = pb1.Value + 10
If pb1.Value = 200 Then
Timer1.Stop()
Me.Hide()
Main.Show()
End If
End Sub
Private Sub splash_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PictureBox1.Click
End Sub
End Class

LOGIN FOR EMPLOYEES


Imports MySql.Data.MySqlClient
Public Class Main
Dim ServerString As String = "Server=localhost;Uid=root;Pwd=crs;Database=yash"
Dim SqlConnection As MySqlConnection = New MySqlConnection
Dim db As MySqlDataReader
Dim cmd As MySqlCommand = New MySqlCommand
Private Sub Main_Disposed(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Disposed
splash.Close()
End Sub
Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
SqlConnection.ConnectionString = ServerString
End Sub
'inserting data into database
Public Sub UserInfo(ByRef SQLStatement As String)
SqlConnection.Open()
With cmd
.CommandText = SQLStatement
.CommandType = CommandType.Text
.Connection = SqlConnection
.ExecuteNonQuery()
End With
SqlConnection.Close()
MsgBox("New User Created ")
GroupBox2.Visible = False

cls(GroupBox2)
SqlConnection.Dispose()
End Sub
'clearing the text boxes
Public Sub cls(ByRef obj As Control)
Dim obj1 As Control
For Each obj1 In obj.Controls
If TypeOf obj1 Is TextBox Then
obj1.Text = ""
End If
Next
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Me.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles nub2.Click
cls(GroupBox2)
End Sub
'Checking for user and password validation
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
SqlConnection.Open()
Dim usrname As String
Dim passwd As String
Dim flagok As Integer
flagok = 1
usrname = eut1.Text.ToString
passwd = eut2.Text.ToString
Dim upquery As String
upquery = "SELECT usr_name,pass FROM user_login"
cmd = New MySqlCommand(upquery, SqlConnection)
db = cmd.ExecuteReader
While db.Read
If usrname = db.Item("usr_name") Then
If passwd = db.Item("pass") Then
flagok = 404
End If
End If
End While
'Checking if entered is correct or not
If flagok = 404 Then
cls(GroupBox1)
CRSCC.CRSCC_status.Text = "Welcome " & usrname & ""
Me.Hide()
CRSCC.Show()
Else
MsgBox("Either user name or password is incorrect ")
End If
SqlConnection.Close()
End Sub
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
Dim adminpass As String
adminpass = InputBox("Enter Admin Password : ").ToString

If adminpass = "yash" Then


GroupBox2.Visible = True
Else
MsgBox("password incorrect")
End If
End Sub
'sending to function to insert value
Private Sub nub1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles nub1.Click
If nut1.Text = "" Or nut2.Text = "" Or nut3.Text = "" Or nut4.Text = "" Then
MsgBox("Fill all Details ")
ElseIf nut3.Text <> nut4.Text Then
MsgBox("Password did't Match")
Else
Dim SQLStatement As String = "INSERT INTO user_login VALUES('" & nut1.Text &
"','" & nut2.Text & "','" & nut3.Text & "')"
UserInfo(SQLStatement)
End If
End Sub
Private Sub nut1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles nut1.KeyPress, nut4.KeyPress,
nut3.KeyPress, nut2.KeyPress
Dim hu As String
hu = 13
If e.KeyChar = "'" Then
e.Handled = True
Else
e.Handled = False
End If
If e.KeyChar = hu.ToString Then
nut2.Focus()
End If
End Sub
Private Sub nut1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles nut1.TextChanged
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PictureBox1.Click
End Sub
End Class

CRSCC CONTROL CENTER


Imports System.Windows.Forms
Public Class CRSCC
Dim gameloca As String
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ExitToolStripMenuItem.Click
Main.Show()

Me.Close()
End Sub
Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles AboutToolStripMenuItem.Click
CRSCC_about.MdiParent = Me
CRSCC_about.Show()
End Sub
Private Sub CRSCC_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
' MsgBox("h:" + Me.Height.ToString + "--" + Me.Width.ToString)
End Sub
Private Sub AddVehicleToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles AddVehicleToolStripMenuItem.Click
CRSCC_Add_Vehicles.MdiParent = Me
Me.PictureBox1.Visible = False
CRSCC_Add_Vehicles.Show()
End Sub
Private Sub AddClientToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles AddClientToolStripMenuItem.Click
CRSCC_Clients_detail.MdiParent = Me
Me.PictureBox1.Visible = False
CRSCC_Clients_detail.Show()
End Sub
Private Sub Clients_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Clients.Click
End Sub
Private Sub RentACarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles RentACarToolStripMenuItem.Click
CRSCC_Rent_A_Car.MdiParent = Me
Me.PictureBox1.Visible = False
CRSCC_Rent_A_Car.Show()
End Sub
Private Sub RecievebackToolStripMenuItem_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles RecievebackToolStripMenuItem.Click
CRSCC_Receive_back.MdiParent = Me
Me.PictureBox1.Visible = False
CRSCC_Receive_back.Show()
End Sub
Private Sub MazeGameToolStripMenuItem_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MazeGameToolStripMenuItem.Click
game1.MdiParent = Me
Me.PictureBox1.Visible = False
gameloca = "E:\Car Rent(project)\Games\bird-invader-flash-games.swf"
Label1.Text = gameloca
game1.Show()
End Sub
Private Sub AimAndShootToolStripMenuItem_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles AimAndShootToolStripMenuItem.Click
game1.MdiParent = Me

Me.PictureBox1.Visible = False
gameloca = "E:\Car Rent(project)\Games\aim-and-shoot-flash-games.swf"
Label1.Text = gameloca
game1.Show()
End Sub
Private Sub AirBattleToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles AirBattleToolStripMenuItem.Click
game1.MdiParent = Me
Me.PictureBox1.Visible = False
gameloca = "E:\Car Rent(project)\Games\car-can-racing-flash-games.swf"
Label1.Text = gameloca
game1.Show()
End Sub
Private Sub BillardsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BillardsToolStripMenuItem.Click
game1.MdiParent = Me
Me.PictureBox1.Visible = False
gameloca = "E:\Car Rent(project)\Games\billards-flash-games.swf"
Label1.Text = gameloca
game1.Show()
End Sub
Private Sub DeleteVehicleToolStripMenuItem_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles DeleteVehicleToolStripMenuItem.Click
delete_vehicle.MdiParent = Me
Me.PictureBox1.Visible = False
delete_vehicle.Show()
End Sub
Private Sub DeleteClientToolStripMenuItem_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles DeleteClientToolStripMenuItem.Click
Delete_Client.MdiParent = Me
Me.PictureBox1.Visible = False
Delete_Client.Show()
End Sub
Private Sub EditVehicleRecordToolStripMenuItem_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles EditVehicleRecordToolStripMenuItem.Click
Edit_Vehicle_Record.MdiParent = Me
Me.PictureBox1.Visible = False
Edit_Vehicle_Record.Show()
End Sub
Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles SaveAsToolStripMenuItem.Click
Quick_lookup.MdiParent = Me
Me.PictureBox1.Visible = False
Quick_lookup.Show()
End Sub
Private Sub UndoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles UndoToolStripMenuItem.Click
Vehicle_list.MdiParent = Me
Me.PictureBox1.Visible = False
Vehicle_list.Show()
End Sub

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


System.EventArgs) Handles RedoToolStripMenuItem.Click
Rental_Detail.MdiParent = Me
Me.PictureBox1.Visible = False
Rental_Detail.Show()
End Sub
Private Sub FindCarLocationToolStripMenuItem_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles FindCarLocationToolStripMenuItem.Click
GPS.MdiParent = Me
Me.PictureBox1.Visible = False
GPS.Show()
End Sub
End Class

ADD VEHICLE
Imports MySql.Data.MySqlClient
Public Class CRSCC_Add_Vehicles
Dim ServerString As String = "Server=localhost;Uid=root;Pwd=crs;Database=yash"
Dim SqlConnection As MySqlConnection = New MySqlConnection
Dim db As MySqlDataReader
Dim cmd As MySqlCommand = New MySqlCommand
Dim stock_no As Integer
Dim picpath As String
'no need auto increment in there in db
Public Sub stock_inc()
SqlConnection.Open()
Dim dbquery As String
dbquery = "SELECT stock_no FROM car_information"
cmd = New MySqlCommand(dbquery, SqlConnection)
db = cmd.ExecuteReader
While db.Read
stock_no = db.Item("stock_no") + 1
End While
SqlConnection.Close()
End Sub
'inserting data in db
Public Sub car_info(ByRef SQLStatement As String)
Try
SqlConnection.Open()
With cmd
.CommandText = SQLStatement
.CommandType = CommandType.Text
.Connection = SqlConnection
.ExecuteNonQuery()
End With
SqlConnection.Close()
MsgBox("New Car Added")
cls1(avgb1)
cls1(avgb2)
LPB1.Image = Nothing
stock_inc()
LP_loc.Text = ""
cdt1.Text = stock_no
SqlConnection.Dispose()
Catch

MsgBox(ErrorToString)
End Try
End Sub
Public Sub cls1(ByRef obj As Control)
Dim obj1 As Control
For Each obj1 In obj.Controls
If TypeOf obj1 Is TextBox Then
obj1.Text = ""
End If
If TypeOf obj1 Is ComboBox Then
obj1.Text = ""
End If
Next
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
CRSCC.PictureBox1.Visible = True
Me.Close()
End Sub
Private Sub CRSCC_Add_Vehicles_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
SqlConnection.ConnectionString = ServerString
stock_inc()
cdt1.Text = stock_no
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
cls1(avgb1)
cls1(avgb2)
LPB1.Image = Nothing
LP_loc.Text = ""
End Sub
'Sending data to insert into car_information table
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim model_no As String
Dim reg_no As String
Dim car_year As Integer
Dim car_colour As String
Dim car_class As String
Dim car_engine As String
Dim car_rate_day As Integer
Dim car_rate_weekly As Integer
Dim pic_loc As String
model_no = cdt3.Text.ToString
reg_no = cdt2.Text.ToString
car_colour = cdt5.Text.ToString
car_class = cdc1.Text.ToString
car_engine = cdc2.Text.ToString
pic_loc = stock_no
If cdt2.Text = "" Or cdt3.Text = "" Or cdt4.Text = "" Or cdt5.Text = "" Or
cdc1.SelectedIndex < 0 Or cdc2.SelectedIndex < 0 Or LP_loc.Text = "" Then
MsgBox("Fill all the details and Load Picture")
Else
Try

car_year = Integer.Parse(cdt4.Text)
car_rate_day = Integer.Parse(rt1.Text)
car_rate_weekly = Integer.Parse(rt2.Text)
If car_year < 2050 And car_year > 1700 Then
If car_rate_day <= car_rate_weekly Then
Dim SQLStatement As String = "INSERT INTO car_information VALUES('" &
stock_no & "','" & reg_no & "','" & model_no & "','" & car_year & "','" & car_colour & "','" &
car_class & "','" & car_engine & "','" & car_rate_day & "','" & car_rate_weekly & "','" &
pic_loc & "',0)"
car_info(SQLStatement)
Else
MsgBox("Daily rent is more than Weekly rent ! Correct it")
End If
Else
MsgBox("Enter year between 1700-2050")
End If
Catch ex As Exception
MsgBox("Enter integer data ")
End Try
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
LPB1.Image = Nothing
LP_loc.Text = ""
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
AV_OFD1.Filter = "*.jpg|*.jpg"
AV_OFD1.ShowDialog()
picpath = AV_OFD1.FileName
LP_loc.Text = picpath
LPB1.ImageLocation = picpath
End Sub
Private Sub avgb1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles avgb1.Enter
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Timer1.Tick
Anicar1.Left = Anicar1.Left + 2
If Anicar1.Left > Me.Width + 8 Then
Anicar1.Left = 0
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Timer2.Tick
Anicar2.Left = Anicar2.Left + 2
If Anicar2.Left > Me.Width + 8 Then
Anicar2.Left = 0
End If
End Sub

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


System.EventArgs) Handles Anicar1.MouseHover
Timer1.Enabled = False
End Sub
Private Sub Anicar1_MouseLeave(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Anicar1.MouseLeave
Timer1.Enabled = True
End Sub
Private Sub Anicar2_MouseHover(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Anicar2.MouseHover
Timer2.Enabled = False
End Sub
Private Sub Anicar2_MouseLeave(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Anicar2.MouseLeave
Timer2.Enabled = True
End Sub
End Class

CLIENT DETAILS
Imports MySql.Data.MySqlClient
Imports System.Runtime.InteropServices 'For web Cam
Public Class CRSCC_Clients_detail
Dim ServerString As String = "Server=localhost;Uid=root;Pwd=crs;Database=yash"
Dim SqlConnection As MySqlConnection = New MySqlConnection
Dim db As MySqlDataReader
Dim cmd As MySqlCommand = New MySqlCommand
Dim client_id As Integer
Dim flag1 As Integer
'-----------------------------------------------------------------------------------'webcam initialisation
Const WM_CAP As Short = &H400S
Const WM_CAP_DRIVER_CONNECT As Integer = WM_CAP + 10
Const WM_CAP_DRIVER_DISCONNECT As Integer = WM_CAP + 11
Const WM_CAP_EDIT_COPY As Integer = WM_CAP + 30
Const WM_CAP_SET_PREVIEW As Integer = WM_CAP + 50
Const WM_CAP_SET_PREVIEWRATE As Integer = WM_CAP + 52
Const WM_CAP_SET_SCALE As Integer = WM_CAP + 53
Const WS_CHILD As Integer = &H40000000
Const WS_VISIBLE As Integer = &H10000000
Const SWP_NOMOVE As Short = &H2S
Const SWP_NOSIZE As Short = 1
Const SWP_NOZORDER As Short = &H4S
Const HWND_BOTTOM As Short = 1
Dim iDevice As Integer = 0
Dim hHwnd As Integer
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As
Integer, ByVal wMsg As Integer, ByVal wParam As Integer,
<MarshalAs(UnmanagedType.AsAny)> ByVal lParam As Object) As Integer
Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As
Integer, ByVal hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, ByVal cx
As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer
Declare Function DestroyWindow Lib "user32" (ByVal hndw As Integer) As Boolean

Declare Function capCreateCaptureWindowA Lib "avicap32.dll" (ByVal lpszWindowName


As String, ByVal dwStyle As Integer, ByVal x As Integer, ByVal y As Integer, ByVal nWidth
As Integer, ByVal nHeight As Short, ByVal hWndParent As Integer, ByVal nID As Integer) As
Integer
Declare Function capGetDriverDescriptionA Lib "avicap32.dll" (ByVal wDriver As Short,
ByVal lpszName As String, ByVal cbName As Integer, ByVal lpszVer As String, ByVal cbVer
As Integer) As Boolean
'-----------------------------------------------------------------------------------Private Sub LoadDeviceList()
Dim strName As String = Space(100)
Dim strVer As String = Space(100)
Dim bReturn As Boolean
Dim x As Integer = 0
Do
bReturn = capGetDriverDescriptionA(x, strName, 100, strVer, 100)
If bReturn Then lstDevices.Items.Add(strName.Trim)
x += 1
Loop Until bReturn = False
End Sub
Private Sub OpenPreviewWindow()
Dim iHeight As Integer = picCapture.Height
Dim iWidth As Integer = picCapture.Width
hHwnd = capCreateCaptureWindowA(iDevice, WS_VISIBLE Or WS_CHILD, 0, 0, 640,
480, picCapture.Handle.ToInt32, 0)
If SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0) Then
SendMessage(hHwnd, WM_CAP_SET_SCALE, True, 0)
SendMessage(hHwnd, WM_CAP_SET_PREVIEWRATE, 66, 0)
SendMessage(hHwnd, WM_CAP_SET_PREVIEW, True, 0)
SetWindowPos(hHwnd, HWND_BOTTOM, 0, 0, picCapture.Width,
picCapture.Height, SWP_NOMOVE Or SWP_NOZORDER)
Else
DestroyWindow(hHwnd)
btnSave.Enabled = False
End If
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
Dim data As IDataObject
Dim bmap As Image
SendMessage(hHwnd, WM_CAP_EDIT_COPY, 0, 0)
data = Clipboard.GetDataObject()
If data.GetDataPresent(GetType(System.Drawing.Bitmap)) Then
bmap = CType(data.GetData(GetType(System.Drawing.Bitmap)), Image)
picCapture.Image = bmap
ClosePreviewWindow()
btnSave.Enabled = False
If sfdImage.ShowDialog = DialogResult.OK Then
bmap.Save(sfdImage.FileName, Imaging.ImageFormat.Bmp)
End If
End If
Clipboard.Clear()
picCapture.Image = Nothing
ppb1.ImageLocation = sfdImage.FileName
check.Text = sfdImage.FileName.ToString
End Sub
Private Sub ClosePreviewWindow()
SendMessage(hHwnd, WM_CAP_DRIVER_DISCONNECT, iDevice, 0)

DestroyWindow(hHwnd)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
If flag1 = 0 Then
OpenPreviewWindow()
flag1 = 1
Else
ClosePreviewWindow()
flag1 = 0
End If
btnSave.Enabled = True
End Sub
Public Sub cls1(ByRef obj As Control)
Dim obj1 As Control
For Each obj1 In obj.Controls
If TypeOf obj1 Is TextBox Then
obj1.Text = ""
End If
If TypeOf obj1 Is ComboBox Then
obj1.Text = ""
End If
If TypeOf obj1 Is PictureBox Then
obj1.BackgroundImage = Nothing
End If
Next
End Sub
Public Sub client_inc()
SqlConnection.Open()
Dim dbquery As String
dbquery = "SELECT client_id FROM client_information"
cmd = New MySqlCommand(dbquery, SqlConnection)
db = cmd.ExecuteReader
While db.Read
client_id = db.Item("client_id") + 1
End While
SqlConnection.Close()
End Sub
Public Sub client_info(ByRef SQLStatement As String)
Try
SqlConnection.Open()
With cmd
.CommandText = SQLStatement
.CommandType = CommandType.Text
.Connection = SqlConnection
.ExecuteNonQuery()
End With
SqlConnection.Close()
MsgBox("New Client Added")
cls1(pigb1)
cls1(cigb1)
ppb1.Image = Nothing
client_inc()
act1.Text = client_id
SqlConnection.Dispose()
Catch
MsgBox(ErrorToString)

End Try
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
cls1(pigb1)
cls1(cigb1)
ppb1.Image = Nothing
End Sub
Private Sub CRSCC_Clients_detail_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
LoadDeviceList()
SqlConnection.ConnectionString = ServerString
flag1 = 0
client_inc()
act1.Text = client_id
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim full_name As String
Dim d_o_b As String
Dim p_o_b As String
Dim p_a As String
Dim state As String
Dim country As String
Dim pass_no As String
Dim mob_no As Integer
Dim e_id As String
Dim img_loc As String
full_name = pit1.Text.ToString
d_o_b = dobc1.SelectedItem + "-" + dobc2.SelectedItem + "-" + dobc3.SelectedItem
p_o_b = pit3.Text.ToString
p_a = pit4.Text.ToString
state = pit5.Text.ToString
country = pit6.Text.ToString
pass_no = pit7.Text.ToString
e_id = cit2.Text + "@" + cit3.Text
img_loc = client_id
If pit1.Text = "" Or pit3.Text = "" Or pit4.Text = "" Or pit5.Text = "" Or pit6.Text = ""
Or pit7.Text = "" Or cit1.Text = "" Or cit2.Text = "" Or cit3.Text = "" Or
dobc1.SelectedIndex < 0 Or dobc2.SelectedIndex < 0 Or dobc3.SelectedIndex < 0 Or
check.Text = "" Then
MsgBox("Fill all details and load ur pic ")
Else
Try
mob_no = Integer.Parse(cit1.Text)
Dim SQLStatement As String = "INSERT INTO client_information VALUES ('" &
client_id & "','" & full_name & "','" & d_o_b & "','" & p_o_b & "','" & p_a & "','" & state & "','"
& country & "','" & pass_no & "','" & mob_no & "','" & e_id & "','" & img_loc & "')"
client_info(SQLStatement)
Catch ex As Exception
MsgBox("Enter Integer data in mob field ")
End Try
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
CRSCC.PictureBox1.Visible = True

Me.Close()
End Sub
Private Sub ppt1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ppt1.Tick
alert.Left = alert.Left + 5
If alert.Left = Me.Width Then
alert.Left = 0
End If
End Sub
End Class

DELETE CLIENT
Imports MySql.Data.MySqlClient
Public Class Delete_Client
Dim serverstring As String = "Server=localhost;Uid=root;Pwd=crs;Database=yash"
Dim sqlconnection As MySqlConnection = New MySqlConnection
Dim db As MySqlDataReader
Dim cmd As MySqlCommand = New MySqlCommand
Dim client_image_location As String = "E:\Car Rent(project)\Images\Client_Image\"
Dim flag1 As Integer
Public Sub load_client(ByVal cl_id As Integer)
sqlconnection.Open()
Dim dbquery As String = "SELECT * FROM client_information"
cmd = New MySqlCommand(dbquery, sqlconnection)
db = cmd.ExecuteReader
While db.Read
If cl_id = db.Item("client_id") Then
cit1.Text = db.Item("client_id")
cit2.Text = db.Item("full_name")
cit3.Text = db.Item("date_of_birth")
cit4.Text = db.Item("passport_no")
cit5.Text = db.Item("mobile_no")
cit6.Text = db.Item("email_id")
cit7.Text = db.Item("permanent_address")
cip1.Load(client_image_location + db.Item("client_picture") + ".bmp")
End If
End While
sqlconnection.Close()
End Sub
Public Sub del_client_list()
Dim sqlstring As String
sqlstring = "DELETE FROM client_information where client_id = '" & cit1.Text & "' "
Dim sqlstring2 As String
sqlstring2 = "SELECT client_id FROM client_information WHERE client_id not
in(SELECT client_id FROM rent_car) "
flag1 = 0
Try
sqlconnection.Open()
cmd = New MySqlCommand(sqlstring2, sqlconnection)
db = cmd.ExecuteReader
While db.Read
If TextBox1.Text = db.Item("client_id") Then
flag1 = 1
Exit While
End If

End While
sqlconnection.Close()
sqlconnection.Open()
If flag1 = 1 Then
With cmd
.CommandText = sqlstring
.CommandType = CommandType.Text
.Connection = sqlconnection
.ExecuteNonQuery()
End With
MsgBox("Success")
Me.Close()
CRSCC.PictureBox1.Visible = True
Else
MsgBox("This Client Hired Some Cars , Could Not Be Deleted!!!!!!!!")
End If
sqlconnection.Close()
sqlconnection.Dispose()
Catch
MsgBox(ErrorToString)
End Try
End Sub
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
flag1 = 0
sqlconnection.Open()
Dim dbquery As String = "SELECT client_id FROM client_information "
cmd = New MySqlCommand(dbquery, sqlconnection)
db = cmd.ExecuteReader
While db.Read
If TextBox1.Text = db.Item("client_id") Then
flag1 = 1
Exit While
End If
End While
e.Handled = True
sqlconnection.Close()
If flag1 = 1 Then
cig1.Visible = True
load_client(TextBox1.Text)
Else
cig1.Visible = False
MsgBox("Client not found")
End If
End If
End Sub
Private Sub Client_del_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Client_del.Click
Dim Box As MsgBoxResult
If cig1.Visible = True Then
Box = MsgBox("Are You Sure", MsgBoxStyle.YesNo)
If Box = MsgBoxResult.Yes Then
del_client_list()
End If
Else
MsgBox("No Client To Delete!!!")
End If

End Sub
Private Sub Delete_Client_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
sqlconnection.ConnectionString = serverstring
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Me.Close()
CRSCC.PictureBox1.Visible = True
End Sub
End Class

DELETE RECORD
Imports MySql.Data.MySqlClient
Public Class delete_vehicle
Dim serverstring As String = "Server=localhost;Uid=root;Pwd=crs;Database=yash"
Dim sqlconnection As MySqlConnection = New MySqlConnection
Dim db As MySqlDataReader
Dim cmd As MySqlCommand = New MySqlCommand
Dim flag1 As Integer
Dim car_image_location As String = "E:\Car Rent(project)\Images\"
Public Sub delete_car()
Dim sqlquery As String
Dim sqlquery2 As String
sqlquery = "DELETE FROM car_information where stock_no='" & TextBox1.Text & "'"
sqlquery2 = "SELECT stock_no from car_information where stock_no not in (SELECT
stock_no from rent_car)"
flag1 = 0
Try
sqlconnection.Open()
cmd = New MySqlCommand(sqlquery2, sqlconnection)
db = cmd.ExecuteReader
While db.Read
If TextBox1.Text = db.Item("stock_no") Then
flag1 = 1
Exit While
End If
End While
sqlconnection.Close()
sqlconnection.Open()
If flag1 = 1 Then
With cmd
.CommandText = sqlquery
.CommandType = CommandType.Text
.Connection = sqlconnection
.ExecuteNonQuery()
End With
MsgBox("Success")
drgb1.Visible = False
cdt1.Text = ""
Else
MsgBox("This car is on hire!! could not be deleted")
End If
sqlconnection.Close()
sqlconnection.Dispose()
Catch

MsgBox(ErrorToString)
End Try
End Sub
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyValue = Keys.Enter Then
flag1 = 0
sqlconnection.Open()
Dim dbquery As String = "SELECT stock_no FROM car_information "
cmd = New MySqlCommand(dbquery, sqlconnection)
db = cmd.ExecuteReader
While db.Read
If TextBox1.Text = db.Item("stock_no") Then
flag1 = 1
Exit While
End If
End While
e.Handled = True
sqlconnection.Close()
If flag1 = 1 Then
drgb1.Visible = True
load_car(TextBox1.Text)
Else
drgb1.Visible = False
MsgBox("Car not found")
cdt1.Text = ""
End If
End If
End Sub
Public Sub load_car(ByVal cl_id As Integer)
sqlconnection.Open()
Dim dbquery As String = "Select * from car_information"
cmd = New MySqlCommand(dbquery, sqlconnection)
db = cmd.ExecuteReader
While db.Read
If cl_id = db.Item("stock_no") Then
cdt1.Text = db.Item("stock_no")
cdt2.Text = db.Item("reg_no")
cdt3.Text = db.Item("model")
cdt4.Text = db.Item("year")
cdt5.Text = db.Item("colour")
cdt6.Text = db.Item("class")
cdt7.Text = db.Item("engine")
rt1.Text = db.Item("rate_per_day")
rt2.Text = db.Item("rate_weekly")
drpb1.Load(car_image_location + db.Item("stock_no").ToString + ".jpg")
Exit While
End If
End While
sqlconnection.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.Close()
CRSCC.PictureBox1.Visible = True
End Sub

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


System.EventArgs) Handles MyBase.Load
sqlconnection.ConnectionString = serverstring
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
If cdt1.Text <> "" Then
Dim box As MsgBoxResult
box = MsgBox("Are you sure", MsgBoxStyle.YesNo)
If box = MsgBoxResult.Yes Then
delete_car()
End If
Else
MsgBox("No Car Selected !!!!!!!!!!!")
End If
End Sub
End Class

EDIT VEHICLE RECORD


Imports MySql.Data.MySqlClient
Public Class Edit_Vehicle_Record
Dim serverstring As String = "Server=localhost;Uid=root;Pwd=crs;Database=yash"
Dim sqlconnection As MySqlConnection = New MySqlConnection
Dim db As MySqlDataReader
Dim cmd As MySqlCommand = New MySqlCommand
Dim flag1 As Integer
Dim car_image_location As String = "E:\Car Rent(project)\Images\"
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyValue = Keys.Enter Then
flag1 = 0
sqlconnection.Open()
Dim dbquery As String = "SELECT stock_no FROM car_information "
cmd = New MySqlCommand(dbquery, sqlconnection)
db = cmd.ExecuteReader
While db.Read
If TextBox1.Text = db.Item("stock_no") Then
flag1 = 1
Exit While
End If
End While
e.Handled = True
sqlconnection.Close()
If flag1 = 1 Then
drgb1.Visible = True
load_car(TextBox1.Text)
Else
drgb1.Visible = False

cdt1.Text = ""
MsgBox("Car not found")
End If
End If
End Sub
Public Sub load_car(ByVal cl_id As Integer)
sqlconnection.Open()
Dim dbquery As String = "Select * from car_information"
cmd = New MySqlCommand(dbquery, sqlconnection)
db = cmd.ExecuteReader
While db.Read
If cl_id = db.Item("stock_no") Then
cdt1.Text = db.Item("stock_no")
cdt2.Text = db.Item("reg_no")
cdt3.Text = db.Item("model")
cdt4.Text = db.Item("year")
cdt5.Text = db.Item("colour")
cdc1.Text = db.Item("class")
cdc2.Text = db.Item("engine")
rt1.Text = db.Item("rate_per_day")
rt2.Text = db.Item("rate_weekly")
drpb1.Load(car_image_location + db.Item("stock_no").ToString + ".jpg")
Exit While
End If
End While
sqlconnection.Close()
End Sub
Private Sub Edit_Vehicle_Record_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
sqlconnection.ConnectionString = serverstring
End Sub
Private Sub Close1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Close1.Click
Me.Close()
CRSCC.PictureBox1.Visible = True
End Sub
Public Sub car_save(ByRef SQLStatement As String)
Try
sqlconnection.Open()
With cmd
.CommandText = SQLStatement
.CommandType = CommandType.Text
.Connection = sqlconnection
.ExecuteNonQuery()
End With
sqlconnection.Close()
MsgBox("Record Successfully Edited")
drgb1.Visible = False
cdt1.Text = ""
sqlconnection.Dispose()
Catch
MsgBox(ErrorToString)
End Try
End Sub
Public Sub edit_car()
Dim model_no As String
Dim reg_no As String

Dim car_year As Integer


Dim car_colour As String
Dim car_class As String
Dim car_engine As String
Dim car_rate_day As Integer
Dim car_rate_weekly As Integer
' Dim pic_loc As String
model_no = cdt3.Text.ToString
reg_no = cdt2.Text.ToString
car_colour = cdt5.Text.ToString
car_class = cdc1.Text.ToString
car_engine = cdc2.Text.ToString
' pic_loc = stock_no
If cdt2.Text = "" Or cdt3.Text = "" Or cdt4.Text = "" Or cdt5.Text = "" Or
cdc1.SelectedIndex < 0 Or cdc2.SelectedIndex < 0 Or LP_loc.Text = "" Then
MsgBox("Fill all the details and Load Picture")
Else
Try
car_year = Integer.Parse(cdt4.Text)
car_rate_day = Integer.Parse(rt1.Text)
car_rate_weekly = Integer.Parse(rt2.Text)
If car_year < 2050 And car_year > 1700 Then
If car_rate_day <= car_rate_weekly Then
Dim SQLStatement As String = "UPDATE car_information SET reg_no='" &
reg_no & "',model='" & model_no & "',year='" & car_year & "',colour='" & car_colour &
"',class='" & car_class & "',engine='" & car_engine & "',rate_per_day='" & car_rate_day &
"',rate_weekly='" & car_rate_weekly & "' WHERE stock_no='" & TextBox1.Text & "'"
car_save(SQLStatement)
Else
MsgBox("Daily rent is more than Weekly rent ! Correct it")
End If
Else
MsgBox("Enter year between 1700-2050")
End If
Catch ex As Exception
MsgBox("Enter integer data ")
End Try
End If
End Sub
Private Sub Save_record_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Save_record.Click
If cdt1.Text <> "" Then
Dim box As MsgBoxResult
box = MsgBox("Are you sure", MsgBoxStyle.YesNo)
If box = MsgBoxResult.Yes Then
edit_car()
Else
drgb1.Visible = False
cdt1.Text = ""
End If
Else
MsgBox("No Car Selected !!!!!!!!!!!")
End If
End Sub
End Class

GAME
Public Class game1
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
With FlashObj
.Stop()
.Movie = CRSCC.Label1.Text
.Play()
End With
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
FlashObj.Dispose()
Me.Close()
CRSCC.PictureBox1.Visible = True
End Sub
End Class

QUICK LOOKUP
Imports MySql.Data.MySqlClient
Public Class Quick_lookup
Dim serverstring As String = "Server=localhost;Uid=root;Pwd=crs;Database=yash"
Dim sqlconnection As MySqlConnection = New MySqlConnection
Dim db As MySqlDataReader
Dim cmd As MySqlCommand = New MySqlCommand
Private Sub close1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles close1.Click
Me.Close()
CRSCC.PictureBox1.Visible = True
End Sub
Private Sub Quick_lookup_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Try
sqlconnection.ConnectionString = serverstring
sqlconnection.Open()
Dim dbquery As String = "SELECT * FROM rent_car"
cmd = New MySqlCommand(dbquery, sqlconnection)
db = cmd.ExecuteReader
While db.Read
ListBox1.Items.Add(db.Item("stock_no"))
ListBox2.Items.Add(db.Item("client_id"))
End While
sqlconnection.Close()
Catch
MsgBox(ErrorToString)
End Try
End Sub
End Class

RECEIVE BACK

Imports MySql.Data.MySqlClient
Public Class CRSCC_Receive_back
Dim serverstring As String = "Server=localhost;Uid=root;Pwd=crs;Database=yash"
Dim sqlconnection As MySqlConnection = New MySqlConnection
Dim db As MySqlDataReader
Dim cmd As MySqlCommand = New MySqlCommand
Dim flag1 As Integer
Dim daily_charge As Integer
Dim client_image_location As String = "E:\Car Rent(project)\Images\Client_Image\"
Public Sub load_client(ByVal cl_id As Integer)
sqlconnection.Open()
Dim dbquery As String = "SELECT * FROM client_information"
cmd = New MySqlCommand(dbquery, sqlconnection)
db = cmd.ExecuteReader
While db.Read
If cl_id = db.Item("client_id") Then
cit1.Text = db.Item("client_id")
cit2.Text = db.Item("full_name")
cit3.Text = db.Item("date_of_birth")
cit4.Text = db.Item("passport_no")
cit5.Text = db.Item("mobile_no")
cit6.Text = db.Item("email_id")
cit7.Text = db.Item("permanent_address")
cip1.Load(client_image_location + db.Item("client_picture") + ".bmp")
End If
End While
sqlconnection.Close()
End Sub
Public Sub load_car(ByVal cl_id As Integer)
corl1.Items.Clear()
sqlconnection.Open()
Dim dbquery As String = "Select * from rent_car"
cmd = New MySqlCommand(dbquery, sqlconnection)
db = cmd.ExecuteReader
While db.Read
If cl_id = db.Item("client_id") Then
corl1.Items.Add(db.Item("stock_no"))
End If
End While
sqlconnection.Close()
sqlconnection.Open()
Dim db1query As String = "Select * from rent_car"
cmd = New MySqlCommand(db1query, sqlconnection)
db = cmd.ExecuteReader
While db.Read
If cl_id = db.Item("client_id") Then
rbdl1.Text = db.Item("receive_date")
End If
End While
sqlconnection.Close()
End Sub
Public Sub del_car_list()
Dim sqlstring As String
sqlstring = "DELETE FROM rent_car where client_id = '" & cit1.Text & "' "
Try
sqlconnection.Open()
With cmd
.CommandText = sqlstring

.CommandType = CommandType.Text
.Connection = sqlconnection
.ExecuteNonQuery()
End With
MsgBox("Success")
sqlconnection.Close()
sqlconnection.Dispose()
Me.Close()
CRSCC.PictureBox1.Visible = True
Catch
MsgBox(ErrorToString)
End Try
End Sub
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
flag1 = 0
sqlconnection.Open()
Dim l As TimeSpan
Dim dbquery As String = "SELECT client_id FROM rent_car "
cmd = New MySqlCommand(dbquery, sqlconnection)
db = cmd.ExecuteReader
While db.Read
If TextBox1.Text = db.Item("client_id") Then
flag1 = 1
Exit While
End If
End While
e.Handled = True
sqlconnection.Close()
If flag1 = 1 Then
cig1.Visible = True
load_client(TextBox1.Text)
corg1.Visible = True
load_car(TextBox1.Text)
yrl1.Visible = True
yrl2.Visible = True
' Calculation of days 'is late or not
l = Date.Now - DateTime.Parse(rbdl1.Text)
If l.Days < 0 Then
yrl1.Text = " You are " & (l.Days * -1) & " Days Early "
ElseIf l.Days > 0 Then
yrl1.Text = " You are " & l.Days & " Days Late "
If l.Days < 3 Then
yrl2.Text = " You Pay Fine Of " & l.Days * 400 & "Rupees"
End If
If l.Days < 6 And l.Days > 3 Then
yrl2.Text = " You Pay Fine Of " & l.Days * 500 & "Rupees"
End If
If l.Days > 6 Then
yrl2.Text = " You Pay Fine Of " & l.Days * 800 & "Rupees"
End If
ElseIf l.Days = 0 And l.Hours < 24 Then
yrl1.Text = "You are on time "
End If
Else
cig1.Visible = False

corg1.Visible = False
yrl1.Visible = False
yrl2.Visible = False
MsgBox("Client not found")
End If
End If
End Sub
Private Sub CRSCC_Receive_back_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
sqlconnection.ConnectionString = serverstring
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Me.Close()
CRSCC.PictureBox1.Visible = True
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim Box As MsgBoxResult
If cig1.Visible = True Then
Box = MsgBox("Are You Sure", MsgBoxStyle.YesNo)
If Box = MsgBoxResult.Yes Then
del_car_list()
End If
Else
MsgBox("No Client !!!")
End If
End Sub
End Class

RENT A CAR
Imports MySql.Data.MySqlClient
Public Class CRSCC_Rent_A_Car
Dim ServerString As String = "Server=localhost;Uid=root;Pwd=crs;Database=yash"
Dim sqlconnection As MySqlConnection = New MySqlConnection
Dim db As MySqlDataReader
Dim cmd As MySqlCommand = New MySqlCommand
Dim client_image_location As String = "E:\Car Rent(project)\Images\Client_Image\"
Dim car_image_location As String = "E:\Car Rent(project)\Images\"
Dim week_no, day_no As Integer
Dim datest As Date = Date.Now
Private Sub Rent_A_Car_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
sqlconnection.ConnectionString = ServerString
date_l1.Text = Format(datest, "yyyy-MM-dd")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
sqlconnection.Open()
Dim dbquery As String = "SELECT full_name from client_information where client_id
not in(select client_id from rent_car)"

cmd = New MySqlCommand(dbquery, sqlconnection)


db = cmd.ExecuteReader
While db.Read
cnlb.Items.Add(db.Item("full_name"))
End While
sqlconnection.Close()
End Sub
Public Sub load_client()
cip1.Image = Nothing
sqlconnection.Open()
Dim dbquery As String = "SELECT * from client_information where client_id not in
(select client_id from rent_car)"
cmd = New MySqlCommand(dbquery, sqlconnection)
db = cmd.ExecuteReader
Try
While db.Read
If cnlb.SelectedItem = db.Item("full_name") Then
cit1.Text = db.Item("client_id")
cit2.Text = db.Item("full_name")
cit3.Text = db.Item("date_of_birth")
cit4.Text = db.Item("passport_no")
cit5.Text = db.Item("mobile_no")
cit6.Text = db.Item("email_id")
cit7.Text = db.Item("permanent_address")
cip1.Load(client_image_location + db.Item("client_picture") + ".bmp")
End If
End While
Catch
MsgBox("Image of client not found ")
End Try
sqlconnection.Close()
End Sub
Public Sub load_carlist()
sqlconnection.Open()
Dim dbquery As String = "SELECT * from car_information where stock_no not in
(select stock_no from rent_car)"
cmd = New MySqlCommand(dbquery, sqlconnection)
db = cmd.ExecuteReader
Try
While db.Read
If avl1.SelectedItem = db.Item("stock_no") Then
acpb1.Load(car_image_location + db.Item("picture") + ".jpg")
End If
End While
Catch
MsgBox("Image of car not found")
End Try
sqlconnection.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Me.Close()
CRSCC.PictureBox1.Visible = True
End Sub
Private Sub cnlb_MouseDoubleClick(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles cnlb.MouseDoubleClick
load_client()

End Sub
Public Sub insert_car_rent(ByRef SQLStatement As String)
Try
sqlconnection.Open()
With cmd
.CommandText = SQLStatement
.CommandType = CommandType.Text
.Connection = sqlconnection
.ExecuteNonQuery()
End With
sqlconnection.Close()
sqlconnection.Dispose()
Catch
MsgBox(ErrorToString)
End Try
End Sub
Public Sub disp_avail_car()
'Displaying available cars to avl1 list box
sqlconnection.Open()
Dim dbquery As String = "SELECT * from car_information where stock_no not in
(select stock_no from rent_car)"
cmd = New MySqlCommand(dbquery, sqlconnection)
db = cmd.ExecuteReader
Try
While db.Read
avl1.Items.Add(db.Item("stock_no"))
avl2.Items.Add(db.Item("rate_per_day"))
avl3.Items.Add(db.Item("rate_weekly"))
End While
Catch
MsgBox("No Car Available")
End Try
sqlconnection.Close()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
disp_avail_car()
End Sub
Private Sub avl1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles avl1.SelectedIndexChanged
load_carlist()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
'Adding cars to the rllb car list
Dim num As Integer
num = rllb1.Items.Count
Dim flag1 As Integer = 0
Try
If num > 0 Then
While num > 0
If avl1.SelectedItem = rllb1.Items(num - 1) Then
flag1 = 0
num = 0
Else
flag1 = 1

End If
num = num - 1
End While
Else
rllb1.Items.Add(avl1.SelectedItem)
flag1 = 2
End If
If Flag1 = 1 Then
rllb1.Items.Add(avl1.SelectedItem)
End If
If flag1 = 0 Then
MsgBox("Already Added")
End If
Catch
MsgBox(ErrorToString)
End Try
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
rllb1.Items.Remove(rllb1.SelectedItem)
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button6.Click
Dim n As Integer
n=0
Dim num As Integer
Dim SQLStatement As String
Dim startdate As String
Dim enddate As String
Dim t As TimeSpan
Dim Box As MsgBoxResult
startdate = date_l1.Text
enddate = Format(DateTimePicker1.Value.Date, "yyyy-MM-dd")
'finding total time
t = DateTime.Parse(enddate) - DateTime.Parse(startdate)
week_no = Math.Truncate(t.Days / 7)
day_no = t.Days - (week_no * 7)
If cit1.Text = "" Then
MsgBox("Select a Client")
Else
If rllb1.Items.Count < 1 Then
MsgBox("Select any car")
Else
Box = MsgBox("Are You Sure", MsgBoxStyle.YesNo)
If t.Days > 0 Then
If Box = MsgBoxResult.Yes Then
num = rllb1.Items.Count
'Inserting data into the rent_car
While n < num
SQLStatement = "INSERT INTO rent_car VALUES('" & cit1.Text & "','" &
rllb1.Items(n) & "','" & week_no & "','" & day_no & "','" & startdate & "','" & enddate & "')"
insert_car_rent(SQLStatement)
n=n+1
End While
MsgBox("done ! We are moving to bill desk")
'closing and move to parent

Bill.client_idl1.Text = cit1.Text
Bill.bdp1.Image = cip1.Image
Bill.dl1.Text = day_no
Bill.wl1.Text = week_no
Me.Close()
Bill.Show()
Else
MsgBox("Sorry")
End If
Else
MsgBox("Enter Valid Date ")
End If
End If
End If
End Sub
End Class

RENTAL DETAIL
Imports MySql.Data.MySqlClient
Public Class Rental_Detail
Dim serverstring As String = "Server=localhost;Uid=root;Pwd=crs;Database=yash"
Dim sqlconnection As MySqlConnection = New MySqlConnection
Dim db As MySqlDataReader
Dim cmd As MySqlCommand = New MySqlCommand
Dim client_image_location As String = "E:\Car Rent(project)\Images\Client_Image\"
Dim car_image_location As String = "E:\Car Rent(project)\Images\"
Dim flag1 As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.Close()
CRSCC.PictureBox1.Visible = True
End Sub
Public Sub load_car(ByVal cl_id As Integer)
sqlconnection.Open()
Dim dbquery As String = "Select * from car_information"
cmd = New MySqlCommand(dbquery, sqlconnection)
db = cmd.ExecuteReader
While db.Read
If cl_id = db.Item("stock_no") Then
cdt1.Text = db.Item("stock_no")
cdt2.Text = db.Item("reg_no")
cdt3.Text = db.Item("model")
cdt4.Text = db.Item("year")
cdt5.Text = db.Item("colour")
cdt6.Text = db.Item("class")
cdt7.Text = db.Item("engine")
rt1.Text = db.Item("rate_per_day")
rt2.Text = db.Item("rate_weekly")
drpb1.Load(car_image_location + db.Item("stock_no").ToString + ".jpg")
Exit While
End If
End While
sqlconnection.Close()
End Sub
Public Sub load_client(ByVal cl_id As Integer)
sqlconnection.Open()

Dim dbquery As String = "SELECT * FROM client_information WHERE client_id


=(SELECT client_id FROM rent_car WHERE stock_no='" & cl_id & "')"
cmd = New MySqlCommand(dbquery, sqlconnection)
db = cmd.ExecuteReader
While db.Read
'If cl_id = db.Item("client_id") Then
cit1.Text = db.Item("client_id")
cit2.Text = db.Item("full_name")
cit3.Text = db.Item("date_of_birth")
cit4.Text = db.Item("passport_no")
cit5.Text = db.Item("mobile_no")
cit6.Text = db.Item("email_id")
cit7.Text = db.Item("permanent_address")
cip1.Load(client_image_location + db.Item("client_picture") + ".bmp")
'End If
End While
sqlconnection.Close()
End Sub
Private Sub Rental_Detail_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
sqlconnection.ConnectionString = serverstring
Dim query1 As String = "SELECT stock_no FROM rent_car"
sqlconnection.Open()
cmd = New MySqlCommand(query1, sqlconnection)
db = cmd.ExecuteReader
While db.Read
ComboBox1.Items.Add(db.Item("stock_no"))
End While
sqlconnection.Close()
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
load_car(ComboBox1.SelectedItem)
load_client(ComboBox1.SelectedItem)
End Sub
End Class

VEHICLE LIST
Imports MySql.Data.MySqlClient
Public Class Vehicle_list
Dim serverstring As String = "Server=localhost;Uid=root;Pwd=crs;Database=yash"
Dim sqlconnection As MySqlConnection = New MySqlConnection
Dim db As MySqlDataReader
Dim cmd As MySqlCommand = New MySqlCommand
Dim flag1 As Integer
Dim car_image_location As String = "E:\Car Rent(project)\Images\"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.Close()
CRSCC.PictureBox1.Visible = True
End Sub
Private Sub Vehicle_list_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
sqlconnection.ConnectionString = serverstring

Dim dquery As String = "SELECT stock_no FROM car_information"


cmd = New MySqlCommand(dquery, sqlconnection)
sqlconnection.Open()
cmd = New MySqlCommand(dquery, sqlconnection)
db = cmd.ExecuteReader
While db.Read
vlb1.Items.Add(db.Item("stock_no"))
End While
sqlconnection.Close()
End Sub
Public Sub load_car(ByVal cl_id As Integer)
sqlconnection.Open()
Dim dbquery As String = "Select * from car_information"
cmd = New MySqlCommand(dbquery, sqlconnection)
db = cmd.ExecuteReader
While db.Read
If cl_id = db.Item("stock_no") Then
cdt1.Text = db.Item("stock_no")
cdt2.Text = db.Item("reg_no")
cdt3.Text = db.Item("model")
cdt4.Text = db.Item("year")
cdt5.Text = db.Item("colour")
cdt6.Text = db.Item("class")
cdt7.Text = db.Item("engine")
rt1.Text = db.Item("rate_per_day")
rt2.Text = db.Item("rate_weekly")
drpb1.Load(car_image_location + db.Item("stock_no").ToString + ".jpg")
Exit While
End If
End While
sqlconnection.Close()
End Sub
Public Sub check_rent(ByVal cl_id As Integer)
sqlconnection.Open()
Dim flag As Integer
flag = 0
Dim dbquery1 As String
dbquery1 = "SELECT * FROM rent_car"
cmd = New MySqlCommand(dbquery1, sqlconnection)
db = cmd.ExecuteReader
While db.Read
If cl_id = db.Item("stock_no") Then
flag = 1
End If
End While
sqlconnection.Close()
If flag = 1 Then
crl1.Text = "ON RENT"
Else
crl1.Text = "FREE TO RENT"
End If
End Sub
Private Sub vlb1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles vlb1.SelectedIndexChanged
load_car(vlb1.SelectedItem)
check_rent(vlb1.SelectedItem)
End Sub
End Class

GPS(TRAIL)
Imports MySql.Data.MySqlClient
Imports System.Text
Public Class GPS
Dim serverstring As String = "Server=localhost;Uid=root;Pwd=crs;Database=yash"
Dim sqlconnection As MySqlConnection = New MySqlConnection
Dim db As MySqlDataReader
Dim cmd As MySqlCommand = New MySqlCommand
Dim state As String = String.Empty
Dim country As String = String.Empty
Dim permanent As String = String.Empty
Dim queryaddress As New StringBuilder()
Private Sub close1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles close1.Click
Me.Close()
CRSCC.PictureBox1.Visible = True
End Sub
Private Sub GPS_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
sqlconnection.ConnectionString = serverstring
Dim query1 As String = "SELECT stock_no FROM rent_car"
sqlconnection.Open()
cmd = New MySqlCommand(query1, sqlconnection)
db = cmd.ExecuteReader
While db.Read
ComboBox1.Items.Add(db.Item("stock_no"))
End While
sqlconnection.Close()
End Sub
Public Sub loadstco()
Try
Dim query1 As String = "SELECT permanent_address,state,country FROM
client_information WHERE client_id=(SELECT client_id FROM rent_car WHERE stock_no='"
& ComboBox1.SelectedItem & "' )"
sqlconnection.Open()
cmd = New MySqlCommand(query1, sqlconnection)
db = cmd.ExecuteReader
While db.Read
state = db.Item("state")
country = db.Item("country")
permanent = db.Item("permanent_address")
End While
sqlconnection.Close()
sl1.Text = state
cl1.Text = country
ctl1.Text = permanent
queryaddress.Append("http://maps.google.com/maps?q=")
permanent = permanent.Replace(" ", "+")
state = state.Replace(" ", "+")
country = country.Replace(" ", "+")
queryaddress.Append(permanent + "," & "+")
queryaddress.Append(state + "," & "+")
queryaddress.Append(country + "," & "+")

WebBrowser1.Navigate(queryaddress.ToString)
queryaddress.Clear()
Catch
MsgBox("Unable To Find Location")
End Try
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
loadstco()
End Sub
End Class

BILL

Imports MySql.Data.MySqlClient
Public Class Bill
Dim num, total1 As Integer
Dim serverstring As String = "Server=localhost;Uid=root;Pwd=crs;Database=yash"
Dim sqlconnection As MySqlConnection = New MySqlConnection
Dim db As MySqlDataReader
Dim cmd As MySqlCommand = New MySqlCommand
Private Sub Closeb1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Closeb1.Click
Me.Close()
CRSCC.PictureBox1.Visible = True
End Sub
Private Sub Bill_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
Me.MdiParent = CRSCC
sqlconnection.ConnectionString = serverstring
sqlconnection.Open()
Dim dbquery As String = "SELECT * from car_information where stock_no in (select
stock_no from rent_car where client_id='" & client_idl1.Text & "')"
cmd = New MySqlCommand(dbquery, sqlconnection)
db = cmd.ExecuteReader
While db.Read
rl3.Items.Add(db.Item("stock_no"))
rl1.Items.Add(db.Item("rate_per_day"))
rl2.Items.Add(db.Item("rate_weekly"))
End While
sqlconnection.Close()
num = rl3.Items.Count
Try
While num > 0
total1 = total1 + (dl1.Text * rl1.Items(num - 1) + wl1.Text * rl2.Items(num - 1))
num = num - 1
End While
total.Text = " Rs . " & total1 & ".00"
Catch
MsgBox(ErrorToString)
End Try
End Sub
End Class

You might also like