Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
457 views39 pages

Hotel Booking Using C#

The document describes a hotel booking system project built using ASP.NET and C#. It allows users to register, login, search for available rooms by date, and make reservations. It stores user and booking data securely in a SQL Server database.

Uploaded by

Manish Naik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
457 views39 pages

Hotel Booking Using C#

The document describes a hotel booking system project built using ASP.NET and C#. It allows users to register, login, search for available rooms by date, and make reservations. It stores user and booking data securely in a SQL Server database.

Uploaded by

Manish Naik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

MAHATMA EDUCATION SOCIETY’S

PILLAI COLLEGE OF ARTS, COMMERCE & SCIENCE


(Autonomous)

NEW PANVEL

PROJECT REPORT ON
“Hotel Booking System”

IN PARTIAL FULFILLMENT OF

BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

SEMESTER V – 2023-24

PROJECT GUIDE
Name: RASHMI CHAVAN MAAM

SUBMITTED BY: Manish Naik


ROLL NO: 8373

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

Tools & Techniques :


In our Hotel Booking Application developed using ASP.NET and C ,
we have utilized a range of tools and techniques to ensure its
functionality, security, and scalability. Here's a description of some of
the key tools and techniques used in the project:

ASP.NET🡪ASP.NET is the core technology behind our web application.


It provides a robust framework for building web applications, including
features like web forms, and robust server-side programming
capabilities.
C is C the primary programming language used in our application. It
is a versatile and powerful language that integrates seamlessly with
ASP.NET and allows for efficient server-side coding and logic
implementation.
SQL Server Database We employ Microsoft SQL Server as our
database management system. SQL Server is renowned for its
reliability, scalability, and security features, making it an ideal choice for
storing user registration data and booking details securely.

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:

Validation Controls In this project, we have used various validation


controls like RequiredFieldValidator, RequiredFieldValidator,
CompareValidator to validate the user input from any unwanted errors.

GridView The GridView control in ASP.NET is used to display and


manipulate tabular data in a grid format.

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>

<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />


</head>
<body>
<form id="form1" runat="server">
<div>
<h1>HOTEL BOOKING WIDGET</h1>
<div class="hotel">
<ul class="menu">
<li class="item1">
<a href="">CHOOSE YOUR HOTEL<i class="menu-down"><img src="images/down.png" alt=""</i></a>
<ul class="cute">
<li class="subitem1"><a href="Booking.aspx">AVENSIS</a></li>
<li class="subitem2"><a href="Booking.aspx">OBEROI GRAND</a></li>
<li class="subitem3"><a href="Booking.aspx">IMPERIAL </a></li>
<li class="subitem3"><a href="Booking.aspx">LEELA PALACE</a></li>
<li class="subitem1"><a href="Booking.aspx">AHILYA BY THE SEA</a></li>
<li class="subitem2"><a href="Booking.aspx">CABO SERAI</a></li>
<li class="subitem3"><a href="Booking.aspx">TAJ SAFARIS</a></li>
<li class="subitem3"><a href="Booking.aspx">RAAS CHHATRA SAGAR</a></li>
<li class="subitem3"><a href="Booking.aspx">SHREYAS</a></li>
</ul>
</li>

</ul>
</div>
<div class="footer">
<p>Copyright &copy; 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>

<!-- 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 -->

<!-- Style --> <link rel="stylesheet" href="css/style.css" type="text/css" media="all" />

<link rel="stylesheet" href="css/jquery-ui.css" />

<!-- JavaScript --> <script type="text/javascript" src="js/jquery.min.js"></script>

</head>

<body>

<form id="form1" runat="server">

<div>

<h1 class="book">HOTEL BOOKING </h1>

<div class="reg">

<h1>Book Your Suite!</h1><p>

<asp:LinkButton ID="LinkButton_Logout" runat="server"

Font-Bold="True" Font-Size="Medium" Font-Underline="True"

ForeColor="Blue"

5
8373 Manish Naik

onclick="LinkButton_Logout_Click">Logout</asp:LinkButton>&nbsp;&nbsp;&nbsp;</p>

<div class="members">

<div class="adult">

<h2>No. of Adults</h2>

<div class="dropdown-button">

<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>

</div>

</div>

<div class="child">

<h2>No. of Children</h2>

