In this section i will explain that how you can download and run Car Rental System in Asp.Net Web Forms using Visual Studio 2013 or any latest version.
If you’ve not yet downloaded the source code, please download it from the link below:
If you’ve not yet downloaded the source code, please download it from the link below:
First of all you need to extract the file anywhere in your computer.
There you’ll see two folders containing different files. You need to open project source code files folder and after that you need to open FYP-CarRentalSystem.sln file as show below:-
All project files will be shown in the Solution Explorer.
If you try to run the project it will not run and it will show an error about database. To resolve this problem you need to create a new database and run the queries as shown below:
Goto View Menu then select Server Explorer:
Then right click on Data Connection and select Add Connection:
After that you will need to follow the steps below (you can write any name of Database, its better to fill the same as shown in Figure:
Select Yes in Figure Below:
Database created and shown in the Data Connections (CarRentalSystemDB.mdf, this files will be created in your documents directory of your computer):
Right click on the Database and Select New Query
and it will show the Interface where you will enter the query and run this query:
As i have entered the code of query for database table you need to Run the code given below one by one:
Please run the code step by step.
For creating table of Users:
CREATE TABLE [dbo].[Users] ([Id] INT IDENTITY (1, 1) NOT NULL,[UserName] NVARCHAR (50) NOT NULL,[FirstName] NVARCHAR (50) NOT NULL,[LastName] NVARCHAR (50) NULL,[Password] NVARCHAR (50) NOT NULL,[EmailId] NVARCHAR (50) NOT NULL,[ContactNo] NVARCHAR (50) NOT NULL,[Address] NVARCHAR (150) NULL,[AltEmail] NVARCHAR (50) NULL,[AltContact] NVARCHAR (50) NULL,[DriverLicInfo] NVARCHAR (50) NULL,PRIMARY KEY CLUSTERED ([Id] ASC));
Copy this Code and Paste in the query then run the query:
For Table of User’s Roles (e.g. Admin, User, Dealer etc.)
CREATE TABLE [dbo].[Roles] ([Id] INT IDENTITY (1, 1) NOT NULL,[Roles] NVARCHAR (MAX) NOT NULL,PRIMARY KEY CLUSTERED ([Id] ASC));
For table Users in Roles:
CREATE TABLE [dbo].[UserInRoles] ([UserId] INT NOT NULL,[RoleId] INT NOT NULL,FOREIGN KEY ([UserId]) REFERENCES [dbo].[Users] ([Id]),FOREIGN KEY ([RoleId]) REFERENCES [dbo].[Roles] ([Id]));
For table of Car Models:
CREATE TABLE [dbo].[Models] ([ModelId] INT IDENTITY (1, 1) NOT NULL,[CarModel] NVARCHAR (30) NOT NULL,PRIMARY KEY CLUSTERED ([ModelId] ASC));
For table of Car Categories:
CREATE TABLE [dbo].[Categories] ([CategoryId] INT IDENTITY (1, 1) NOT NULL,[CarCategory] NVARCHAR (30) NOT NULL,PRIMARY KEY CLUSTERED ([CategoryId] ASC));
For table of Car Brands:
CREATE TABLE [dbo].[Brands] ([BrandId] INT IDENTITY (1, 1) NOT NULL,[CarBrand] NVARCHAR (30) NOT NULL,PRIMARY KEY CLUSTERED ([BrandId] ASC));
For table of Cars:
CREATE TABLE [dbo].[Cars] ([CarId] INT IDENTITY (1, 1) NOT NULL,[Price] NVARCHAR (50) NOT NULL,[Detail] NVARCHAR (MAX) NULL,[Image] VARBINARY (MAX) NULL,[Popular] NVARCHAR (MAX) NULL,[Damage] NVARCHAR (MAX) NULL,[Available] NVARCHAR (MAX) NULL,[ModelId] INT NULL,[BrandId] INT NULL,[CategoryId] INT NULL,[UserName] NVARCHAR (MAX) NULL,[Remarks] NVARCHAR (MAX) NULL,PRIMARY KEY CLUSTERED ([CarId] ASC),FOREIGN KEY ([CategoryId]) REFERENCES [dbo].[Categories] ([CategoryId]) ON DELETE SET NULL,FOREIGN KEY ([ModelId]) REFERENCES [dbo].[Models] ([ModelId]) ON DELETE SET NULL,FOREIGN KEY ([BrandId]) REFERENCES [dbo].[Brands] ([BrandId]) ON DELETE SET NULL);
For table Locations:
CREATE TABLE [dbo].[Locations] ([Id] INT IDENTITY (1, 1) NOT NULL,[Place] NVARCHAR (MAX) NULL,PRIMARY KEY CLUSTERED ([Id] ASC));
For Table Bookings:
CREATE TABLE [dbo].[Bookings] ([Id] INT IDENTITY (1, 1) NOT NULL,[StartTime] DATETIME NOT NULL,[EndTime] DATETIME NOT NULL,[CNICimg] VARBINARY (MAX) NOT NULL,[Place] NVARCHAR (MAX) NULL,[Charges] NVARCHAR (MAX) NOT NULL,[CarId] INT NULL,[UserName] NVARCHAR (MAX) NOT NULL,[ReturnedDate] DATETIME NULL,[PaidAmount] NVARCHAR (MAX) NULL,[SecretCode] NVARCHAR (50) NULL,[VerifyCode] NVARCHAR (50) NULL,PRIMARY KEY CLUSTERED ([Id] ASC),FOREIGN KEY ([CarId]) REFERENCES [dbo].[Cars] ([CarId]) ON DELETE SET NULL);
after creating these table, if you will refresh your Database all tables will look like:
After that you need to run two more queries. I have made two store procedures, one is for Registration of users and second one is for the authentication of users. Please run the given code below in queries again.
CREATE PROCEDURE spAuthenticateUser@UserName NVARCHAR (50),@Password NVARCHAR (50)ASbeginDeclare @Count intselect @Count = COUNT (UserName) from Userswhere [UserName]=@UserName and [Password]=@Passwordif(@Count=1)beginselect 1 as ReturnCodeEndElseBeginSelect -1 as ReturnCodeEndEnd
After that run this code:
CREATE PROCEDURE spRegisterUsers
@UserName NVARCHAR (50),
@FirstName NVARCHAR (50),@LastName NVARCHAR (50),@Password NVARCHAR (50),@EmailId NVARCHAR (50),@ContactNo NVARCHAR (50) ,@Address NVARCHAR (150) ,@AltEmail NVARCHAR (50) ,@AltContact NVARCHAR (50) ,@DriverLicInfo NVARCHAR (50)ASbeginDeclare @Count intDeclare @ReturnCode intSELECT @Count=COUNT(UserName)from Users where UserName=@UserNameif @Count > 0Beginset @ReturnCode=-1EndElseBeginSet @ReturnCode=1Insert into Users values(@UserName, @FirstName, @LastName, @Password, @EmailId,@ContactNo,@Address,@AltEmail,@AltContact,@DriverLicInfo)endSelect @ReturnCode as ReturnValueEnd
After running these queries you need to take the final step,
open the solution explorer where you can find the file web.config
If you open this file you can see the code below where you’ll need to change only the text that I’ve colored red.
<connectionStrings>
<add name=”CarRentalManagementDBConnectionString” connectionString=”Data Source=(LocalDB)v11.0;AttachDbFilename=E:All ProjectsCar Rental systemFYP-CarRentalSystem Completed-30-06-2018DatabaseCarRentalManagementDB.mdf;Integrated Security=True;Connect Timeout=30” providerName=”System.Data.SqlClient”/>
</connectionStrings>
Now you need to Right click on the Database and then select properties.
it will show the text that to be replaced in web.config file as show above.
Its all that you need to do to run the project. Now you can run the project, it is suggest to run this project using Google Chrome or you can use any browser.
If you face any problem, you can leave a comment. I’ll try my best to help you out of problem.
How to change that heading (developed by Codegainers). And that car animation.
You'll need to edit the master page, where you'll be able to see the both heading and car animation.