Hotel Booking Using C#
Hotel Booking Using C#
NEW PANVEL
PROJECT REPORT ON
“Hotel Booking System”
IN PARTIAL FULFILLMENT OF
SEMESTER V – 2023-24
PROJECT GUIDE
Name: RASHMI CHAVAN MAAM
1
8373 Manish Naik
Introduction :
Welcome to our cutting-edge Hotel Booking Application, designed and
developed using ASP.NET and C . Our application offers a seamless
and user-friendly experience for booking hotel rooms with just a few
simple steps. Whether you're a seasoned traveler or planning your first
getaway, our platform is here to make your hotel reservation process a
breeze.
To get started, users can either log in using their valid username and
password or, if they are new to our platform, they can easily register.
During registration, users are required to provide their essential details,
including a valid username, mobile number, and create a secure
password. Once the registration is complete, they are ready to explore
and make hotel room reservations.
Our application allows users to book rooms with ease by specifying
their desired check-in and check-out dates. You can easily browse
available rooms and choose the one that best suits your needs,
ensuring a comfortable and memorable stay.
To ensure data integrity and security, we utilize a SQL Server database
to store user registration details and booking information. This robust
database system provides a reliable and efficient way to manage user
accounts and bookings, guaranteeing a smooth experience for our
users.
Our project has been designed with scalability in mind. As the travel and
hospitality industry evolves, our application can easily accommodate
new features and functionalities, ensuring that it remains up-to-date and
competitive in the ever-changing market.
Whether you're planning a quick weekend getaway or an extended
vacation, our Hotel Booking Application is your trusted companion for
hassle-free room reservations. Join us today, and experience the
convenience of modern hotel booking.
2
8373 Manish Naik
HTML, CSS, and JavaScript These are the foundational technologies for
creating the user interface of our application. HTML is used for
structuring web pages, CSS for styling, and JavaScript for client-side
interactivity and validation.
ASP.NET Web Forms Web Forms is one of the classic approaches for
building web applications in ASP.NET. It uses a component-based model
and allows developers to create web pages with server-side controls,
making it relatively easy to build interactive web applications.
Components:
3
8373 Manish Naik
Code
WebForm1.aspx
<%@ Page Language="C " AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="Hotelbooking.hotel.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Hotel booking application</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="content-type" content="text/html; charset=utd-8" />
<meta name="keywords" content="Hotel Booking Widget Responsive, Login Form Web Template ,
Flat pricing Tables, Flat Drop-downs, Sign-Up Web Templates,Login Sign Responsive Web Template,
Smartphone Compatible Web Template, Free Web Designs for Nokia, Samsung , LG, Sony Ericsson,
Motorola Web Design " />
<script type="application/x-javascript">addEventListener("load",function(){setTimeout(hideURLbar,0); },
false); function hideURLbar(){window.scrollTo(0,1);}</script>
</ul>
</div>
<div class="footer">
<p>Copyright © 2023 Hotel Booking System All Rights Reserved |
Design by --><a href=" ">Manish Naik</a></p>
</div>
</div>
</form>
</body>
</html>
4
8373 Manish Naik
Booking.aspx
<%@ Page Language="C " AutoEventWireup="true" CodeBehind="Booking.aspx.cs"
Inherits="Hotelbooking.hotel.Booking" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Booking</title>
<meta name="keywords" content="Hotel Booking Widget Responsive, Login Form Web Template,
Flat Pricing Tables, Flat Drop-Downs, Sign-Up Web Templates, Flat Web Templates, Login Sign-up
Responsive Web Template, Smartphone Compatible Web Template, Free Web Designs for Nokia,
Samsung, LG, Sony Ericsson, Motorola Web Design" />
</head>
<body>
<div>
<div class="reg">
ForeColor="Blue"
5
8373 Manish Naik
onclick="LinkButton_Logout_Click">Logout</asp:LinkButton> </p>
<div class="members">
<div class="adult">
<h2>No. of Adults</h2>
<div class="dropdown-button">
<asp:ListItem Value="">0</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="5">5</asp:ListItem>
</asp:DropDownList>
</div>
</div>
<div class="child">
<h2>No. of Children</h2>
<div class="dropdown-button">
<asp:ListItem Value="">0</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
</asp:DropDownList>
</div>
</div>
<div class="clear"></div>
</div>
6
8373 Manish Naik
<div class="suite">
<div class="dropdown-button">
<h2>Suite</h2>
<asp:ListItem Value="1">-</asp:ListItem>
</asp:DropDownList>
</div>
</div>
<div class="book-pag">
<h2>Select Date</h2>
<div class="book-pag-frm1">
<label>Check In</label>
</div>
<div class="book-pag-frm2">
<label>Check Out</label>
</div>
<div class="clear"></div>
7
8373 Manish Naik
</div>
<!--Date Picker-->
<script type="text/javascript">
$(function() {
});
</script>
<!--//Date Picker-->
<%--<div class="rs">
</div>--%>
<div class="food">
<h2>Choose Cuisine</h2>
<div class="radio-btns">
<asp:ListItem Value="0">Loval</asp:ListItem>
<asp:ListItem Value="1">Multi</asp:ListItem>
</asp:RadioButtonList>
</div>
</div>
<div class="food">
<h2>Full name</h2>
<div class="radio-btns"
8
8373 Manish Naik
</div>
</div>
<div class="submit">
</div>
</div>
<div class="reg-footer">
<p>Copyright © 2021 Booking . All Rights Reserved | Design by <a href=" ">Manda
Sagar</a></p>
</div>
</div>
</form>
</body>
</html>
Booking.aspx.cs
using System;
using
System.Collections.Generic;
using System.Data;
using
System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Web;
using
System.Web.UI;
using System.Web.UI.WebControls;
namespace Hotelbooking.hotel
{
public partial class Booking : System.Web.UI.Page
{
SqlConnection c = new SqlConnection(@"Data
Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Sagar\Desktop\Hotelbooking\Hotelb
ooking\App_Data\Database12.mdf;Integrated Security=True");
SqlCommand
cmd; string str;
protected void Page_Load(object sender, EventArgs e)
{
9
8373 Manish Naik
Admin.aspx
<%@ Page Language="C " AutoEventWireup="true" CodeBehind="Admin.aspx.cs"
Inherits="Hotelbooking.Admin" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
color:
000066;
font-size: x-large;
}
.auto-style2 {
text-align: center;
}
.auto-style3 {
font-size: x-large;
}
.auto-style4 {
font-size: xx-large;
}
.auto-style5 {
font-size: x-large;
color: 000000;
}
10
8373 Manish Naik
</style>
11
8373 Manish Naik
Admin.aspx.cs
using System;
using
System.Collections.Generic;
using System.Linq;
using System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
namespace Hotelbooking
{
public partial class Admin : System.Web.UI.Page
{
SqlConnection c = new SqlConnection(@"Data
Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database12.mdf;Integrated
Security=True");
protected void Page_Load(object sender, EventArgs e)
{
}
public void display()
{
c.Open();
SqlCommand cmd=c.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from bookingtable ";
cmd.ExecuteNonQuery();
DataTable dt = new DataTable();
SqlDataAdapter da=new
SqlDataAdapter(cmd); da.Fill(dt);
GridView1.DataSource =
dt; GridView1.DataBind();
c.Close();
}
12
8373 Manish Naik
Login.aspx
<%@ Page Language="C " AutoEventWireup="true" CodeBehind="Login.aspx.cs"
Inherits="Hotelbooking.hotel.Login" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Login</title>
<!-- meta tags -->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="keywords" content="Art Sign Up Form Responsive Widget, Audio and Video players,
Login Form Web Template, Flat Pricing Tables, Flat Drop-Downs, Sign-Up Web Templates,
Flat Web Templates, Login Sign-up Responsive Web Template, Smartphone
Compatible Web Template, Free Web Designs for Nokia, Samsung, LG, Sony Ericsson, Motorola
Web Design"
/>
<!-- /meta tags -->
<!-- custom style sheet -->
<link href="css/style.css" rel="stylesheet" type="text/css" />
<!-- /custom style sheet -->
<!-- fontawesome css -->
<link href="css/fontawesome-all.css" rel="stylesheet" />
<!-- /fontawesome css -->
<!-- google fonts-->
<link
href="//fonts.googleapis.com/css?family=Raleway:100,100i,200,200i,300,300i,400,400i,500,500i,600,
60 0i,700,700i,800,800i,900,900i" rel="stylesheet"/>
<!-- /google fonts-->
<style type="text/css">
.auto-style1 {
font-weight: bold;
}
.auto-style2 {
font-size: larger;
}
.auto-style3 {
color: fff;
font-size: x-large;
}
.auto-style4 {
font-size: x-large;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
13
8373 Manish Naik
<form>
<div style="position: static" align="center" >
<span class="auto-
style1"> </span><asp:LinkButton ID="LinkButton2" runat="server" Font-Bold="True"
Font-Size="30px" Font-Underline="True" ForeColor="Blue" onclick="LinkButton2_Click"
CssClass="auto-style1" style=""
>Forgot Paassword</asp:LinkButton>
<span class="auto-style1"> </span>
<%-- <a href=" ">Forgot Password?</a>--%>
<br />
<p>
<asp:CheckBox ID="CheckBox1" runat="server" />Remember Me</p>
<p>
</p>
</div>
14
8373 Manish Naik
<br />
<br />
</form>
<p class=" w3l-register-p">
Login.aspx.cs
using System;
using
System.Collections.Generic;
using System.Linq;
using System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
namespace Hotelbooking.hotel
{
public partial class Login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
15
8373 Manish Naik
Registration.aspx
<%@ Page Language="C " AutoEventWireup="true" CodeBehind="Registration.aspx.cs"
Inherits="Hotelbooking.LoginRegis.Registration" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Registration</title>
<meta name="keywords" content="Art Sign Up Form Responsive Widget, Audio and Video players,
Login Form Web Template, Flat Pricing Tables, Flat Drop-Downs, Sign-Up Web Templates,
/>
17
8373 Manish Naik
<link
href="//fonts.googleapis.com/css?family=Raleway:100,100i,200,200i,300,300i,400,400i,500,500i,600,
600i
,700,700i,800,800i,900,900i"
rel="stylesheet"/>
<style type="text/css">
.auto-style1 {
font-size: larger;
.auto-style2 {
font-size: larger;
color:
FFFFFF;
</style>
</head>
<body>
<div>
</div>
<div class="group">
</div>
</div>
18
8373 Manish Naik
<div class="group">
<br />
</div>
<div
class="group">
<br />
</div>
<div
class="group">
<br />
</div>
</div>
<div class="group">
19
8373 Manish Naik
<br />
</div>
</div>
<div class="group">
<br />
</div>
</div>
<div class="forgot">
<p>
<p>
</p>
</div>
<br />
</form>
20
8373 Manish Naik
</div>
<footer>
</footer>
</div>
</body>
</html>
Registration.aspx.cs
using System;
using
System.Collections.Generic;
using System.Linq;
using System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
namespace Hotelbooking.LoginRegis
{
public partial class Registration : System.Web.UI.Page
{
SqlConnection c = new SqlConnection(@"Data
Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database12.mdf;Integrated
Security=True");
SqlCommand cmd ;
string str;
protected void Page_Load(object sender, EventArgs e)
{
}
21
8373 Manish Naik
catch(Exception ex)
{
Response.Write(ex.ToString());
}
}
}
}
forgetpass.aspx
<%@ Page Language="C " AutoEventWireup="true" CodeBehind="forgetpass.aspx.cs"
Inherits="Hotelbooking.LoginRegis.forgetpass" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Forget password</title>
<meta name="keywords" content="Art Sign Up Form Responsive Widget, Audio and Video players,
Login Form Web Template, Flat Pricing Tables, Flat Drop-Downs, Sign-Up Web Templates,
/>
<link
href="//fonts.googleapis.com/css?family=Raleway:100,100i,200,200i,300,300i,400,400i,500,500i,600,
600i
,700,700i,800,800i,900,900i"
22
8373 Manish Naik
rel="stylesheet"/>
<style type="text/css">
.auto-style1 {
font-size: larger;
.auto-style2 {
color: fff;
font-size: x-large;
.auto-style3 {
font-size: x-large;
</style>
</head>
<body>
<form runat="server">
</div>
<div class="group">
<br />
<div class="group">
<br />
<br />
</div>
</div>
<div class="group">
<br />
<br />
</div>
<div class="group">
<br />
<br />
<asp:Button ID="btn_fpass_pass" runat="server" Text="Forget Password"
BackColor="Blue" Font-Bold="True" Font-Size="Medium" ForeColor=" FFFFCC"
OnClick="btn_fpass_pass_Click" Height="44px" Width="361px"
/>
<br />
<br />
</p>
</p>
<footer>
</footer>
</form>
</body>
</html>
forgetpass.aspx.cs
using System;
using
System.Collections.Generic;
using System.Linq;
using System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
namespace Hotelbooking.LoginRegis
{
public partial class forgetpass : System.Web.UI.Page
{
8373 Manish Naik
SqlCommand cmd;
cmd = c.CreateCommand();
cmd.CommandType =
CommandType.Text;
cmd.CommandText = "select mobile,email from usertable where
mobile="+txt_fpass_mobile.Text+" and email='"+txt_fpass_Email.Text+"'";
cmd.ExecuteNonQuery();
DataTable dt = new
DataTable();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
if(dt.Rows.Count > 1 )
{
try
{
cmd=c.CreateCommand();
cmd.CommandType =
CommandType.Text;
cmd.CommandText = "update usertable set pass ='"+txt_fpass_newpass.Text+"' where
mobile="+Convert.ToInt32(txt_fpass_mobile.Text)+" and email='"+txt_fpass_Email.Text+"'";
cmd.ExecuteNonQuery();
MainBooking.aspx
<%@ Page Language="C " AutoEventWireup="true" CodeBehind="MainBooking.aspx.cs"
Inherits="Hotelbooking.hotel.MainBooking" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Main Booking</title>
<!-- For-Mobile-Apps -->
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="Hotel Booking Widget Responsive, Login Form Web Template,
Flat Pricing Tables, Flat Drop-Downs, Sign-Up Web Templates, Flat Web Templates, Login Sign-up
Responsive Web Template, Smartphone Compatible Web Template, Free Web Designs for Nokia,
Samsung, LG, Sony Ericsson, Motorola Web Design" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar,
0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- //For-Mobile-Apps -->
</head>
<body>
<form id="form1" runat="server">
<div>
<div class="reg">
<div class="members">
<div class="adult">
<h2>No. of Adults</h2>
<div class="dropdown-button">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="DropDownList1" Display="Dynamic" ErrorMessage="Please Select"
ForeColor="Black" SetFocusOnError="True" ToolTip="Select Num Of Adults
">*</asp:RequiredFieldValidator>
<asp:DropDownList ID="DropDownList1" class="dropdown" runat="server"
tabindex="10" data-settings='{"wrapperClass":"flat"}'>
<asp:ListItem Value="">0</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="5">5</asp:ListItem>
</asp:DropDownList>
8373 Manish Naik
</div>
</div>
<div class="child">
<h2>No. of Children</h2>
<div class="dropdown-button">
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="DropDownList2" Display="Dynamic" EnableViewState="False"
ErrorMessage="Please Select " ForeColor="Black" SetFocusOnError="True" ToolTip="Select Num of
Children">*</asp:RequiredFieldValidator>
</asp:DropDownList>
</div>
</div>
<div class="clear"></div>
</div>
<div class="suite">
<div class="dropdown-button">
<h2>Suite</h2>
</asp:DropDownList>
</div>
</div>
<div class="book-pag">
<h2>Select Date</h2>
<div class="book-pag-frm1">
<label>Check In</label>
8373 Manish Naik
<!--Date Picker-->
</script>
<!--//Date Picker-->
<%--<div class="rs">
<div class="check_box"> <div class="radio"> <label><input
type="checkbox" name="radio" checked=""><i></i>Enable Room Service</label> </div></div>
</div>--%>
<div class="food">
<h2>Choose Cuisine</h2>
<div class="radio-btns">
</div>
</div>
<div class="food">
<h2>Full name</h2>
<div class="radio-btns"
style="font-size: x-large; font-weight: bold; background-color: 0000FF">
</div>
<div class="reg-footer">
<p><strong>Copyright © 2021 Booking . All Rights Reserved | Design by Manda
Sagar</strong></p>
</div>
</div>
</form>
</body>
</html>
MainBooking.aspx.cs
using System;
using
System.Collections.Generic;
using System.Linq;
using System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
namespace Hotelbooking.hotel
{
public partial class MainBooking : System.Web.UI.Page
{
SqlConnection c = new SqlConnection(@"Data
Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database12.mdf;Integrated
Security=True");
SqlCommand cmd;
try
{
c.Open();
string str = "insert into bookingtable
values('"+DropDownList1.SelectedValue+"','"+DropDownList2.SelectedValue+"','"+DropDownList3.Sel
e
ctedValue+"','"+datepicker1.Text+"','"+datepicker2.Text+"','"+RadioButtonList1.SelectedValue+"','"+txt_
fu lname.Text+"')";
cmd= new
SqlCommand(str,c);
cmd.ExecuteNonQuery();
c.Close();
Response.Write("<script>alert('Booking successful. ')</script>");
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}
OUTPUT:
8373 Manish Naik
User can Check the Booking list And Select the Dates
Accordingly(Booking.aspx)
Booking Table
8373 Manish Naik
User Table
8373 Manish Naik
Conclusion:
In conclusion, the Hotel Booking System developed using
asp.Net and C has successfully demonstrated the practical
application of various essential concepts in web development,
such as Validation Controls, GridView, and rich controls like
the Calendar. This project has not only enriched our
understanding of these technologies but has also contributed
to making the process of booking hotel rooms online more
flexible and convenient for users.
By offering features like room selection, date validation, and
payment processing, this system has simplified the
reservation process, making it more accessible to a wider
audience. Additionally, the incorporation of a rich control like
the Calendar has enhanced the user experience by providing
an intuitive way to select dates.
Furthermore, this project highlights the significance of web-
based systems in the modern world, where online transactions
and reservations have become the norm. It serves as a
valuable learning experience, bridging the gap between theory
and practical implementation, and equipping us with the skills
necessary to tackle real-world web development challenges.