<div class="dropdown-button">

<asp:DropDownList ID="DropDownList2" 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:DropDownList>

</div>

</div>

<div class="clear"></div>

</div>

6
8373 Manish Naik

<div class="suite">

<div class="dropdown-button">

<h2>Suite</h2>

<asp:DropDownList ID="DropDownList3" class="dropdown"


runat="server" tabindex="10" data-settings='{"wrapperClass":"flat"}'>

<asp:ListItem Value="1">-</asp:ListItem>

<asp:ListItem Value="1">Single Room</asp:ListItem>

<asp:ListItem Value="2">Premium Single Room</asp:ListItem>

<asp:ListItem Value="2">Double Room</</asp:ListItem>

<asp:ListItem Value="2">Premium Double Room</asp:ListItem>

<asp:ListItem Value="3">Deluxe Suite</asp:ListItem>

<asp:ListItem Value="4">Executive Suite</asp:ListItem>

<asp:ListItem Value="4">Ocean View Suite</asp:ListItem>

<asp:ListItem Value="4">Presidential Suite</asp:ListItem>

<asp:ListItem Value="3">The Penthouse</asp:ListItem>

</asp:DropDownList>

</div>

</div>

<div class="book-pag">

<h2>Select Date</h2>

<div class="book-pag-frm1">

<label>Check In</label>

<asp:TextBox ID="datepicker1" class="date" runat="server" value="Date" onblur="if (this.value


== '') {this.value = '';}"
required=""></asp:TextBox>

<%--<input class="date" id="datepicker1" type="text" value="Date" onfocus="this.value = '';"


onblur="if (this.value == '') {this.value = '';}" required="">--%>

</div>

<div class="book-pag-frm2">

<label>Check Out</label>

<asp:TextBox ID="datepicker2" class="date" runat="server" value="Date" onfocus="this.value = '';"


onblur="if (this.value == '') {this.value = '';}" required=""></asp:TextBox>

<%--<input class="date" id="datepicker2" type="text" value="Date" onfocus="this.value = '';"


onblur="if (this.value == '') {this.value = '';}" required="">--%>

</div>

<div class="clear"></div>

7
8373 Manish Naik

</div>

<!--Date Picker-->

<script src="js/jquery-ui.js" type="text/javascript"></script>

<script type="text/javascript">

$(function() {

$( " datepicker, datepicker1, datepicker2" ).datepicker();

});

</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">

<asp:RadioButtonList ID="RadioButtonList1" runat="server">

<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"

style="font-size: x-large; font-weight: bold; background-color: 0000FF">

<asp:TextBox ID="txt_fulname" runat="server" Width="509px"></asp:TextBox>

8
8373 Manish Naik

</div>

</div>

<div class="submit">

<asp:Button ID="Bt_submit" runat="server" class="book" Text="Book Now"

onclick="Bt_submit_Click" />&nbsp&nbsp&nbsp<asp:Button ID="Button_print"

runat="server" Text="Chek Availaibility" BackColor="Black" Font-Bold="True"

Font-Size="Medium" ForeColor="White" Width="169px" OnClick="Button_print_Click" />

<%--<input type="submit" class="book" value="BOOK NOW">--%>

</div>

</div>

<div class="reg-footer">

<p>Copyright &copy; 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

protected void Bt_submit_Click(object sender, EventArgs e)


{
try
{
Response.Redirect("../LoginRegis/Login.aspx");
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}

protected void LinkButton_Logout_Click(object sender, EventArgs e)


{
Response.Redirect("../hotel/WebForm1.aspx");
}

protected void Button_print_Click(object sender, EventArgs e)


{
Response.Redirect("../LoginRegis/Admin.aspx");
}
}
}

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>

<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>

<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />


</head>
<body>
<div class="footer">
<p class="auto-style5"><strong class="auto-style4">|Check the Availaibiltiy Of the
Slots|</strong></p>
</div>
<form id="form1" runat="server">
<div>
<div class="auto-style2">
<br />
&nbsp;
<asp:Button ID="Button1" runat="server" CssClass="auto-style1" Height="42px"
OnClick="Button1_Click" Text="Check" Width="193px" />
<br />
<br />
</div>
<br />
&nbsp;<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3"
CellSpacing="1" GridLines="None" Height="394px"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged" Width="1341px">
<Columns>
<asp:BoundField DataField="rid" HeaderText="Reservation Id" />
<asp:BoundField DataField="fname" HeaderText="Registered Name" />
<asp:BoundField DataField="checkin" HeaderText="Checkin Date"
DataFormatString="{0:D}" />
<asp:BoundField DataField="checkout" HeaderText="Checkout Date"
DataFormatString="{0:D}" />
</Columns>
<FooterStyle BackColor=" C6C3C6" ForeColor="Black" />
<HeaderStyle BackColor=" 4A3C8C" Font-Bold="True" ForeColor=" E7E7FF" />
<PagerStyle BackColor=" C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
<RowStyle BackColor=" DEDFDE" ForeColor="Black" />
<SelectedRowStyle BackColor=" 9471DE" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor=" F1F1F1" />
<SortedAscendingHeaderStyle BackColor=" 594B9C" />
<SortedDescendingCellStyle BackColor=" CAC9C9" />
<SortedDescendingHeaderStyle BackColor=" 33276A" />
</asp:GridView>
<br />
<br />
</div>
<div class="footer">

11
8373 Manish Naik

<p><span class="auto-style3"><strong>Copyright &copy; 2023 Hotel Booking System All


Rights Reserved | Design by --></strong></span><a href=" " class="auto-style3"><strong>Manda
Sagar</strong></a></p>
</div>
</form>
</body
>
</html>

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();
}

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)


{

protected void Button1_Click(object sender, EventArgs e)


{
display();
}
}
}

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>

<h1>Online Hotel Booking Login</h1>


<p>&nbsp;</p>
<p>&nbsp;</p>
<div class=" w3l-login-form">

13
8373 Manish Naik

<h2 font-color="Black" style="color: 000000; font-size: 21px; font-weight: bolder; background-


color: FFFFFF; position: center;"> Sign In Here</h2>
<p>&nbsp;</p>
</div>

<div class=" w3l-form-group">


&nbsp;<div class="group" align="center">
&nbsp;
<i class="fas fa-user"></i>
<asp:TextBox ID="txt_login_username" class="form-control" placeholder="Username"
runat="server" BorderStyle="Solid" Height="45px" Width="258px"></asp:TextBox>
<%--<input type="text" class="form-control" placeholder="Username"
required="required" />--%>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txt_login_username" Display="Dynamic" EnableViewState="False"
ErrorMessage="Cannot Be Empty" ForeColor="Red" SetFocusOnError="True" ToolTip="Enter The
Username" Height="40px" Width="20px">*</asp:RequiredFieldValidator>
<br />
</div>
</div>

<div class=" w3l-form-group">


&nbsp;<div class="group" align="center">
&nbsp; <i class="fas fa-unlock"></i>
<asp:TextBox ID="txt_login_password" TextMode=Password class="form-control"
placeholder="Password" runat="server" BorderStyle="Solid" Height="45px"
Width="258px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="txt_login_password" Display="Dynamic" ErrorMessage="Enter The Valid Pass"
ForeColor=" FF3300" SetFocusOnError="True" ToolTip="Enter the pass" Height="40px"
Width="20px">*</asp:RequiredFieldValidator>
<br />
<br />
<br />
</div>
</div>

<form>
<div style="position: static" align="center" >
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="auto-
style1">&nbsp;</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">&nbsp;&nbsp;&nbsp;</span>
<%-- <a href=" ">Forgot Password?</a>--%>
<br />
<p>
&nbsp;<asp:CheckBox ID="CheckBox1" runat="server" />Remember Me</p>
<p>
&nbsp;</p>
</div>

<asp:Button ID="btn_login" runat="server" Text="Login"


BackColor="Blue" Font-Bold="True" Font-Size="25px" ForeColor="
FFFFCC"

14
8373 Manish Naik

onclick="btn_login_Click" Height="45px" Width="258px" />

<br />

<br />

</form>
<p class=" w3l-register-p">

<asp:LinkButton ID="LinkButton1" runat="server" Font-Bold="True"


Font-Size="25px" Font-Underline="True" ForeColor="DarkBlue"
onclick="LinkButton1_Click">Sign Up</asp:LinkButton> &nbsp;
</p>
<p class=" w3l-register-p">
&nbsp;</p>
<p class=" w3l-register-p">
&nbsp;&nbsp;&nbsp;&nbsp;
</p>
<p class=" w3l-register-p">
&nbsp;</p>
<p class=" w3l-register-p">
&nbsp;</p>
<p class=" w3l-register-p">
&nbsp;</p>
<%--<p class=" w3l-register-p">Sign Up<a href="Registration.aspx" class="register">
Registration</a></p>--%>
</div>
<footer>
<p class="txt-center"> <span class="fa-inverse"> <strong class="auto-style4">&copy; 2023 Login
. All Rights Reserved | Design by Reserved | Design by </strong> </span> <a href="
"><strong class="auto-style2"><span class="auto-style3">Manda
Sagar</span></strong></a></p>
</footer>
</div>
</form>
</body>
</html>

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)
{

protected void btn_login_Click(object sender, EventArgs e)

15
8373 Manish Naik

SqlConnection c = new SqlConnection(@"Data


Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database12.mdf;Integrated
Security=True");
SqlCommand cmd;
SqlDataAdapter da=new SqlDataAdapter();
DataTable dt= new DataTable();

string str = "select uname,pass from usertable where uname='"+txt_login_username.Text+"'


and pass='"+txt_login_password.Text+"'";
da= new SqlDataAdapter(str,c);
da.Fill(dt);
if(dt.Rows.Count > 0 )
{
Response.Redirect("../hotel/MainBooking.aspx");
}
}

protected void LinkButton1_Click(object sender, EventArgs e)


{
Response.Redirect("Registration.aspx");
}

protected void LinkButton2_Click(object sender, EventArgs e)


{
Response.Redirect("forgetpass.aspx");
}
}
}

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 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 -->

17
8373 Manish Naik

<!-- 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,
600i
,700,700i,800,800i,900,900i"

rel="stylesheet"/>

<!-- /google fonts-->

<style type="text/css">

.auto-style1 {

font-size: larger;

.auto-style2 {

font-size: larger;

color:

FFFFFF;

</style>

</head>

<body>

<form id="form1" runat="server">

<div>

<h1>Online Hotel Booking Registration</h1>

<div class=" w3l-login-form">

<h2 style="color: 000000; font-size: 22px; background-color: FFFFFF;"> Sign Up Here</h2>

</div>

<div class=" w3l-form-group">

&nbsp;<div class="group">

</div>

</div>

18
8373 Manish Naik

<div class=" w3l-form-group">

&nbsp;<div class="group">

<i class="fas fa-user"></i>

<asp:TextBox ID="txt_username" class="form-control" placeholder="Username"


runat="server" Height="50px" Width="275px"></asp:TextBox>

<%--<input type="text" class="form-control" placeholder="Username"


required="required" />--%>

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"


ControlToValidate="txt_username" EnableViewState="False" ErrorMessage="Enter the username"
ForeColor="Black" SetFocusOnError="True" ToolTip="Username">*</asp:RequiredFieldValidator>

<br />

</div>

&nbsp;<div

class="group">

<i class="fas fa-user"></i>

<asp:TextBox ID="txt_mobile" class="form-control" placeholder="Mobile Number"


runat="server" Height="50px" Width="275px"></asp:TextBox>

<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"


ControlToValidate="txt_mobile" Display="Dynamic" EnableViewState="False"
ErrorMessage="Phone number Must be Of 10 Digits" ForeColor="Black" SetFocusOnError="True"
ToolTip="Mobile Number" ValidationExpression="^([\+]?(?:00)?[0-9]{1,3}[\s.-]?[0-9]{1,12})([\s.-]?[0-
9]{1,4}?)$">*</asp:RegularExpressionValidator>

<br />

</div>

&nbsp;<div

class="group">

<i class="fas fa-user"></i>

<asp:TextBox ID="txt_email" class="form-control" placeholder="Email ID" runat="server"


Height="50px" Width="275px"></asp:TextBox>

<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server"


ControlToValidate="txt_email" Display="Dynamic" EnableViewState="False" ErrorMessage="Enter
a Valid Email" ForeColor="Black" SetFocusOnError="True" ToolTip="Email "
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-
.]\w+)*">*</asp:RegularExpressionValidator>

<br />

</div>

</div>

<div class=" w3l-form-group">

&nbsp;<div class="group">

<i class="fas fa-unlock"></i>

19
8373 Manish Naik

<asp:TextBox ID="txt_password" TextMode=Password class="form-control"


placeholder="Password" runat="server" Height="50px" Width="275px"></asp:TextBox>

<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"


ControlToValidate="txt_password" Display="Dynamic" EnableViewState="False"
ErrorMessage="Enter Password" ForeColor="Black"
ToolTip="Password">*</asp:RequiredFieldValidator>

<br />

</div>

</div>

<div class=" w3l-form-group">

&nbsp;<div class="group">

<i class="fas fa-unlock"></i>

<asp:TextBox ID="txt_cpass" TextMode="Password" class="form-control"


placeholder="Confirm Password" runat="server" Height="50px" Width="275px"></asp:TextBox>

<asp:CompareValidator ID="CompareValidator1" runat="server"


ControlToCompare="txt_password" ControlToValidate="txt_cpass" Display="Dynamic"
EnableViewState="False" ErrorMessage="Password do not match" ForeColor="Black"
SetFocusOnError="True" ToolTip="Re-Enter The Password">*</asp:CompareValidator>

<br />

</div>

</div>

<div class="forgot">

<p>

<asp:CheckBox ID="CheckBox1" runat="server" /><span class="auto-


style1"><strong>Remember Me</strong></span></p>

<p>

&nbsp;</p>

</div>

<asp:Button ID="btn_submit" runat="server" Text="Registration"

BackColor="Blue" Font-Bold="True" Font-Size="Medium" ForeColor="

FFFFCC" onclick="btn_submit_Click" Height="56px" Width="461px" />

<br />

</form>

<p class=" w3l-register-p" >

20
8373 Manish Naik

<span class="auto-style2"><strong>Sign IN : </strong> </span><<a


href="Login.aspx" style="font-size:30px;color:aliceblue" class="register" " >
&nbsp;Login</a></p>

<p class=" w3l-register-p">&nbsp;</p>

</div>

<footer>

<p class="auto-style2"> <strong style="border-width: thick; border-left-color:


000000">&copy; 2023 Login . All Rights Reserved | Design by Manda Sagar</strong></p>

</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)
{

protected void btn_submit_Click(object sender, EventArgs e)


{
try
{
c.Open();
str = "insert into usertable
values('"+txt_username.Text+"',"+txt_mobile.Text+",'"+txt_email.Text+"','"+txt_cpass.Text+"')";
cmd=new
SqlCommand(str,c);
cmd.ExecuteNonQuery();
Response.Write("<script>alert('Data Submitted ')</script>");
c.Close();

}
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 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,
600i
,700,700i,800,800i,900,900i"

22
8373 Manish Naik

rel="stylesheet"/>

<!-- /google fonts-->

<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">

<h1>Online Hotel Booking Login</h1>

<div class=" w3l-login-form">

<h2 style="font-weight: bolder; color: 000000; background-color: FFFFFF">Forget password


Here</h2>

</div>

<div class=" w3l-form-group">

&nbsp;<div class="group">

<br />

<i class="fas fa-user"></i>

<asp:TextBox ID="txt_fpass_mobile" class="form-control" placeholder="Mobile" runat="server"


Height="40px" Width="258px"></asp:TextBox>

<%--<input type="text" class="form-control" placeholder="Username" required="required" />--%>

<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"


ControlToValidate="txt_fpass_mobile" Display="Dynamic" EnableViewState="False"
ErrorMessage="Enter Mobile" ForeColor=" FF3300" SetFocusOnError="True"
23
</div>
<br />
8373 Manish Naik

<div class="group">

<br />

<i class="fas fa-user"></i>

<asp:TextBox ID="txt_fpass_Email" class="form-control" placeholder="Email ID"


runat="server" Height="40px" Width="258px"></asp:TextBox>

<%--<input type="text" class="form-control" placeholder="Username"


required="required" />--%>

<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"


ControlToValidate="txt_fpass_mobile" Display="Dynamic" EnableViewState="False"
ErrorMessage="Enter a Valid Email" ForeColor=" FF3300" SetFocusOnError="True"
ToolTip="Email">*</asp:RequiredFieldValidator>

<br />

</div>

</div>

<div class="group">

<br />

<i class="fas fa-unlock"></i>

<asp:TextBox ID="txt_fpass_oldpass" TextMode="Password" class="form-control"


placeholder="Old Password" runat="server" Height="40px" Width="257px"></asp:TextBox>

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"


ControlToValidate="txt_fpass_oldpass" EnableViewState="False" ErrorMessage="Cannot be Empty"
ForeColor=" FF3300" Height="40px" SetFocusOnError="True" ToolTip="Old Password"
Width="20px">*</asp:RequiredFieldValidator>

<br />

</div>

<div class="group">

<br />

<i class="fas fa-unlock"></i>

<asp:TextBox ID="txt_fpass_newpass" TextMode="Password" class="form-control"


placeholder="New Password" runat="server" Height="40px" Width="258px"></asp:TextBox>

<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"


ControlToValidate="txt_fpass_newpass" Display="Dynamic" EnableViewState="False"
ErrorMessage="Cannot be Empty" ForeColor=" FF3300" SetFocusOnError="True" ToolTip="New
25
</div>
<br />
8373 Manish Naik

<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 class=" w3l-register-p">


<asp:LinkButton ID="LinkButton_fpass_signin" runat="server"

Font-Bold="True" Font-Size="25px" Font-Underline="True" ForeColor="Blue"

OnClick="LinkButton_fpass_signin_Click" >Sign In</asp:LinkButton> </p>

<p class=" w3l-register-p">

&nbsp;</p>

<p class=" w3l-register-p">

&nbsp;</p>

<%--<p class=" w3l-register-p">Sign Up<a href="Registration.aspx"


class="register"> Registration</a></p>--%>

<footer>

<p class="copyright-agileinfo"> <span class="fa-inverse"> <strong class="auto-style3">&copy;


2023 Login . All Rights Reserved | Design by </strong> </span> <a href=" "><strong class="auto-
style1"><span class="auto-style2">Manda Sagar</span></strong></a></p>

</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

SqlConnection c = new SqlConnection(@"Data


Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database12.mdf;Integrated
Security=True");
protected void Page_Load(object sender, EventArgs e)
{
if(c.State==ConnectionState.Open)
{
c.Close();
}
c.Open();

protected void btn_fpass_pass_Click(object sender, EventArgs e)


{

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();

Response.Write("<script>alert('Forget password successfully...')</script>");


c.Close();
}
catch(Exception ex)
{
Response.Write(ex.ToString());
}
}
}

protected void LinkButton_fpass_signin_Click(object sender, EventArgs e)


{
Response.Redirect("Login.aspx");
}
}
}
8373 Manish Naik

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 -->

<!-- Style --> <link rel="stylesheet" href="css/style.css" type="text/css" media="all" />


<link rel="stylesheet" href="css/jquery-ui.css" />
<!-- JavaScript --> <script type="text/javascript" src="js/jquery.min.js"></script>

</head>
<body>
<form id="form1" runat="server">
<div>

<h1 class="book">HOTEL BOOKING </h1>

<div class="reg">

<h1>Book Your Suite!</h1><p>


<asp:LinkButton ID="LinkButton_Logout" runat="server" Font-Bold="True"
Font-Size="Medium" Font-Underline="True" ForeColor="Blue"
onclick="LinkButton_Logout_Click">Logout</asp:LinkButton></p>

<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 ID="DropDownList2" 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:DropDownList>

</div>
</div>
<div class="clear"></div>
</div>

<div class="suite">
<div class="dropdown-button">
<h2>Suite</h2>

<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"


ControlToValidate="DropDownList3" Display="Dynamic" ErrorMessage="Select the Room Type"
ForeColor="Black" SetFocusOnError="True" ToolTip="Select The Room
Type">*</asp:RequiredFieldValidator>

<asp:DropDownList ID="DropDownList3" class="dropdown" runat="server"


tabindex="10" data-settings='{"wrapperClass":"flat"}'>
<asp:ListItem Value="1">-</asp:ListItem>
<asp:ListItem Value="1">Single Room</asp:ListItem>
<asp:ListItem Value="2">Premium Single Room</asp:ListItem>
<asp:ListItem Value="2">Double Room</</asp:ListItem>
<asp:ListItem Value="2">Premium Double Room</asp:ListItem>
<asp:ListItem Value="3">Deluxe Suite</asp:ListItem>
<asp:ListItem Value="4">Executive Suite</asp:ListItem>
<asp:ListItem Value="4">Ocean View Suite</asp:ListItem>
<asp:ListItem Value="4">Presidential Suite</asp:ListItem>
<asp:ListItem Value="3">The Penthouse</asp:ListItem>

</asp:DropDownList>

</div>
</div>

<div class="book-pag">
<h2>Select Date</h2>
<div class="book-pag-frm1">
<label>Check In</label>
8373 Manish Naik

<asp:TextBox ID="datepicker1" class="date" runat="server" value="Date" onblur="if


(this.value == '') {this.value = '';}" required=""></asp:TextBox>
<%--<input class="date" id="datepicker1" type="text" value="Date"
onfocus="this.value = '';" onblur="if (this.value == '') {this.value = '';}" required="">--%>
</div>
<div class="book-pag-frm2">
<label>Check Out</label>
<asp:TextBox ID="datepicker2" class="date" runat="server"
value="Date" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = '';}"
required=""></asp:TextBox>
<%--<input class="date" id="datepicker2" type="text" value="Date"
onfocus="this.value = '';" onblur="if (this.value == '') {this.value = '';}" required="">--%>
</div>
<div class="clear"></div>
</div>

<!--Date Picker-->

<script src="js/jquery-ui.js" type="text/javascript"></script>


<script type="text/javascript">
$(function() {
$(
" datepicker,datepicker1,datepicker2" ).datepicker(); });

</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">

<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"


ControlToValidate="RadioButtonList1" Display="Dynamic" ErrorMessage="Please Select the Cuisine "
ForeColor="Black" SetFocusOnError="True" ToolTip="Select the
Cuisine">*</asp:RequiredFieldValidator>

<asp:RadioButtonList ID="RadioButtonList1" runat="server">


<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"
style="font-size: x-large; font-weight: bold; background-color: 0000FF">

<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"


ControlToValidate="txt_fulname" Display="Dynamic" ErrorMessage="Please Enter YOur Name"
ForeColor="Black" SetFocusOnError="True">*</asp:RequiredFieldValidator>
8373 Manish Naik

<asp:TextBox ID="txt_fulname" runat="server" Width="552px"


OnTextChanged="txt_fulname_TextChanged"></asp:TextBox>
<div class="submit">

<asp:Button ID="Bt_submit" runat="server" class="book" Text="Book Now"


onclick="Bt_submit_Click" />&nbsp&nbsp&nbsp<asp:Button ID="Button_print"
runat="server" Text="Print" BackColor="Black" Font-Bold="True"
Font-Size="Medium" ForeColor="White" Width="67px" OnClick="Button_print_Click" />
<%--<input type="submit" class="book" value="BOOK NOW">--%>
</div> </div>
</div>

</div>

<div class="reg-footer">
<p><strong>Copyright &copy; 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;

protected void Page_Load(object sender, EventArgs e)


{

protected void txt_fulname_TextChanged(object sender, EventArgs e)


8373 Manish Naik

protected void Bt_submit_Click(object sender, EventArgs e)


{

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());
}
}

protected void Button_print_Click(object sender, EventArgs e)


{
if(DropDownList1.SelectedValue.ToString()=="" || DropDownList2.SelectedValue.ToString()==""
|| DropDownList3.SelectedValue.ToString()=="" || datepicker1.Text=="" ||datepicker2.Text=="" ||
RadioButtonList1.SelectedValue.ToString()=="" || txt_fulname.Text=="")
{

Response.Write("<script>alert('Please Enter all the feilds')</script>");


}
else
{
Button_print.Attributes.Add("onclick", "window.print();");
}
}

protected void LinkButton_Logout_Click(object sender, EventArgs e)


{
Response.Redirect("../LoginRegis/Login.aspx");
}
}
}
8373 Manish Naik

OUTPUT:
8373 Manish Naik

After clicking book now(Button):


8373 Manish Naik
8373 Manish Naik

On Correct Credentials the user is Redirected to MainBooking Page


8373 Manish Naik

User Can Also Print the Booking Receipt(Print Button):


8373 Manish Naik
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.

You might also like