Вы находитесь на странице: 1из 185

Default.aspx.

cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
using System.Globalization;
namespace HotelManagementSystem
{
public partial class HomePage1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DateTime Today = System.DateTime.Now;
Label1.Text = "Now=" + Today.ToString();
Label1.ForeColor = System.Drawing.Color.Black;
}
protected void btnCheck_Click(object sender, EventArgs e)
{
DataTable tempTable = new DataTable();
tempTable.Columns.Add("RoomNo");
Boolean IsPickedUpBookedRoomNo = false, Taken = false;
string indate = ddldd.Text + "/" + ddlmm.Text + "/" + ddlyyyy.Text;
string outdate = ddlddout.Text + "/" + ddlmmout.Text + "/" + ddlyyyyout.Text;
string Formate = "dd/MM/yyyy";
DateTime GuestDateIn = DateTime.ParseExact(indate, Formate,
CultureInfo.InvariantCulture);
DateTime GuestDateOut = DateTime.ParseExact(outdate, Formate,
CultureInfo.InvariantCulture);
int CheckDate = DateTime.Compare(GuestDateOut, GuestDateIn);
if (CheckDate >= 0)
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from BookedRooms ",
SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];

int row = ds.Tables[0].Rows.Count;


if (row != 0)
{
int i = 0;
foreach (DataRow dr in dt.Rows)
{
string CheckInDate = dt.Rows[i][1].ToString();
DateTime TableDateIn = DateTime.ParseExact(CheckInDate, Formate,
CultureInfo.InvariantCulture);
string CheckOutDate = dt.Rows[i][2].ToString();
DateTime TableDateOut = DateTime.ParseExact(CheckOutDate, Formate,
CultureInfo.InvariantCulture);

int result1 = DateTime.Compare(GuestDateIn, TableDateIn);//guest datein


is less then old guest datein
int result2 = DateTime.Compare(GuestDateOut, TableDateOut);//old guest
outdate is before then new guest checkin
int result3 = DateTime.Compare(GuestDateIn, TableDateOut);
int result4 = DateTime.Compare(GuestDateOut, TableDateIn);
if (result1 <= 0 && result2 >= 0)//true when Date1 is greter then
{
DataRow NewDr = tempTable.NewRow();
string SelectedRoomNo = dt.Rows[i][0].ToString();
NewDr["RoomNo"] = SelectedRoomNo;
tempTable.Rows.Add(NewDr);
tempTable.AcceptChanges();
IsPickedUpBookedRoomNo = true;
Taken = true;

}
if (result1 >= 0 && result2 <= 0 && !Taken)
{
DataRow NewDr = tempTable.NewRow();
NewDr["RoomNo"] = dt.Rows[i][0].ToString();
tempTable.Rows.Add(NewDr);
tempTable.AcceptChanges();
IsPickedUpBookedRoomNo = true;
Taken = true;

}
if (result1 > 1 && result3 > 0 && !Taken)
{

DataRow NewDr = tempTable.NewRow();


NewDr["RoomNo"] = dt.Rows[i][0].ToString();
tempTable.Rows.Add(NewDr);
tempTable.AcceptChanges();
IsPickedUpBookedRoomNo = true;
Taken = true;

}
if (result1 > 0 && result4 < 0 && !Taken)
{
DataRow NewDr = tempTable.NewRow();
NewDr["RoomNo"] = dt.Rows[i][0].ToString();
tempTable.Rows.Add(NewDr);
tempTable.AcceptChanges();
IsPickedUpBookedRoomNo = true;
Taken = true;

}
Taken = false;
i = i + 1;
}
}
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from Room ", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "Room");
DataTable dt1 = ds1.Tables[0];
int row1 = ds1.Tables[0].Rows.Count;
if (row1 != 0)
{

if (!IsPickedUpBookedRoomNo)
{
Session["AvailableRooms"] = dt1;
}
else
{
DataTable tempdt = new DataTable(); // creating temp table to store
Booked Room no details
tempdt.Columns.Add("RoomNo");//adding culumns to temp table
tempdt.Columns.Add("Type");
tempdt.Columns.Add("Capacity");
tempdt.Columns.Add("Rate");
tempdt.Columns.Add("Status");

tempdt.Columns.Add("Image");
int n = 0, l = 0;
Boolean IsMatchedBoothRoom = false;
foreach (DataRow dr2 in dt1.Rows)
{
int k = 0;
foreach (DataRow dr in tempTable.Rows)
{
string AvailableRoomNo = dt1.Rows[l][0].ToString();
string BookedRoomNo = tempTable.Rows[k][0].ToString();
if (AvailableRoomNo == BookedRoomNo) // finding all booked room
no from room table
{
IsMatchedBoothRoom = true;
}
k = k + 1;
}
if (!IsMatchedBoothRoom)
{
DataRow NewDR = tempdt.NewRow();
NewDR["RoomNo"] = dt1.Rows[n][0].ToString();
NewDR["Type"] = dt1.Rows[n][1].ToString();
NewDR["Capacity"] = dt1.Rows[n][2].ToString();
NewDR["Rate"] = dt1.Rows[n][3].ToString();
NewDR["Status"] = dt1.Rows[n][4].ToString();
NewDR["Image"] = dt1.Rows[n][5].ToString();
tempdt.Rows.Add(NewDR);
tempdt.AcceptChanges();
n = n + 1;
}
IsMatchedBoothRoom = false;
l = l + 1;
}
ViewState["tempdt"] = tempdt;
int TempTableData = tempdt.Rows.Count;
if (TempTableData != 0)
{
Session["AvailableRooms"] = tempdt;
}
else
{
Session["Message"] = "Room Is Not Available For you Between The
Given Date...!!!";
}
}
Session["CheckInDate"] = indate;
Session["CheckOutDate"] = outdate;
Response.Redirect("~/Account/RoomAvailability.aspx");

}
}
else
{
LblMessge.Text = "Please Check Selected Date";
}
}
}
}
Feedback.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem
{
public partial class Feedback : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click1(object sender, EventArgs e)
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Feedback ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Feedback");
DataTable dt = ds.Tables[0];
DataRow dr = dt.NewRow();
dr[0] = txtGuestId.Text;
dr[1] = txtname.Text;
dr[2] = txtemail.Text;
dr[3] = txtsubject.Text;
dr[4] = txtmessage.Text;
dt.Rows.Add(dr);
SqlCommandBuilder cd = new SqlCommandBuilder(Sqd);

Sqd.Update(dt);
Label1.Text = "Your feedback has been sent...!!!";
}
}
}
Gallery.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace HotelManagementSystem
{
public partial class Gallary : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
Homepage.master.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace HotelManagementSystem
{
public partial class HomePage : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
Rules.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;

using
using
using
using

System.Web.UI.WebControls.WebParts;
System.Xml.Linq;
System.Data.SqlClient;
System.IO;

namespace HotelManagementSystem
{
public partial class Rules : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Rules ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Rules");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
GrdRueles.DataSource = ds;
GrdRueles.DataBind();
}
}
}
}
}
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem
{
public partial class Rules : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)

{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Rules ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Rules");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
GrdRueles.DataSource = ds;
GrdRueles.DataBind();
}
}
}
}
}
Adminlogin.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Account
{
public partial class AdminLogin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnCheck0_Click(object sender, EventArgs e)
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Admin where
username='" +txtid.Text+ "' and password='"+txtpassword.Text+"'", SqlCon);
DataSet ds = new DataSet();

Sqd.Fill(ds, "Admin");
DataTable dt = ds.Tables[0];
int Room = dt.Rows.Count;
if (Room != 0)
{
Session["AdminId"] = txtid.Text;
Response.Redirect("../Admin/Default.aspx");
}
else
{
LblMessge.Text = "Please check User-Id and Password";
}
}
}
}
Guestlogin.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Account
{
public partial class CustomerLogin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if ( Session["UserId"]!=null)
{
Session["GuestName"] = Session["Name"].ToString();
txtid.Text= Session["UserId"].ToString();
txtpassword.Text= Session["Password"].ToString();
}

}
protected void btnCheck0_Click(object sender, EventArgs e)
{
PathStringClass path = new PathStringClass();

string DatabasePath = path.Get_path();


SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from GuestDetails where
GuestId='" + txtid.Text + "' and Password='" + txtpassword.Text + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "GuestDetails");
DataTable dt = ds.Tables[0];
int Room = dt.Rows.Count;
if (Room != 0)
{
if ( Session["SelectedRoomNo"]!= null)
{
Session["GuestName"]= dt.Rows[0][0].ToString();
Session["CheckInDate"] = Session["CheckInDate"].ToString();
Session["CheckOutDate"] = Session["CheckOutDate"].ToString();
Session["SelectedRoomNo"] = Session["SelectedRoomNo"].ToString();
Response.Redirect("../Guest/MakePayment.aspx");
}
else
{
Session["GuestName"] = dt.Rows[0][0].ToString();
Session["GuestId"] =txtid.Text;
Response.Redirect("../Guest/Default.aspx");
}
}
else
{
LblMessge.Text = "Please check User-Id and Password";
}
}
}
}
Guestregistration.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

using System.IO;
namespace HotelManagementSystem.Account
{
public partial class GuestRegistration : System.Web.UI.Page
{
string ImgPath;//Image storing
Boolean value = false;
Boolean IsExistId = false;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["SelectedRoomNo1"] != null)
{
string str = Session["SelectedRoomNo1"].ToString();
}
}
protected void btnregister_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
if (UploadImage.HasFile)
{
ImgPath = ImagePath();
IsExistId = check_ID();
if (ImgPath != null && IsExistId)
{
Register_Guest(ImgPath);
Show_Guest_Registered_Iformation();
}
}
else
{
LblPictureMessege.Text = "Please Select Image";
}
}
else
{
LblValidateMessage.Text = "Uknown Error occured!!!";
}
btnregister.Enabled = false;
}
private bool check_ID()
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from GuestDetails where
GuestId='" + txtuserid.Text + "'", SqlCon);

DataSet ds = new DataSet();


Sqd.Fill(ds, "GuestDetails");
DataTable dt = ds.Tables[0];
DataRow dr = dt.NewRow();
int Room = 0;
Room = dt.Rows.Count;
if (Room != 0)
{
IsExistId = false;
lblmessage.Text = "A user is already registered with this User-Id";
}
else
{
IsExistId = true;
}
return IsExistId;
}
private void Register_Guest(string ImgPath)
{
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from GuestDetails",
SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "GuestDetails");
DataTable dt1 = ds1.Tables[0];
DataRow dr1 = dt1.NewRow();
dr1[0] = ddlnametitle.SelectedItem.ToString() + txtname.Text;
dr1[1] = ddlfnametitle.SelectedItem.ToString() + txtfname.Text;
dr1[2] = ddldd.SelectedItem.ToString() + "/" + ddlmm.SelectedItem.ToString() +
"/" + ddlyyyy.SelectedItem.ToString();
dr1[3] = ddlgender.SelectedItem.ToString();
dr1[4] = txtidmark.Text;
dr1[5] = txtmobile.Text;
dr1[6] = txtemail.Text;
dr1[7] = ddlidtype.SelectedItem.ToString();
dr1[8] = txtidno.Text;
dr1[9] = txtaddress.Text;
dr1[10] = txtcity.Text;
dr1[11] = txtstate.Text;
dr1[12] = txtpinno.Text;
dr1[13] = txtcountry.Text;
dr1[14] = txtuserid.Text;
dr1[15] = txtpassword.Text;
dr1[16] = txtconfirmpassword.Text;
dr1[17] = ImgPath;
dt1.Rows.Add(dr1);
SqlCommandBuilder cd = new SqlCommandBuilder(Sqd1);
Sqd1.Update(dt1);
}

private void Show_Guest_Registered_Iformation()


{
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd2 = new SqlDataAdapter("select * from GuestDetails where
GuestId='" + txtuserid.Text + "'", SqlCon1);
DataSet ds2 = new DataSet();
Sqd2.Fill(ds2, "GuestDetails");
DataTable dt2 = ds2.Tables[0];
int noofrow = dt2.Rows.Count;
if (noofrow != 0)
{
GrdGuestDetails.DataSource = ds2;
GrdGuestDetails.DataBind();
}
else
{
LblValidateMessage.Text = "There an error...!!!";
}
}
protected void btncheckExistingid_Click(object sender, EventArgs e)
{
Boolean IsIdExist = false;
IsIdExist = check_ID();
if (IsIdExist)
{
lblmessage.Text = "Entered Id is avilable for you";
}
else
{
lblmessage.Text = "Entered Id is not available for you";
}
}
private string ImagePath()
{
Boolean FileOK = false;
//Boolean FileSaved = false;
int k = 0;

Session["WorkingImage"] = UploadImage.FileName;
String FileExtension =
Path.GetExtension(Session["WorkingImage"].ToString()).ToLower();
//renaming File
Random MyRandom = new Random();
string FilenameWithoutExtension =
Path.GetFileNameWithoutExtension(Session["WorkingImage"].ToString());
string fileNameIncreament = Convert.ToString(MyRandom.Next(10, 300000));

FilenameWithoutExtension = FilenameWithoutExtension + fileNameIncreament;


Session["ImageFileName"] = FilenameWithoutExtension + FileExtension;
String[] allowedExtensions = { ".png", ".jpeg", ".jpg", ".gif", ".htm" };
for (int i = 0; i < allowedExtensions.Length; i++)
{
k++;
if (FileExtension == allowedExtensions[i])
{
FileOK = true;
break;
}
}
if (FileOK)
{
try
{
string path = (Server.MapPath("../GuestImages")).ToString();
UploadImage.SaveAs(path + "/" + Session["ImageFileName"].ToString());
}
catch (Exception ex)
{
}
}
string dbfilePath;
string fileName = Path.GetFileName(Session["ImageFileName"].ToString());
dbfilePath = @"../GuestImages/" + fileName;
if (!FileOK)
{
dbfilePath = null;
}
return dbfilePath;
}
protected void btnLogin_Click1(object sender, EventArgs e)
{
Button btnLogin = (Button)sender;
GridViewRow row = (GridViewRow)btnLogin.Parent.Parent;
Label lbluserid = (Label)row.FindControl("lbluserid");
Label lblpassword = (Label)row.FindControl("lblpassword");
Label lblName = (Label)row.FindControl("lblName");
Session["Name"] = lblName.Text;
Session["UserId"] = lbluserid.Text;
Session["Password"] = lblpassword.Text;
Session["CheckInDate"] = Session["CheckInDate"].ToString();
Session["CheckOutDate"] = Session["CheckOutDate"].ToString();
Session["SelectedRoomNo"] = Session["SelectedRoomNo"].ToString();
Response.Redirect("~/Account/GuestLogin.aspx");
}
}
}
Receptionistlogin.aspx

using
using
using
using
using
using
using
using
using
using
using
using
using
using

System;
System.Collections;
System.Configuration;
System.Data;
System.Linq;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.HtmlControls;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Xml.Linq;
System.Data.SqlClient;
System.IO;

namespace HotelManagementSystem.Account
{
public partial class ReceptionistLogin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnCheck0_Click(object sender, EventArgs e)
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from ReceptionistDetails
where ReceptionistId='" +txtid.Text+ "' and Password='"+txtpassword.Text+"'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "ReceptionistDetails");
DataTable dt = ds.Tables[0];
int Room = dt.Rows.Count;
if (Room != 0)
{
Session["ReceptionistId"] = txtid.Text;
Session["ReceptionistName"] = dt.Rows[0][0].ToString();
Response.Redirect("../Receptionist/Default.aspx");
}
else
{
LblMessge.Text = "Please check User-Id and Password";
}
}
}
}
Roomavailability.aspx.cs
using System;
using System.Collections;

using
using
using
using
using
using
using
using
using
using
using
using

System.Configuration;
System.Data;
System.Linq;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.HtmlControls;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Xml.Linq;
System.Data.SqlClient;
System.IO;

namespace HotelManagementSystem.Account
{
public partial class RoomAvailability : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["CheckInDate"] != null && Session["CheckOutDate"]!=null)
{
Session["CheckInDate"] = Session["CheckInDate"].ToString();
Session["CheckOutDate"] = Session["CheckOutDate"].ToString();
}
if (Session["Message"] != null)
{
lblmessage.Text = Session["Message"].ToString();
}
if (!IsPostBack && Session["AvailableRooms"] != null)
{
DataTable dt = (DataTable)Session["AvailableRooms"];
GrdRooms.DataSource = dt;
GrdRooms.DataBind();
}

}
protected void BtnShow_Click(object sender, EventArgs e)
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Room ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Room");
DataTable dt = ds.Tables[0];
int Room = dt.Rows.Count;
if (Room != 0)
{
GrdRooms.DataSource = ds;

GrdRooms.DataBind();
}
else
{
lblmessage.Text = "Not Available Room";
}
}
protected void btnregister_Click(object sender, EventArgs e)
{
Response.Redirect("../Default.aspx");
}
protected void btnselect_Click(object sender, EventArgs e)
{
Button btnselect = (Button)sender;
GridViewRow row = (GridViewRow)btnselect.Parent.Parent;
Label lblRoomNo = (Label)row.FindControl("lblRoomNo");
Session["CheckInDate"] = Session["CheckInDate"].ToString();
Session["CheckOutDate"] = Session["CheckOutDate"].ToString();
Session["SelectedRoomNo"] = lblRoomNo.Text;
Response.Redirect("~/Account/SelectedRoom.aspx");
}
}
}
Seletedroom.aspx
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Account
{
public partial class SelectedRoom : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Start Page load
if (!IsPostBack && Session["SelectedRoomNo"]!=null)
{

string str = Session["SelectedRoomNo"].ToString();


string InDate=Session["CheckInDate"].ToString();
string OutDate = Session["CheckOutDate"].ToString();
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Room where
RoomNo='" + str + "' ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Room");
DataTable dt = ds.Tables[0];
int Room = dt.Rows.Count;
if (Room > 0)
{
DataTable TempTable = new DataTable();
TempTable.Columns.Add("RoomNo");
TempTable.Columns.Add("Type");
TempTable.Columns.Add("Capacity");
TempTable.Columns.Add("Rate");
TempTable.Columns.Add("Status");
TempTable.Columns.Add("Image");
TempTable.Columns.Add("CheckInDate");
TempTable.Columns.Add("CheckOutDate");
foreach (DataRow dr in dt.Rows)
{
DataRow TempDr = TempTable.NewRow();
TempDr["RoomNo"] = dt.Rows[0][0].ToString();
TempDr["Type"] = dt.Rows[0][1].ToString();
TempDr["Capacity"] = dt.Rows[0][2].ToString();
TempDr["Rate"] = dt.Rows[0][3].ToString();
TempDr["Status"] = dt.Rows[0][4].ToString();
TempDr["Image"] = dt.Rows[0][5].ToString();
TempDr["CheckInDate"] = InDate;
TempDr["CheckOutDate"] = OutDate;
TempTable.Rows.Add(TempDr);
TempTable.AcceptChanges();
ViewState["TempTable"] = TempTable;
}
if (TempTable.Rows.Count > 0)
{
GrdRooms.DataSource = TempTable;
GrdRooms.DataBind();
}
}
}
else
{
lblmessage.Text = "you have not selected room";
}

}
protected void btnLogin_Click(object sender, EventArgs e)
{
Session["CheckInDate"] = Session["CheckInDate"].ToString();
Session["CheckOutDate"] = Session["CheckOutDate"].ToString();
Session["SelectedRoomNo"] = Session["SelectedRoomNo"].ToString();
Response.Redirect("~/Account/GuestLogin.aspx");
}
protected void btnregister_Click(object sender, EventArgs e)
{
Session["CheckInDate"] = Session["CheckInDate"].ToString();
Session["CheckOutDate"] = Session["CheckOutDate"].ToString();
Session["SelectedRoomNo"] = Session["SelectedRoomNo"].ToString();
Response.Redirect("~/Account/GuestRegistration.aspx");
}
}
}
Admin.master.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace HotelManagementSystem.Admin
{
public partial class Admin : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] != null)
{
Response.Redirect("~/Account/AdminLogin.aspx");
}
}
}
}
Checkinguestrecords.aspx
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;

using
using
using
using
using
using

System.Web.UI.HtmlControls;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Xml.Linq;
System.Data.SqlClient;
System.IO;

namespace HotelManagementSystem.Admin
{
public partial class CheckInGustRecords : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] != null)
{
lblShowingName.Text = Session["AdminId"].ToString();
Session["AdminId"] = Session["AdminId"].ToString();
}
}
protected void BtnRecord_Click1(object sender, EventArgs e)
{
if (Page.IsValid)
{
string RecordType = ddlReportType.SelectedItem.ToString();
DataTable TempDt = new DataTable();
TempDt.Columns.Add("GuestId");
switch (RecordType)
{
case "Daily":
{
string d1 = ddldd.Text + "/" + ddlmm.Text + "/" + ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckInDate like '%" + d1 + "%'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
DataTable CheckDt = ds.Tables[0];
int i = 0, j = 0;
Boolean IsMatched = false;
if (row != 0)
{
foreach (DataRow dr1 in dt.Rows)
{
string PriviousGuestId = dt.Rows[i][4].ToString();
j = 0;

if (i != 0)
{
foreach (DataRow dr in CheckDt.Rows)
{
string CurrentGuestId = CheckDt.Rows[j][4].ToString();
if (PriviousGuestId == CurrentGuestId)
{
if (i == j)
{
break;
}
IsMatched = true;
}
j = j + 1;

}
}
if (!IsMatched)
{
DataRow NewDr = TempDt.NewRow();
NewDr["GuestId"] = PriviousGuestId;
TempDt.Rows.Add(NewDr);
TempDt.AcceptChanges();
ViewState["TempDt"] = TempDt;
}
IsMatched = false;
i = i + 1;
}
int GetRows = TempDt.Rows.Count;

}
else
{
lblmessage.Text = "Record Not Found...!!!";
GrdCheckInGuestDetails.DataSource = null;
GrdCheckInGuestDetails.DataBind();
}
}
break;
case "Monthly":
{
string d2 = ddlmm.Text + "/" + ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckInDate like '%" + d2 + "'", SqlCon);

DataSet ds = new DataSet();


Sqd.Fill(ds, "BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
DataTable CheckDt = ds.Tables[0];
int i = 0, j = 0;
Boolean IsMatched = false;
if (row != 0)
{
foreach (DataRow dr1 in dt.Rows)
{
string PriviousGuestId = dt.Rows[i][4].ToString();
j = 0;
if (i != 0)
{
foreach (DataRow dr in CheckDt.Rows)
{
string CurrentGuestId = CheckDt.Rows[j][4].ToString();
if (PriviousGuestId == CurrentGuestId)
{
if (i == j)
{
break;
}
IsMatched = true;
}
j = j + 1;

}
}
if (!IsMatched)
{
DataRow NewDr = TempDt.NewRow();
NewDr["GuestId"] = PriviousGuestId;
TempDt.Rows.Add(NewDr);
TempDt.AcceptChanges();
ViewState["TempDt"] = TempDt;
}
IsMatched = false;
i = i + 1;
}
int GetRows = TempDt.Rows.Count;
}
else

{
lblmessage.Text = "Record Not Found...!!!";
GrdCheckInGuestDetails.DataSource = null;
GrdCheckInGuestDetails.DataBind();
}
}
break;
case "Yearly":
{
string d3 = ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckInDate like '%" + d3 + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
DataTable CheckDt = ds.Tables[0];
int i = 0, j = 0;
Boolean DataLoaded = false;
Boolean Execute = false;
Boolean IsMatched = false;
if (row != 0)
{
foreach (DataRow dr in dt.Rows)
{
DataTable MyTable = (DataTable)ViewState["TempDt"];
if (Execute)
{
int LoadedDataRow = MyTable.Rows.Count;
}
if (DataLoaded)
{
j = 0;
foreach (DataRow dr1 in MyTable.Rows)
{
string GuestId = dt.Rows[i][4].ToString();
string GuestIdTemp = MyTable.Rows[j][0].ToString();
if (GuestId == GuestIdTemp)
{
IsMatched = true;
}
j = j + 1;
}
if (!IsMatched)

{
DataRow NewDr = TempDt.NewRow();
NewDr["GuestId"] = dt.Rows[i][4].ToString();
TempDt.Rows.Add(NewDr);
TempDt.AcceptChanges();
ViewState["TempDt"] = TempDt;
Execute = true;

}
}
else
{
DataRow NewDr = TempDt.NewRow();
NewDr["GuestId"] = dt.Rows[0][4].ToString();
TempDt.Rows.Add(NewDr);
TempDt.AcceptChanges();
ViewState["TempDt"] = TempDt;
Execute = true;
}
DataLoaded = true;
i = i + 1;
IsMatched = false;
}
}
else
{
lblmessage.Text = "Record Not Found...!!!";
GrdCheckInGuestDetails.DataSource = null;
GrdCheckInGuestDetails.DataBind();
}
}
break;
default:
{
}
break;
}
// ViewState["TempDt"] = TempDt;
DataTable ResultTable = new DataTable();
ResultTable.Columns.Add("Name");
ResultTable.Columns.Add("DOB");
ResultTable.Columns.Add("Gender");
ResultTable.Columns.Add("MobileNo");
ResultTable.Columns.Add("IdType");
ResultTable.Columns.Add("IdNo");
ResultTable.Columns.Add("State");
ResultTable.Columns.Add("PinNo");

ResultTable.Columns.Add("GuestId");
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from GuestDetails ",
SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "GuestDetails");
DataTable dt1 = ds1.Tables[0];
int row1 = dt1.Rows.Count;
DataTable MyResultTable = (DataTable)ViewState["TempDt"];
//int RowData = MyResultTable.Rows.Count;
if (row1 != 0 && MyResultTable!=null )
{
int i = 0, j = 0;
foreach (DataRow dr in MyResultTable.Rows)
{
i = 0;
foreach (DataRow dr1 in dt1.Rows)
{
if (MyResultTable.Rows[j][0].ToString() == dt1.Rows[i][14].ToString())
{
DataRow NewDR = ResultTable.NewRow();
NewDR["Name"] = dt1.Rows[i][0].ToString();
NewDR["DOB"] = dt1.Rows[i][2].ToString();
NewDR["Gender"] = dt1.Rows[i][3].ToString();
NewDR["MobileNo"] = dt1.Rows[i][5].ToString();
NewDR["IdType"] = dt1.Rows[i][7].ToString();
NewDR["IdNo"] = dt1.Rows[i][8].ToString();
NewDR["State"] = dt1.Rows[i][11].ToString();
NewDR["PinNo"] = dt1.Rows[i][12].ToString();
NewDR["GuestId"] = dt1.Rows[i][14].ToString();
ResultTable.Rows.Add(NewDR);
ResultTable.AcceptChanges();
ViewState["ResultTable"] = ResultTable;
}
i = i + 1;
}
j = j + 1;
}
lblmessage.Text = " Total " + ResultTable.Rows.Count.ToString() + " Guest(s)
Records found....!!!";
GrdCheckInGuestDetails.DataSource = ResultTable;
GrdCheckInGuestDetails.DataBind();
}
else
{
lblmessage.Text = "Guest Records not Found.......!!!!!";

}
}
}
protected void ddlReportType_SelectedIndexChanged(object sender, EventArgs e)
{
string ReportType = ddlReportType.SelectedItem.ToString();
switch (ReportType)
{
case "Daily":
{
ddldd.Enabled = true;
ddlmm.Enabled = true;
ddlyyyy.Enabled = true;
}
break;
case "Monthly":
{
ddldd.Enabled = false;
ddlmm.Enabled = true;
ddlyyyy.Enabled = true;
}
break;
case "Yearly":
{
ddldd.Enabled = false;
ddlmm.Enabled = false;
ddlyyyy.Enabled = true;
}
break;
}
}
protected void BntOk_Click(object sender, EventArgs e)
{
GrdCheckInGuestDetails.DataSource = null;
GrdCheckInGuestDetails.DataBind();
lblmessage.Text = "";
}
protected void CustomValidator1_ServerValidate(object source,
ServerValidateEventArgs args)
{
if (ddldd.Enabled)
{
if (ddldd.SelectedItem.ToString() == "Day")
{
args.IsValid = false;

}
else
{
args.IsValid = true;
}
}
else
{
args.IsValid = true;
}

}
protected void CustomValidator2_ServerValidate(object source,
ServerValidateEventArgs args)
{
if (ddlmm.Enabled)
{
if (ddlmm.SelectedItem.ToString() == "Month")
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
else
{
args.IsValid = true;
}
}
}
}
Checkoutguestrecords.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;

namespace HotelManagementSystem.Admin
{
public partial class CheckOutGuestRecords : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] != null)
{
lblShowingName.Text = Session["AdminId"].ToString();
Session["AdminId"] = Session["AdminId"].ToString();
}
}
protected void BtnRecord_Click1(object sender, EventArgs e)
{
if (Page.IsValid)
{
string RecordType = ddlReportType.SelectedItem.ToString();
DataTable TempDt = new DataTable();
TempDt.Columns.Add("GuestId");
switch (RecordType)
{
case "Daily":
{
string d1 = ddldd.Text + "/" + ddlmm.Text + "/" + ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckOutDate like '%" + d1 + "%'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
DataTable CheckDt = ds.Tables[0];
int i = 0, j = 0;
Boolean IsMatched = false;
if (row != 0)
{
foreach (DataRow dr1 in dt.Rows)
{
string PriviousGuestId = dt.Rows[i][4].ToString();
j = 0;
if (i != 0)
{
foreach (DataRow dr in CheckDt.Rows)
{
string CurrentGuestId = CheckDt.Rows[j][4].ToString();

if (PriviousGuestId == CurrentGuestId)
{
if (i == j)
{
break;
}
IsMatched = true;
}
j = j + 1;

}
}
if (!IsMatched)
{
DataRow NewDr = TempDt.NewRow();
NewDr["GuestId"] = PriviousGuestId;
TempDt.Rows.Add(NewDr);
TempDt.AcceptChanges();
ViewState["TempDt"] = TempDt;
}
IsMatched = false;
i = i + 1;
}
int GetRows = TempDt.Rows.Count;

}
else
{
lblmessage.Text = "Record Not Found...!!!";
GrdCheckOutGuestDetails.DataSource = null;
GrdCheckOutGuestDetails.DataBind();
}
}
break;
case "Monthly":
{
string d2 = ddlmm.Text + "/" + ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckOutDate like '%" + d2 + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
DataTable CheckDt = ds.Tables[0];

int i = 0, j = 0;
Boolean IsMatched = false;
if (row != 0)
{
foreach (DataRow dr1 in dt.Rows)
{
string PriviousGuestId = dt.Rows[i][4].ToString();
j = 0;
if (i != 0)
{
foreach (DataRow dr in CheckDt.Rows)
{
string CurrentGuestId = CheckDt.Rows[j][4].ToString();
if (PriviousGuestId == CurrentGuestId)
{
if (i == j)
{
break;
}
IsMatched = true;
}
j = j + 1;

}
}
if (!IsMatched)
{
DataRow NewDr = TempDt.NewRow();
NewDr["GuestId"] = PriviousGuestId;
TempDt.Rows.Add(NewDr);
TempDt.AcceptChanges();
ViewState["TempDt"] = TempDt;
}
IsMatched = false;
i = i + 1;
}
int GetRows = TempDt.Rows.Count;
}
else
{
lblmessage.Text = "Record Not Found...!!!";
GrdCheckOutGuestDetails.DataSource = null;
GrdCheckOutGuestDetails.DataBind();
}

}
break;
case "Yearly":
{
string d3 = ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckOutDate like '%" + d3 + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
DataTable CheckDt = ds.Tables[0];
int i = 0, j = 0;
Boolean DataLoaded = false;
Boolean Execute = false;
Boolean IsMatched = false;
if (row != 0)
{
foreach (DataRow dr in dt.Rows)
{
DataTable MyTable = (DataTable)ViewState["TempDt"];
if (Execute)
{
int LoadedDataRow = MyTable.Rows.Count;
}
if (DataLoaded)
{
j = 0;
foreach (DataRow dr1 in MyTable.Rows)
{
string GuestId = dt.Rows[i][4].ToString();
string GuestIdTemp = MyTable.Rows[j][0].ToString();
if (GuestId == GuestIdTemp)
{
IsMatched = true;
}
j = j + 1;
}
if (!IsMatched)
{
DataRow NewDr = TempDt.NewRow();
NewDr["GuestId"] = dt.Rows[i][4].ToString();
TempDt.Rows.Add(NewDr);
TempDt.AcceptChanges();
ViewState["TempDt"] = TempDt;

Execute = true;

}
}
else
{
DataRow NewDr = TempDt.NewRow();
NewDr["GuestId"] = dt.Rows[0][4].ToString();
TempDt.Rows.Add(NewDr);
TempDt.AcceptChanges();
ViewState["TempDt"] = TempDt;
Execute = true;
}
DataLoaded = true;
i = i + 1;
IsMatched = false;
}
}
else
{
lblmessage.Text = "Record Not Found...!!!";
GrdCheckOutGuestDetails.DataSource = null;
GrdCheckOutGuestDetails.DataBind();
}
}
break;
default:
{
}
break;
}
// ViewState["TempDt"] = TempDt;
DataTable ResultTable = new DataTable();
ResultTable.Columns.Add("Name");
ResultTable.Columns.Add("DOB");
ResultTable.Columns.Add("Gender");
ResultTable.Columns.Add("MobileNo");
ResultTable.Columns.Add("IdType");
ResultTable.Columns.Add("IdNo");
ResultTable.Columns.Add("State");
ResultTable.Columns.Add("PinNo");
ResultTable.Columns.Add("GuestId");
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);

SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from GuestDetails ",


SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "GuestDetails");
DataTable dt1 = ds1.Tables[0];
int row1 = dt1.Rows.Count;
DataTable MyResultTable = (DataTable)ViewState["TempDt"];
//int RowData = MyResultTable.Rows.Count;
if (row1 != 0 && MyResultTable != null)
{
int i = 0, j = 0;
foreach (DataRow dr in MyResultTable.Rows)
{
i = 0;
foreach (DataRow dr1 in dt1.Rows)
{
if (MyResultTable.Rows[j][0].ToString() == dt1.Rows[i][14].ToString())
{
DataRow NewDR = ResultTable.NewRow();
NewDR["Name"] = dt1.Rows[i][0].ToString();
NewDR["DOB"] = dt1.Rows[i][2].ToString();
NewDR["Gender"] = dt1.Rows[i][3].ToString();
NewDR["MobileNo"] = dt1.Rows[i][5].ToString();
NewDR["IdType"] = dt1.Rows[i][7].ToString();
NewDR["IdNo"] = dt1.Rows[i][8].ToString();
NewDR["State"] = dt1.Rows[i][11].ToString();
NewDR["PinNo"] = dt1.Rows[i][12].ToString();
NewDR["GuestId"] = dt1.Rows[i][14].ToString();
ResultTable.Rows.Add(NewDR);
ResultTable.AcceptChanges();
ViewState["ResultTable"] = ResultTable;
}
i = i + 1;
}
j = j + 1;
}
lblmessage.Text = " Total " + ResultTable.Rows.Count.ToString() + " Guest(s)
Records found....!!!";
GrdCheckOutGuestDetails.DataSource = ResultTable;
GrdCheckOutGuestDetails.DataBind();
}
else
{
lblmessage.Text = "Guest Records not Found.......!!!!!";
}
}
}

protected void ddlReportType_SelectedIndexChanged(object sender, EventArgs e)


{
string ReportType = ddlReportType.SelectedItem.ToString();
switch (ReportType)
{
case "Daily":
{
ddldd.Enabled = true;
ddlmm.Enabled = true;
ddlyyyy.Enabled = true;
}
break;
case "Monthly":
{
ddldd.Enabled = false;
ddlmm.Enabled = true;
ddlyyyy.Enabled = true;
}
break;
case "Yearly":
{
ddldd.Enabled = false;
ddlmm.Enabled = false;
ddlyyyy.Enabled = true;
}
break;
}
}
protected void BntOk_Click(object sender, EventArgs e)
{
GrdCheckOutGuestDetails.DataSource = null;
GrdCheckOutGuestDetails.DataBind();
lblmessage.Text = "";
}
protected void CustomValidator1_ServerValidate(object source,
ServerValidateEventArgs args)
{
if (ddldd.Enabled)
{
if (ddldd.SelectedItem.ToString() == "Select")
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}

else
{
args.IsValid = true;
}

}
protected void CustomValidator2_ServerValidate(object source,
ServerValidateEventArgs args)
{
if (ddlmm.Enabled)
{
if (ddlmm.SelectedItem.ToString() == "Select")
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
else
{
args.IsValid = true;
}
}
}
}
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace HotelManagementSystem.Admin
{
public partial class AdminHome : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] == null)
{
Response.Redirect("../Account/AdminLogin.aspx");
}
}
}

}
Deleteroom.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Admin
{
public partial class DeleteRoom : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] != null)
{
lblShowingName.Text = Session["AdminId"].ToString();
Session["AdminId"] = Session["AdminId"].ToString();
}
if (!IsPostBack)
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Room ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Room");
DataTable dt = ds.Tables[0];
int Room = dt.Rows.Count;
if (Room != 0)
{
GrdRooms.DataSource = ds;
GrdRooms.DataBind();
}
else
{
lblmessage.Text = "Not Available Room";
}
}

}
protected void btnselect_Click(object sender, EventArgs e)
{
Button btnselect = (Button)sender;
GridViewRow row = (GridViewRow)btnselect.Parent.Parent;
Label lblRoomNo = (Label)row.FindControl("lblRoomNo");
string RoomNo = lblRoomNo.Text;
Session["RoomNo"] = RoomNo;
Response.Redirect("~/Admin/DeleteSelectedRoom.aspx");
}
protected void BtnCancel_Click(object sender, EventArgs e)
{
Response.Redirect("~/Admin/Default.aspx");
}
}
}
Deleteselectedroom.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Admin
{
public partial class DeleteSelectedRoom : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] != null)
{
lblShowingName.Text = Session["AdminId"].ToString();
Session["AdminId"] = Session["AdminId"].ToString();
}
if (!IsPostBack)
{
if (Session["RoomNo"] != null)
{

string RoomNo = Session["RoomNo"].ToString();


PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Room where
RoomNo='" + RoomNo + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Room");
DataTable dt = ds.Tables[0];
int Room = dt.Rows.Count;
if (Room != 0)
{
GrdSelectedRoom.DataSource = ds;
GrdSelectedRoom.DataBind();
}
else
{
lblmessage.Text = "Room No Could not be selected!!!";
}
}
else
{
lblmessage.Text = "First select the room for deletion";
}
}
}
protected void DeleteRoom_Click(object sender, EventArgs e)
{
string SelectedRoomNo = Session["RoomNo"].ToString();
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Room where
RoomNo='" + SelectedRoomNo + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Room");
DataTable dt = ds.Tables[0];
int room = dt.Rows.Count;
if (room != 0)
{
foreach (DataRow dr in dt.Rows)
{
//ds.Tables[0].Rows[0].Delete();
dr.Delete();
SqlCommandBuilder cb = new SqlCommandBuilder(Sqd);
Sqd.Update(dt);
break;

}
GrdSelectedRoom.DataSource = null;
GrdSelectedRoom.DataBind();
lblmessage.Text = "Room Is Deleted...........!!!!!!!";
btnCancel.Text = "Back";
}
else
{
lblmessage.Text = "First select a room..........!!!!!!";
}
}
protected void btnCancel_Click(object sender, EventArgs e)
{
if (Session["ComeBack"] == null)
{
if (Session["BackToUpdate"] != null)
{
Response.Redirect("~/Admin/UpdateRoom.aspx");
}
else
{
Response.Redirect("~/Admin/DeleteRoom.aspx");
}
}
else
{
Response.Redirect("~/Admin/RegisterNewRoom.aspx");
}
}
}
}
Deleteselectedstaff.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Admin

{
public partial class DeleteSelectedStaff : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] != null)
{
lblShowingName.Text = Session["AdminId"].ToString();
Session["AdminId"] = Session["AdminId"].ToString();
}
if (Session[" Receptionist"] != null)
{
string Receptionist = Session[" Receptionist"].ToString();
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from ReceptionistDetails
where ReceptionistId='" + Receptionist + "' ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "ReceptionistDetails");
DataTable dt = ds.Tables[0];
int ReceptionistRow = dt.Rows.Count;
if (ReceptionistRow != 0)
{
GrdGuestDetails.DataSource = ds;
GrdGuestDetails.DataBind();
}
else
{
lblmessage.Text = "Either Staff Is Deleted or Staff not Available ";
}
}
else
{
lblmessage.Text = "First Select Staff";
}

}
protected void DeleteStaff_Click(object sender, EventArgs e)
{
string Receptionist = Session[" Receptionist"].ToString();
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from ReceptionistDetails
where ReceptionistId='" + Receptionist + "'", SqlCon);

DataSet ds = new DataSet();


Sqd.Fill(ds, "ReceptionistDetails");
DataTable dt = ds.Tables[0];
int ReceptionistDetailsRow = dt.Rows.Count;
if (ReceptionistDetailsRow != 0)
{
foreach (DataRow dr in dt.Rows)
{
dr.Delete();
SqlCommandBuilder cb = new SqlCommandBuilder(Sqd);
Sqd.Update(dt);
break;
}
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
lblmessage.Text = "Receptionist Is Deleted.........!!!!!!";
btnCancel.Text = "Back";
}
else
{
lblmessage.Text = "Select a Receptionist........!!!!!!";
}
}
protected void btnCancel_Click(object sender, EventArgs e)
{
Response.Redirect("~/Admin/DeleteStaff.aspx");
}
}
}
Deletestaff.aspx.cs
<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master"
AutoEventWireup="true"
CodeBehind="DeleteStaff.aspx.cs"
Inherits="HotelManagementSystem.Admin.DeleteStaff" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style type="text/css">
.style1
{
width: 180px;
font-size: 16px;
color: #1c344b;
bgcolor: LightSteelBlue;
height: 21px;
}
.style4
{
width: 506px;
}

.style5
{
width: 616px;
}
.style17
{
width: 225px;
height: 21px;
}
.style18
{
height: 21px;
width: 337px;
}
.style19
{
width: 177px;
}
.style68
{
width: 311px;
font-size: 16px;
color: #1c344b;
bgcolor: LightSteelBlue;
height: 36px;
}
.style90
{
width: 158px;
height: 35px;
}
.style91
{
height: 35px;
}
.style95
{
width: 90px;
font-size: 16px;
color: #1c344b;
bgcolor: LightSteelBlue;
height: 34px;
}
.style96
{
width: 90px;
font-size: 16px;
color: #1c344b;
bgcolor: LightSteelBlue;
height: 35px;
}
.style97

{
width: 90px;
font-size: 16px;
color: #1c344b;
bgcolor: LightSteelBlue;
}
.style100
{
width: 146px;
height: 34px;
}
.style101
{
width: 146px;
height: 35px;
}
.style102
{
width: 142px;
}
.style103
{
width: 142px;
font-size: 16px;
color: #1c344b;
bgcolor: LightSteelBlue;
}
.style104
{
width: 311px;
font-size: 16px;
color: #1c344b;
bgcolor: LightSteelBlue;
height: 76px;
}
.style88
{
width: 628px;
border-top: 1px solid black;
border-bottom: 1px solid black;
}
.style105
{
width: 134px;
height: 36px;
font-size: 16px;
color: #dde4ec;
background-color: #336699;
text-align: center;
}

.style106
{
width: 85px;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table style="width: 1160px">
<tr>
<td style="width: 197px; height: 39px">
&nbsp;
</td>
<td style="width: 311px; color: #1c344b; font-size: 16px; bgcolor:
LightSteelBlue;
height: 39px">
<asp:Label ID="lblShowingName" Font-Size="15px" ForeColor="Green"
runat="server"></asp:Label>...!!!
</td>
</tr>
</table>
<h1 style="background-color: #336699; color: #dde4ec">
Deleting of Existing Receptionist</h1>
<table style="height: auto; margin: 20px 0px 35px 0px; width: 1090px;">
<tr>
<td class="style19">
<br />
</td>
<td class="style4">
<table style="width: 711px">
<tr>
<td class="style5">
<table style="height: 105px; width: 716px">
<tr>
<td colspan="3" class="PanelHeader">
Get Receptionist Information To be Deleted
</td>
</tr>
<tr>
<td class="style1">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;
Position
</td>
<td class="style17">
<asp:DropDownList ID="DDlPost" runat="server"
BackColor="#F0F0F0" ForeColor="#003366"
Height="28px" Width="122px">

<asp:ListItem Value="-1">Select
Position</asp:ListItem>
<asp:ListItem>Receptionist</asp:ListItem>
<asp:ListItem>Waiter</asp:ListItem>
<asp:ListItem>Cooker</asp:ListItem>
<asp:ListItem>Cashier</asp:ListItem>
<asp:ListItem>Cleaner</asp:ListItem>
<asp:ListItem>IT Opereator</asp:ListItem>
</asp:DropDownList>
&nbsp;<asp:Label ID="LblMsg" runat="server" FontSize="14px" ForeColor="Red" Height="20px"
Width="74px"></asp:Label>
</td>
<td class="style18">
<asp:Button ID="btnShow" runat="server" Text="Show"
BackColor="#1C344B" ForeColor="White"
Height="36px" Width="93px" BorderColor="#5586B7"
BorderStyle="Solid" BorderWidth="3px"
ToolTip="Show All Receptionist as Selection Of their
Post" Style="margin-left: 28px"
OnClick="btnShow_Click" />
<asp:Button ID="btnShowAll" runat="server" Text="Show
All" BackColor="#1C344B" ForeColor="White"
Height="35px" Width="93px" BorderColor="#5586B7"
BorderStyle="Solid" BorderWidth="3px"
ToolTip="Show All Receptionist" Style="margin-left:
59px; margin-top: 0px; margin-bottom: 0px;"
OnClick="btnShowAll_Click" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="style5">
<table style="height: 63px; width: 717px; margin-top: 2px;
border: 4px solid #336699">
<tr>
<td colspan="3" class="PanelHeader">
Updated Information
</td>
</tr>
<tr>
<td colspan="3">
<table style="margin-left: 29px">
<tr>
<td>
<asp:Label ID="lblmessage" runat="server"
Height="24px" Width="638px" Font-Size="16px"
ForeColor="Red"></asp:Label>
<asp:GridView ID="GrdGuestDetails"
AutoGenerateColumns="False" runat="server" Width="640px"

BorderWidth="2px" BorderColor="Black"
Style="margin-top: 0px">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table style="height: 327px; width:
638px">
<tr>
<td colspan="3" class="style105">
<table style="margin-left: 254px;
width: auto;">
<tr>
<td class="style106">
Guest-Id:--</td>
<td style="width: auto">
<asp:Label ID="id"
runat="server" Font-Bold="True" Font-Size="14px" ForeColor="White"
Text='<%#
Bind("ReceptionistId") %>'></asp:Label>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="style57">
<table style="height: 290px;
width: 234px">
<tr>
<td class="style95">
Name
</td>
<td class="style100">
<asp:Label ID="lblName"
runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%#
Bind("Name") %>'></asp:Label>
</td>
</tr>
<tr>
<td class="style95">
F-Name
</td>
<td class="style100">
<asp:Label
ID="lblFname" runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%#
Bind("FatherName") %>'></asp:Label>
</td>
</tr>
<tr>

<td class="style95">
D.O.B.
</td>
<td class="style100">
<asp:Label ID="lbldob"
runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%#
Bind("DOB") %>'></asp:Label>
</td>
</tr>
<tr>
<td class="style95">
Sex
</td>
<td class="style100">
<asp:Label
ID="lblgender" runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%#
Bind("Gender") %>'></asp:Label>
</td>
</tr>
<tr>
<td class="style95">
Id-Type
</td>
<td class="style100">
<asp:Label
ID="lblidtypes" runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%#
Bind("IdType") %>'></asp:Label>
</td>
</tr>
<tr>
<td class="style96">
Id-No
</td>
<td class="style101">
<asp:Label ID="lblidno"
runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%#
Bind("IdNo") %>'></asp:Label>
</td>
</tr>
<tr>
<td class="style96">
City
</td>
<td class="style101">
<asp:Label ID="lblcity"
runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%# Bind("City")
%>'></asp:Label>

</td>
</tr>
<tr>
<td class="style96">
State
</td>
<td class="style101">
<asp:Label ID="lblstate"
runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%#
Bind("State") %>'></asp:Label>
</td>
</tr>
</table>
</td>
<td class="style54">
<table style="height: 290px;
width: 230px;">
<tr>
<td class="style97">
Pin Code
</td>
<td class="style102">
<asp:Label ID="lblPinNo"
runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%#
Bind("PinNo") %>'></asp:Label>
</td>
</tr>
<tr>
<td class="style97">
Mobile No
</td>
<td class="style102">
<asp:Label
ID="lblMobileNo" runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%#
Bind("MobileNo") %>'></asp:Label>
</td>
</tr>
<tr>
<td class="style97">
Country
</td>
<td class="style102">
<asp:Label
ID="lblcountry" runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%#
Bind("Country") %>'></asp:Label>
</td>
</tr>
<tr>

<td class="style97">
D.O.J.
</td>
<td class="style103">
<asp:Label ID="llbDOJ"
runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%# Bind("DOJ")
%>'></asp:Label>
</td>
</tr>
<tr>
<td class="style97">
User-Id
</td>
<td class="style103">
<asp:Label ID="lbluserid"
runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%#
Bind("ReceptionistId") %>'></asp:Label>
</td>
</tr>
<tr>
<td class="style97">
Password
</td>
<td class="style103">
<asp:Label
ID="lblpassword" runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%#
Bind("Password") %>'></asp:Label>
</td>
</tr>
<tr>
<td class="style97">
Position
</td>
<td class="style103">
<asp:Label ID="lblPost"
runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%# Bind("Post")
%>'></asp:Label>
</td>
</tr>
<tr>
<td class="style97">
&nbsp;Salary
</td>
<td class="style103">
<asp:Label ID="lblSalary"
runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%#
Bind("Salary") %>'></asp:Label>

</td>
</tr>
</table>
</td>
<td>
<table style="width: 148px">
<tr>
<td class="style104">
</td>
</tr>
<tr>
<td class="style68">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Photo
</td>
</tr>
<tr>
<td>
<asp:Image ID="Image2"
runat="server" Height="165px" ImageUrl='<%#Eval("Image") %>'
Width="141px" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3"
class="FieldName">
<table class="style88">
<tr>
<td class="style90">
Email-Id
</td>
<td class="style91">
<asp:Label ID="lblemail"
runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%#
Bind("EmailId") %>'></asp:Label>
</td>
</tr>
<tr>
<td class="style90">
Identification Mark
</td>
<td class="style91">
<asp:Label
ID="lblIdmarks" runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%#
Bind("IdMark") %>'></asp:Label>
</td>
</tr>

<tr>
<td class="style90">
Address
</td>
<td class="style91">
<asp:Label
ID="LblAddress" runat="server" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Text='<%#
Bind("Address") %>'></asp:Label>
</td>
</tr>
</table>
</td>
<tr>
<td colspan="3">
<table style="width: 100%">
<tr>
<td>
<asp:Button
ID="BtnSelect" runat="server" BackColor="#1C344B" BorderColor="#5586B7"
BorderStyle="Solid"
BorderWidth="3px" ForeColor="White" Height="37px" OnClick="BtnSelect_Click"
Style="margin-left:
288px; margin-top: 12px; margin-bottom: 10px;" Text="Select"
ToolTip="Select "
Width="93px" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
Guestreport.aspx.cs

using
using
using
using
using
using
using
using
using
using
using
using
using
using
using

System;
System.Collections;
System.Configuration;
System.Data;
System.Linq;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.HtmlControls;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Xml.Linq;
System.Data.SqlClient;
System.IO;
System.Globalization;

namespace HotelManagementSystem.Admin
{
public partial class GuestReport : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] != null)
{
lblShowingName.Text = Session["AdminId"].ToString();
Session["AdminId"] = Session["AdminId"].ToString();
}

}
protected void BtnRecord_Click1(object sender, EventArgs e)
{
if(Page.IsValid )
{
string GuestType = ddlGuestType.SelectedItem.ToString();
string RepotrType = ddlReportType.SelectedItem.ToString();
if (GuestType == "Check-In-Date")
{
switch (RepotrType)
{
case "Daily":
{
string d1 = ddldd.Text + "/" + ddlmm.Text + "/" + ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckInDate like '%" + d1 + "%'", SqlCon);

DataSet ds = new DataSet();


Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row >= 0)
{
lblmessage.Text = row.ToString() + "---Report(s) Found...!!!";
GRDBookedRoom.DataSource = ds;
GRDBookedRoom.DataBind();
}
else
{
lblmessage.Text = "Record Not Found...!!!";
}
}
break;
case "Monthly":
{
string d2 = ddlmm.Text + "/" + ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckInDate like '%" + d2 + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row >= 0)
{
lblmessage.Text = row.ToString() + "---Report(s) Found...!!!";
GRDBookedRoom.DataSource = ds;
GRDBookedRoom.DataBind();
}
else
{
lblmessage.Text = "Record Not Found...!!!";
}
}
break;
case "Yearly":
{
string d3 = ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckInDate like '%" + d3 + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];

int row = dt.Rows.Count;


if (row >= 0)
{
lblmessage.Text = row.ToString() + "---Report(s) Found...!!!";
GRDBookedRoom.DataSource = ds;
GRDBookedRoom.DataBind();
}
else
{
lblmessage.Text = "Record Not Found...!!!";
}
}
break;
default:
{
}
break;
}
}
else
{
switch (RepotrType)
{
case "Daily":
{
string d4 = ddldd.Text + "/" + ddlmm.Text + "/" + ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckOutDate like '%" + d4 + "%'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row >= 0)
{
lblmessage.Text = row.ToString() + "---Report(s) Found...!!!";
GRDBookedRoom.DataSource = ds;
GRDBookedRoom.DataBind();
}
else
{
lblmessage.Text = "";
lblmessage.Text = "Record Not Found...!!!";
}
}
break;
case "Monthly":

{
string d5 = ddlmm.Text + "/" + ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckOutDate like '%" + d5 + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row >= 0)
{
lblmessage.Text = row.ToString() + "---Report(s) Found...!!!";
GRDBookedRoom.DataSource = ds;
GRDBookedRoom.DataBind();
}
else
{
lblmessage.Text = "Record Not Found...!!!";
}
}
break;
case "Yearly":
{
string d6 = ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckOutDate like '%" + d6 + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row >= 0)
{
lblmessage.Text = row.ToString() + "---Report(s) Found...!!!";
GRDBookedRoom.DataSource = ds;
GRDBookedRoom.DataBind();
}
else
{
lblmessage.Text = "Record Not Found...!!!";
}
}
break;
default:
{
}

break;
}
}
}
}
protected void BtnShowPaymentDetails_Click(object sender, EventArgs e)
{
Button BtnShowPaymentDetails = (Button)sender;
GridViewRow row = (GridViewRow)BtnShowPaymentDetails.Parent.Parent;
Label lblBookingId = (Label)row.FindControl("lblBookingId");
Label LblCheckInDate = (Label)row.FindControl("LblCheckInDate");
Label LblCheckOutDate = (Label)row.FindControl("LblCheckOutDate");
string CheckIn = LblCheckInDate.Text;
string CheckOut = LblCheckOutDate.Text;
string BookingId = lblBookingId.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from BookedRooms where
GuestId='" + BookingId + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int rows = dt.Rows.Count;
if (rows > 0)
{
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from PaymentDetails
where GuestId='" + BookingId + "'", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, " PaymentDetails");
DataTable dt1 = ds1.Tables[0];
int rows1 = dt1.Rows.Count;
if (rows1 > 0)
{
PathStringClass path2 = new PathStringClass();
string DatabasePath2 = path2.Get_path();
SqlConnection SqlCon2 = new SqlConnection(DatabasePath2);
SqlDataAdapter Sqd2 = new SqlDataAdapter("select * from BookedRooms
where CheckInDate='" + CheckIn + "' and CheckOutDate='" + CheckOut + "'",
SqlCon2);
DataSet ds2 = new DataSet();
Sqd2.Fill(ds2, " BookedRooms");
DataTable dt2 = ds2.Tables[0];
int row2 = dt2.Rows.Count;
if (row2 > 0)
{

GRDBookedRoom.DataSource = ds2;
GRDBookedRoom.DataBind();
}
lblmessage.Text = "";
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GRDPaymentDetailsFromRecepTionist.DataSource = null;
GRDPaymentDetailsFromRecepTionist.DataBind();
GRDPaymentDetailsFromGuest.DataSource = ds1;
GRDPaymentDetailsFromGuest.DataBind();
}
else
{
lblmessage.Text = "Payment Report Not Found...!!!";
}

}
else
{
PathStringClass path3 = new PathStringClass();
string DatabasePath3 = path3.Get_path();
SqlConnection SqlCon3 = new SqlConnection(DatabasePath3);
SqlDataAdapter Sqd3 = new SqlDataAdapter("select * from
PaymentsFromReceptionist where BookingId='" + BookingId + "'", SqlCon3);
DataSet ds3 = new DataSet();
Sqd3.Fill(ds3, " PaymentsFromReceptionist");
DataTable dt3 = ds3.Tables[0];
int rows3 = dt3.Rows.Count;
if (rows3 > 0)
{
PathStringClass path2 = new PathStringClass();
string DatabasePath2 = path2.Get_path();
SqlConnection SqlCon2 = new SqlConnection(DatabasePath2);
SqlDataAdapter Sqd2 = new SqlDataAdapter("select * from BookedRooms
where CheckInDate='" + CheckIn + "' and CheckOutDate='" + CheckOut + "'",
SqlCon2);
DataSet ds2 = new DataSet();
Sqd2.Fill(ds2, " BookedRooms");
DataTable dt2 = ds2.Tables[0];
int row2 = dt2.Rows.Count;
if (row2 > 0)
{
GRDBookedRoom.DataSource = ds2;
GRDBookedRoom.DataBind();
}
lblmessage.Text = "";
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GRDPaymentDetailsFromGuest.DataSource = null;
GRDPaymentDetailsFromGuest.DataBind();

GRDPaymentDetailsFromRecepTionist.DataSource = ds3;
GRDPaymentDetailsFromRecepTionist.DataBind();
}
else
{
lblmessage.Text = "Payment Report Not Found...!!!";
}
}

}
protected void btnShowGuestDetails_Click(object sender, EventArgs e)
{
Button btnShow = (Button)sender;
GridViewRow row = (GridViewRow)btnShow.Parent.Parent;
Label LblGuestId = (Label)row.FindControl("LblGuestId");
Label LblCheckInDate = (Label)row.FindControl("LblCheckInDate");
Label LblCheckOutDate = (Label)row.FindControl("LblCheckOutDate");
string CheckIn = LblCheckInDate.Text;
string CheckOut = LblCheckOutDate.Text;
string GuestId = LblGuestId.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from GuestDetails where
GuestId='" + GuestId + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " GuestDetails");
DataTable dt = ds.Tables[0];
int rows = dt.Rows.Count;
if (rows != 0)
{
PathStringClass path2 = new PathStringClass();
string DatabasePath2 = path2.Get_path();
SqlConnection SqlCon2 = new SqlConnection(DatabasePath2);
SqlDataAdapter Sqd2 = new SqlDataAdapter("select * from BookedRooms
where CheckInDate='" + CheckIn + "' and CheckOutDate='" + CheckOut + "'",
SqlCon2);
DataSet ds2 = new DataSet();
Sqd2.Fill(ds2, " BookedRooms");
DataTable dt2 = ds2.Tables[0];
int row2 = dt2.Rows.Count;
if (row2 > 0)
{
GRDBookedRoom.DataSource = ds2;
GRDBookedRoom.DataBind();
}

lblmessage.Text = "";
GRDPaymentDetailsFromGuest.DataSource = null;
GRDPaymentDetailsFromGuest.DataBind();
GRDPaymentDetailsFromRecepTionist.DataSource = null;
GRDPaymentDetailsFromRecepTionist.DataBind();
GrdGuestDetails.DataSource = ds;
GrdGuestDetails.DataBind();
}
else
{
lblmessage.Text = "Record not found";
}
}
protected void btnClosePaymentDetailsFromGuest_Click(object sender, EventArgs e)
{
lblmessage.Text = "";
GRDPaymentDetailsFromGuest.DataSource = null;
GRDPaymentDetailsFromGuest.DataBind();
}
protected void btnClosePaymentDetailsFromReceptionist_Click(object sender,
EventArgs e)
{
lblmessage.Text = "";
GRDPaymentDetailsFromRecepTionist.DataSource = null;
GRDPaymentDetailsFromRecepTionist.DataBind();
}
protected void CloseAllReports_Click(object sender, EventArgs e)
{
lblmessage.Text = "";
GRDBookedRoom.DataSource = null;
GRDBookedRoom.DataBind();
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GRDPaymentDetailsFromGuest.DataSource = null;
GRDPaymentDetailsFromGuest.DataBind();
GRDPaymentDetailsFromRecepTionist.DataSource = null;
GRDPaymentDetailsFromRecepTionist.DataBind();
}
protected void CloseGuestDetails_Click(object sender, EventArgs e)
{
lblmessage.Text = "";
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
}
protected void ddlReportType_SelectedIndexChanged(object sender, EventArgs e)

{
string ReportType = ddlReportType.SelectedItem.ToString();
switch (ReportType)
{
case "Daily":
{
ddldd.Enabled = true;
ddlmm.Enabled = true;
ddlyyyy.Enabled = true;
}
break;
case "Monthly":
{
ddldd.Enabled = false;
ddlmm.Enabled = true;
ddlyyyy.Enabled = true;
}
break;
case "Yearly":
{
ddldd.Enabled = false;
ddlmm.Enabled = false;
ddlyyyy.Enabled = true;
}
break;
}
}
protected void CustomValidator1_ServerValidate(object source,
ServerValidateEventArgs args)
{
if (ddldd.Enabled)
{
if (ddldd.SelectedItem.ToString() == "Day")
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
else
{
args.IsValid = true;
}

protected void CustomValidator2_ServerValidate(object source,


ServerValidateEventArgs args)
{
if (ddlmm.Enabled)
{
if (ddlmm.SelectedItem.ToString() == "Month")
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
else
{
args.IsValid = true;
}
}
protected void CustomValidator3_ServerValidate(object source,
ServerValidateEventArgs args)
{
if (ddlReportType.SelectedItem.ToString() == "Select")
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
}
}
Logout.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace HotelManagementSystem.Admin
{
public partial class LogOut : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Session.Abandon();
Session.Clear();

Response.Redirect("../Account/AdminLogin.aspx");
}
}
}
Paymentreport.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
using System.Globalization;
namespace HotelManagementSystem.Admin
{
public partial class PaymentReport : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] != null)
{
lblShowingName.Text = Session["AdminId"].ToString();
Session["AdminId"] = Session["AdminId"].ToString();
}
}
protected void BtnRecord_Click1(object sender, EventArgs e)
{
if(Page.IsValid )
{
Int64 TotalAmount =0;
Boolean executeCont = false;
string ReportType = ddlReportType.SelectedItem.ToString();
DataTable ReportTable = new DataTable();
ReportTable.Columns.Add("BookingId");
ReportTable.Columns.Add("GuestId");
ReportTable.Columns.Add("Name");
ReportTable.Columns.Add("RoomNo");
ReportTable.Columns.Add("CheckInDate");
ReportTable.Columns.Add("CheckOutDate");
ReportTable.Columns.Add("Amount");

switch (ReportType)

{
case "Daily":
{
string Report =ddldd .Text+ddlmm .Text+ ddlyyyy.Text;
//Payment details from Guest
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from PaymentDetails
where DateOfPayment like '%" + Report + "%'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "PaymentDetails");
DataTable dt = ds.Tables[0];
int rows = dt.Rows.Count;
int i = 0;
if (rows != 0)
{
foreach (DataRow dr in ds.Tables["PaymentDetails"].Rows)
{
DataRow NewDr = ReportTable.NewRow();
NewDr["BookingId"] = dt.Rows[i][11].ToString();
NewDr["GuestId"] = dt.Rows[i][0].ToString();
NewDr["Name"] = dt.Rows[i][1].ToString();
NewDr["RoomNo"] = dt.Rows[i][2].ToString();
NewDr["CheckInDate"] = dt.Rows[i][3].ToString();
NewDr["CheckOutDate"] = dt.Rows[i][4].ToString();
NewDr["Amount"] = dt.Rows[i][5].ToString();
string amt = dt.Rows[i][5].ToString();
TotalAmount = TotalAmount + Int64.Parse(amt);
ReportTable.Rows.Add(NewDr);
ReportTable.AcceptChanges();
ViewState["ReportTable"] = ReportTable;
executeCont = true;
i = i + 1;
}
}
//Pyment Details from Receptionist
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from
PaymentsFromReceptionist where DateOfPayment like '%" + Report + "'", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "PaymentsFromReceptionist");
DataTable dt1 = ds1.Tables[0];
int rows1 = dt1.Rows.Count;
if (rows1 != 0)
i = 0;
{

foreach (DataRow dr1 in


ds1.Tables["PaymentsFromReceptionist"].Rows)
{
DataRow NewDr = ReportTable.NewRow();
NewDr["BookingId"] = dt.Rows[i][11].ToString();
NewDr["GuestId"] = dt.Rows[i][0].ToString();
NewDr["Name"] = dt.Rows[i][1].ToString();
NewDr["RoomNo"] = dt.Rows[i][2].ToString();
NewDr["CheckInDate"] = dt.Rows[i][3].ToString();
NewDr["CheckOutDate"] = dt.Rows[i][4].ToString();
NewDr["Amount"] = dt.Rows[i][5].ToString();
string amt = dt.Rows[i][5].ToString();
TotalAmount = TotalAmount + Int64.Parse(amt);
ReportTable.Rows.Add(NewDr);
ReportTable.AcceptChanges();
ViewState["ReportTable"] = ReportTable;
executeCont = true;
i = i + 1;
}
}
DataTable ResultTable = (DataTable)ViewState["ReportTable"];
int NoOfRows;
if (executeCont)
{
NoOfRows = ResultTable.Rows.Count;
GrdTempPaymentDetails.DataSource = ResultTable;
GrdTempPaymentDetails.DataBind();
LblAmount.Text = TotalAmount.ToString();
LblAmount0.Text = "Total Amount Is =";
}
else
{
GrdTempPaymentDetails.DataSource = null;
GrdTempPaymentDetails.DataBind();
LblMessge.Text = "Amount Report Not Found In This year...!!!";
LblAmount0.Text = "";
}
}
break;
case "Monthly":
{
string Report = ddlmm.Text + ddlyyyy.SelectedItem.ToString();
//Payment details from Guest
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from PaymentDetails
where DateOfPayment like '%" + Report + "'", SqlCon);

DataSet ds = new DataSet();


Sqd.Fill(ds, "PaymentDetails");
DataTable dt = ds.Tables[0];
int rows = dt.Rows.Count;
int i = 0;
if (rows != 0)
{
foreach (DataRow dr in ds.Tables["PaymentDetails"].Rows)
{
DataRow NewDr = ReportTable.NewRow();
NewDr["BookingId"] = dt.Rows[i][11].ToString();
NewDr["GuestId"] = dt.Rows[i][0].ToString();
NewDr["Name"] = dt.Rows[i][1].ToString();
NewDr["RoomNo"] = dt.Rows[i][2].ToString();
NewDr["CheckInDate"] = dt.Rows[i][3].ToString();
NewDr["CheckOutDate"] = dt.Rows[i][4].ToString();
NewDr["Amount"] = dt.Rows[i][5].ToString();
string amt = dt.Rows[i][5].ToString();
TotalAmount = TotalAmount + Int64.Parse(amt);
ReportTable.Rows.Add(NewDr);
ReportTable.AcceptChanges();
ViewState["ReportTable"] = ReportTable;
executeCont = true;
i = i + 1;
}
}
//Pyment Details from Receptionist
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from
PaymentsFromReceptionist where DateOfPayment like '%" + Report + "'", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "PaymentsFromReceptionist");
DataTable dt1 = ds1.Tables[0];
int rows1 = dt1.Rows.Count;
if (rows1 != 0)
i = 0;
{
foreach (DataRow dr1 in
ds1.Tables["PaymentsFromReceptionist"].Rows)
{
DataRow NewDr = ReportTable.NewRow();
NewDr["BookingId"] = dt.Rows[i][11].ToString();
NewDr["GuestId"] = dt.Rows[i][0].ToString();
NewDr["Name"] = dt.Rows[i][1].ToString();
NewDr["RoomNo"] = dt.Rows[i][2].ToString();
NewDr["CheckInDate"] = dt.Rows[i][3].ToString();
NewDr["CheckOutDate"] = dt.Rows[i][4].ToString();
NewDr["Amount"] = dt.Rows[i][5].ToString();

string amt = dt.Rows[i][5].ToString();


TotalAmount = TotalAmount + Int64.Parse(amt);
ReportTable.Rows.Add(NewDr);
ReportTable.AcceptChanges();
ViewState["ReportTable"] = ReportTable;
executeCont = true;
i = i + 1;
}
}
DataTable ResultTable = (DataTable)ViewState["ReportTable"];
int NoOfRows;
if (executeCont)
{
NoOfRows = ResultTable.Rows.Count;
GrdTempPaymentDetails.DataSource = ResultTable;
GrdTempPaymentDetails.DataBind();
LblAmount.Text = TotalAmount.ToString();
LblAmount0.Text = "Total Amount Is =";
}
else
{
GrdTempPaymentDetails.DataSource = null;
GrdTempPaymentDetails.DataBind();
LblMessge.Text = "Amount Report Not Found In This year...!!!";
LblAmount0.Text = "";
}
}
break;
case "Yearly":
{
string Report = ddlyyyy.SelectedItem.ToString();
//Payment details from Guest
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from PaymentDetails
where DateOfPayment like '%" + Report + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "PaymentDetails");
DataTable dt = ds.Tables[0];
int rows = dt.Rows.Count;
int i=0;
if(rows!=0)
{
foreach (DataRow dr in ds.Tables["PaymentDetails"].Rows)
{
DataRow NewDr = ReportTable.NewRow();
NewDr["BookingId"] = dt.Rows[i][11].ToString();

NewDr ["GuestId"]=dt.Rows [i][0].ToString ();


NewDr ["Name"]=dt.Rows [i][1].ToString ();
NewDr ["RoomNo"]=dt.Rows[i][2].ToString ();
NewDr["CheckInDate"]=dt.Rows[i][3].ToString ();
NewDr ["CheckOutDate"]=dt.Rows[i][4].ToString ();
NewDr ["Amount"]=dt.Rows [i][5].ToString ();
string amt = dt.Rows[i][5].ToString();
TotalAmount = TotalAmount + Int64.Parse(amt);
ReportTable.Rows .Add (NewDr );
ReportTable .AcceptChanges ();
ViewState["ReportTable"]=ReportTable ;
executeCont = true;
i=i+1;
}
}
//Pyment Details from Receptionist
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from
PaymentsFromReceptionist where DateOfPayment like '%" + Report + "'", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "PaymentsFromReceptionist");
DataTable dt1 = ds1.Tables[0];
int rows1 = dt1.Rows.Count;
if (rows1 != 0)
i = 0;
{
foreach (DataRow dr1 in
ds1.Tables["PaymentsFromReceptionist"].Rows)
{
DataRow NewDr = ReportTable.NewRow();
NewDr["BookingId"] = dt.Rows[i][11].ToString();
NewDr["GuestId"] = dt.Rows[i][0].ToString();
NewDr["Name"] = dt.Rows[i][1].ToString();
NewDr["RoomNo"] = dt.Rows[i][2].ToString();
NewDr["CheckInDate"] = dt.Rows[i][3].ToString();
NewDr["CheckOutDate"] = dt.Rows[i][4].ToString();
NewDr["Amount"] = dt.Rows[i][5].ToString();
string amt = dt.Rows[i][5].ToString();
TotalAmount = TotalAmount + Int64.Parse(amt);
ReportTable.Rows.Add(NewDr);
ReportTable.AcceptChanges();
ViewState["ReportTable"] = ReportTable;
executeCont = true;
i = i + 1;
}
}
DataTable ResultTable = (DataTable)ViewState["ReportTable"];
int NoOfRows;

if (executeCont)
{
NoOfRows = ResultTable.Rows.Count;
GrdTempPaymentDetails.DataSource = ResultTable;
GrdTempPaymentDetails.DataBind();
LblAmount.Text =TotalAmount.ToString ();
LblAmount0.Text = "Total Amount Is =";
}
else
{
GrdTempPaymentDetails.DataSource = null;
GrdTempPaymentDetails.DataBind();
LblMessge.Text = "Amount Report Not Found In This year...!!!";
LblAmount0.Text = "";
}
}
break;
}
}
}
protected void ddlReportType_SelectedIndexChanged(object sender, EventArgs e)
{
string ReportType = ddlReportType.SelectedItem.ToString();
switch (ReportType)
{
case "Daily":
{
ddldd.Enabled = true;
ddlmm.Enabled = true;
ddlyyyy.Enabled = true;
LblAmount.Text = "";
LblAmount0.Text = "";
LblMessge.Text = "";
}
break;
case "Monthly":
{
ddldd.Enabled = false;
ddlmm.Enabled = true;
ddlyyyy.Enabled = true;
LblAmount.Text = "";
LblAmount0.Text = "";
LblMessge.Text = "";
}
break;

case "Yearly":
{
ddldd.Enabled = false;
ddlmm.Enabled = false;
ddlyyyy.Enabled = true;
LblAmount.Text = "";
LblAmount0.Text = "";
LblMessge.Text = "";
}
break;
}
}
protected void BtnOk_Click(object sender, EventArgs e)
{
GrdTempPaymentDetails.DataSource = null;
GrdTempPaymentDetails.DataBind();
LblMessge.Text = "";
LblAmount.Text = "";
}
protected void BtnPrint_Click(object sender, EventArgs e)
{
LblMessge.Text = "Please save all payment details for further use....!!!";
}
protected void CustomValidator1_ServerValidate(object source,
ServerValidateEventArgs args)
{
if (ddldd.Enabled)
{
if (ddldd.SelectedItem.ToString() == "Day")
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
else
{
args.IsValid = true;
}

}
protected void CustomValidator2_ServerValidate(object source,
ServerValidateEventArgs args)
{

if (ddlmm.Enabled)
{
if (ddlmm.SelectedItem.ToString() == "Month")
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
else
{
args.IsValid = true;
}
}
}
}
Eceptionistrecords.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Admin
{
public partial class ReceptionistRecords : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] != null)
{
lblShowingName.Text = Session["AdminId"].ToString();
Session["AdminId"] = Session["AdminId"].ToString();
}

PathStringClass path = new PathStringClass();


string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);

SqlDataAdapter Sqd = new SqlDataAdapter("select * from ReceptionistDetails ",


SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "ReceptionistDetails");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
lblmessage.Text = " Total " + row.ToString() + " Receptionist(s) Records
found....!!!";
GrdReceptionistDetails.DataSource = ds;
GrdReceptionistDetails.DataBind();
}
else
{
lblmessage.Text = "Receptionist Records not Found.......!!!!!";
}
}
}
}
Receptionistreport.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Admin
{
public partial class ReceptionistReport : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] != null)
{
lblShowingName.Text = Session["AdminId"].ToString();
Session["AdminId"] = Session["AdminId"].ToString();
}
}

protected void btnShow_Click(object sender, EventArgs e)


{
string Role = DDlPost.SelectedItem.ToString();
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from ReceptionistDetails
where Post='" + Role + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "ReceptionistDetails");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
lblmessage.Text = "";
GrdGuestDetails.DataSource = ds;
GrdGuestDetails.DataBind();
}
else
{
lblmessage.Text = "Receptionist not found";
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
}
}
protected void btnShowAll_Click(object sender, EventArgs e)
{
lblmessage.Text = "";
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from ReceptionistDetails",
SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "ReceptionistDetails");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
lblmessage.Text = "";
GrdGuestDetails.DataSource = ds;
GrdGuestDetails.DataBind();
}
else
{
lblmessage.Text = "Receptionist not found";
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
}
}

protected void BtnClose_Click(object sender, EventArgs e)


{
lblmessage.Text = "";
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
}
}
}
receptionistupdation.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
using System.Globalization;
namespace HotelManagementSystem.Admin
{
public partial class ReceptionistUpdation : System.Web.UI.Page
{
public string ImgPath;//veriable for storing image path
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] != null)
{
lblShowingName.Text = Session["AdminId"].ToString();
Session["AdminId"] = Session["AdminId"].ToString();
}
if (Session["ReceptionistId"] != null)
{
txtreceptionistid.Text = Session["ReceptionistId"].ToString();
txtreceptionistid.ReadOnly = true;
LblMessage.Text = "Enter Receptionist Information to be Updated...!!!";
}
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{

Boolean execute = false;


if (UploadImage.HasFile)
{
ImgPath = ImagePath();
if (ImgPath != null)
{
execute = true;
}
}
else
{
LblPictureMessege.Text = "Please select Picture...!!!";
}
if(execute )
{
Update_Receptionist_Details(ImgPath);
Show_Receptionist_Details();
}
}
}
private void Update_Receptionist_Details( string ImgPath)
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
ReceptionistDetails where ReceptionistId='" + txtreceptionistid.Text + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "ReceptionistDetails");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
foreach (DataRow dr in dt.Rows)
{
dr[0] = ddlnametitle.SelectedItem.ToString() + txtname.Text;
dr[1] = ddlfnametitle.SelectedItem.ToString() + txtfname.Text;
dr[2] = ddldd.SelectedItem.ToString() + "/" +
ddlmm.SelectedItem.ToString() + "/" + ddlyyyy.SelectedItem.ToString();
dr[3] = ddlgender.SelectedItem.ToString();
dr[4] = txtidmark.Text;
dr[5] = txtmobile.Text;
dr[6] = txtemail.Text;
dr[7] = ddlidtype.SelectedItem.ToString();
dr[8] = txtidno.Text;
dr[9] = txtaddress.Text;
dr[10] = txtcity.Text;
dr[11] = txtstate.Text;
dr[12] = txtpinno.Text;
dr[13] = txtcountry.Text;
dr[14] = txtreceptionistid.Text;

dr[15] = txtpassword.Text;
dr[16] = txtconfirmpassword.Text;
dr[17] = txtdoj.Text;
dr[18] = ImgPath;
dr[19] = DDlPost.SelectedItem.ToString();
dr[20] = txtSalary.Text;
SqlCommandBuilder cd = new SqlCommandBuilder(Sqd);
Sqd.Update(dt);
}
}
private void Show_Receptionist_Details()
{
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from ReceptionistDetails
where ReceptionistId='" + txtreceptionistid.Text + "'", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "ReceptionistDetails");
DataTable dt1 = ds1.Tables[0];
int row1 = dt1.Rows.Count;
if (row1 > 0)
{
GrdGuestDetails.DataSource = ds1;
GrdGuestDetails.DataBind();
}
}
private string ImagePath()
{
Boolean FileOK = false;
//Boolean FileSaved = false;
int k = 0;

Session["WorkingImage"] = UploadImage.FileName;
String FileExtension =
Path.GetExtension(Session["WorkingImage"].ToString()).ToLower();
//renaming File
Random MyRandom = new Random();
string FilenameWithoutExtension =
Path.GetFileNameWithoutExtension(Session["WorkingImage"].ToString());
string fileNameIncreament = Convert.ToString(MyRandom.Next(10, 300000));
FilenameWithoutExtension = FilenameWithoutExtension + fileNameIncreament;
Session["ImageFileName"] = FilenameWithoutExtension + FileExtension;
String[] allowedExtensions = { ".png", ".jpeg", ".jpg", ".gif", ".htm" };
for (int i = 0; i < allowedExtensions.Length; i++)
{

k++;
if (FileExtension == allowedExtensions[i])
{
FileOK = true;
break;
}
}
if (FileOK)
{
try
{
string path = (Server.MapPath("../ReceptionistImages")).ToString();
UploadImage.SaveAs(path + "/" + Session["ImageFileName"].ToString());
}
catch (Exception ex)
{
}
}
string dbfilePath;
string fileName = Path.GetFileName(Session["ImageFileName"].ToString());
dbfilePath = @"../ReceptionistImages/" + fileName;
if (!FileOK)
{
dbfilePath = null;
}
return dbfilePath;
}
protected void BtnClose_Click(object sender, EventArgs e)
{
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
}
protected void Validate_Entered_Phone_Number(object source,
ServerValidateEventArgs args)
{
if (args.Value == "")
{
args.IsValid = false;
}
else
{
Int64 number;
Boolean IsNumber = Int64.TryParse(args.Value, out number);
if (IsNumber && number <= 9999999999 && number >= 1000000000)
{
args.IsValid = true;
}
{

args.IsValid = false;
}
}
}
}
}
Registerexecutive.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;

namespace HotelManagementSystem.Admin
{
public partial class RegisterExecutive : System.Web.UI.Page
{
string ImgPath;//Image storing
Boolean value = false;
Boolean IsExistId = false;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] != null)
{
lblShowingName.Text = Session["AdminId"].ToString();
Session["AdminId"] = Session["AdminId"].ToString();
}
if (IsPostBack)
{
LblPictureMessege.ForeColor = System.Drawing.Color.Red;
LblPictureMessege.Text = "Please Select Image";
}
}
protected void btnok_Click1(object sender, EventArgs e)
{
GrdReceptionistDetails.DataSource = null;
GrdReceptionistDetails.DataBind();

LblMessage.Text = "";
btnregister.Enabled = true;
}
protected void btnregister_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
if (UploadImage.HasFile)
{
ImgPath = ImagePath();
IsExistId = check_ID();
if (ImgPath != null && IsExistId)
{
Register_Receptionist(ImgPath);
Show_Registered_Iformation();
}
}
else
{
LblPictureMessege.Text = "Please Select Image";
}
}
else
{
LblMessage.Text = "Uknown Error occured!!!";
}
}
private string ImagePath()
{
Boolean FileOK = false;
int k = 0;
Session["WorkingImage"] = UploadImage.FileName;
String FileExtension =
Path.GetExtension(Session["WorkingImage"].ToString()).ToLower();
//renaming File
Random MyRandom = new Random();
string FilenameWithoutExtension =
Path.GetFileNameWithoutExtension(Session["WorkingImage"].ToString());
string fileNameIncreament = Convert.ToString(MyRandom.Next(10, 300000));
FilenameWithoutExtension = FilenameWithoutExtension + fileNameIncreament;
Session["ImageFileName"] = FilenameWithoutExtension + FileExtension;
String[] allowedExtensions = { ".png", ".jpeg", ".jpg", ".gif", ".htm" };
for (int i = 0; i < allowedExtensions.Length; i++)
{
k++;
if (FileExtension == allowedExtensions[i])
{
FileOK = true;
break;

}
}
if (FileOK)
{
try
{
string path = (Server.MapPath("../ReceptionistImages")).ToString();
UploadImage.SaveAs(path + "/" + Session["ImageFileName"].ToString());
}
catch (Exception ex)
{
}
}
else
{
LblPictureMessege.Text = "Please Select Valid Image";
}
string dbfilePath;
string fileName = Path.GetFileName(Session["ImageFileName"].ToString());
dbfilePath = @"../ReceptionistImages/" + fileName;
if (!FileOK)
{
dbfilePath = null;
}
return dbfilePath;
}
private bool check_ID()
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from ReceptionistDetails
where ReceptionistId='" + txtreceptionistid.Text + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "ReceptionistDetails");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
GrdReceptionistDetails.DataSource = ds;
GrdReceptionistDetails.DataBind();
LblMessage.Text = "This Id is already given to othere staff";
value = false;
}
else
{
value = true;
LblMessage.Text = "Id Is Available for Giving";
}

return value;
}
private void Register_Receptionist(string ImgPath)
{
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from GuestDetails",
SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "GuestDetails");
DataTable dt1 = ds1.Tables[0];
DataRow dr1 = dt1.NewRow();
dr1[0] = ddlnametitle.SelectedItem.ToString() + txtname.Text;
dr1[1] = ddlfnametitle.SelectedItem.ToString() + txtfname.Text;
dr1[2] = ddldd.SelectedItem.ToString() + "/" + ddlmm.SelectedItem.ToString() +
"/" + ddlyyyy.SelectedItem.ToString();
dr1[3] = ddlgender.SelectedItem.ToString();
dr1[4] = txtidmark.Text;
dr1[5] = txtmobile.Text;
dr1[6] = txtemail.Text;
dr1[7] = ddlidtype.SelectedItem.ToString();
dr1[8] = txtidno.Text;
dr1[9] = txtaddress.Text;
dr1[10] = txtcity.Text;
dr1[11] = txtstate.Text;
dr1[12] = txtpinno.Text;
dr1[13] = txtcountry.Text;
dr1[14] = txtreceptionistid.Text;
dr1[15] = txtpassword.Text;
dr1[16] = txtconfirmpassword.Text;
dr1[17] = ImgPath;
dt1.Rows.Add(dr1);
SqlCommandBuilder cd = new SqlCommandBuilder(Sqd1);
Sqd1.Update(dt1);
LblMessage.Text = "Staff Has Got Registered, Informations are shown bellow";
}
private void Show_Registered_Iformation()
{
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd2 = new SqlDataAdapter("select * from GuestDetails where
GuestId='" + txtreceptionistid.Text + "'", SqlCon1);
DataSet ds2 = new DataSet();
Sqd2.Fill(ds2, "GuestDetails");
DataTable dt2 = ds2.Tables[0];
int noofrow = dt2.Rows.Count;
if (noofrow != 0)

{
GrdReceptionistDetails.DataSource = ds2;
GrdReceptionistDetails.DataBind();
}
else
{
LblMessage.Text = "There is An Error...!!!";
}
}
protected void BtnCheck_Click(object sender, EventArgs e)
{
Boolean IsThisIdExist = false;
IsThisIdExist = check_ID();
if (IsThisIdExist)
{
LblMessage.Text = "This id is already given to othere staff";
}
else
{
LblMessage.Text = "This id is not Avilable for giving";
}
}
}
}
Registernewroom.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Admin
{
public partial class CreationRoomAndOffice : System.Web.UI.Page
{
string ImgPath;
Boolean Value = false;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] != null)

{
lblShowingName.Text = Session["AdminId"].ToString();
Session["AdminId"] = Session["AdminId"].ToString();
}
}
protected void btnaddroom_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
if (UploadImage.HasFile)
{
Boolean IsExistRoomNo = false;
ImgPath = ImagePath();
IsExistRoomNo = Check_RoomNo();
if (ImgPath != null && IsExistRoomNo)
{
Add_This_Room(ImgPath);
Display_Added_Room();
}
}
else
{
lblmessage.Text = "Please select Picture...!!!";
}
}
else
{
lblmessage.Text = "Please check all given information";
}
}
private string ImagePath()
{
Boolean FileOK = false;
int k = 0;
Session["WorkingImage"] = UploadImage.FileName;
String FileExtension =
Path.GetExtension(Session["WorkingImage"].ToString()).ToLower();
//renaming File
Random MyRandom = new Random();
string FilenameWithoutExtension =
Path.GetFileNameWithoutExtension(Session["WorkingImage"].ToString());
string fileNameIncreament = Convert.ToString(MyRandom.Next(10, 300000));
FilenameWithoutExtension = FilenameWithoutExtension + fileNameIncreament;
Session["ImageFileName"] = FilenameWithoutExtension + FileExtension;
String[] allowedExtensions = { ".png", ".jpeg", ".jpg", ".gif", ".htm" };
for (int i = 0; i < allowedExtensions.Length; i++)
{
k++;

if (FileExtension == allowedExtensions[i])
{
FileOK = true;
break;
}
}
if (FileOK)
{
try
{
string path = (Server.MapPath("../RoomImages")).ToString();
UploadImage.SaveAs(path + "/" + Session["ImageFileName"].ToString());
}
catch (Exception ex)
{
}
}
else
{
lblmessage.Text = "Please Select Valid Image";
}
string dbfilePath;
string fileName = Path.GetFileName(Session["ImageFileName"].ToString());
dbfilePath = @"../RoomImages/" + fileName;
if (!FileOK)
{
dbfilePath = null;
}
return dbfilePath;
}
private bool Check_RoomNo()
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd2 = new SqlDataAdapter("select * from Room where
RoomNo='" + txtRoomNo.Text + "'", SqlCon);
DataSet ds2 = new DataSet();
Sqd2.Fill(ds2, "Room");
DataTable dt2 = ds2.Tables[0];
int noofrow = dt2.Rows.Count;
if (noofrow != 0)
{
lblmessage.Text = "This Room is already added";
GrdRooms.DataSource = ds2;
GrdRooms.DataBind();
Value = false;
}
else
{
Value = true;

}
return Value;
}
private void Add_This_Room(string ImgPath)
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Room ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Room");
DataTable dt = ds.Tables[0];
DataRow dr = dt.NewRow();
dr[0] = txtRoomNo.Text;
dr[1] = ddlroomtype.SelectedItem.ToString();
dr[2] = ddlroomcapacity.SelectedItem.ToString();
dr[3] = txtrate.Text;
dr[4] = ddlroomstatus.SelectedItem.ToString();
dr[5] = ImgPath;
dt.Rows.Add(dr);
SqlCommandBuilder cd = new SqlCommandBuilder(Sqd);
Sqd.Update(dt);
lblmessage.Text = "Room Is successfully added..";
lblmessage.ForeColor = System.Drawing.Color.Green;
}
private void Display_Added_Room()
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd2 = new SqlDataAdapter("select * from Room where
RoomNo='" + txtRoomNo.Text + "'", SqlCon);
DataSet ds2 = new DataSet();
Sqd2.Fill(ds2, "Room");
DataTable dt2 = ds2.Tables[0];
int noofrow = dt2.Rows.Count;
if (noofrow != 0)
{
GrdRooms.DataSource = ds2;
GrdRooms.DataBind();
}
}
protected void btnselect_Click(object sender, EventArgs e)
{
Button imgbtn = (Button)sender;
GridViewRow row = (GridViewRow)imgbtn.Parent.Parent;
Label lblRoomNo = (Label)row.FindControl("lblRoomNo");
Session["RoomNo"] = lblRoomNo.Text;

Session["ComeBack"] = "ComeBack";
Response.Redirect("~/Admin/DeleteSelectedRoom.aspx");
}
protected void ShowAllRooms_Click(object sender, EventArgs e)
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Room ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Room");
DataTable dt = ds.Tables[0];
DataRow dr = dt.NewRow();
int Room = 0;
Room = dt.Rows.Count;
if (Room != 0)
{
GrdRooms.DataSource = ds;
GrdRooms.DataBind();
lblmessage.Text = "";
}
else
{
lblmessage.Text = "There are no rooms found!!!";
}

}
protected void CustomValidator1_ServerValidate(object source,
ServerValidateEventArgs args)
{
Boolean check;
int number;
check = int.TryParse(args.Value ,out number);
args.IsValid = check;
}
protected void CustomValidator2_ServerValidate(object source,
ServerValidateEventArgs args)
{
Boolean check;
int number;
check = int.TryParse(args.Value, out number);
args.IsValid = check;
}

}
}
Roomreport.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
using System.Globalization;
namespace HotelManagementSystem.Admin
{
public partial class RoomReport : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] != null)
{
lblShowingName.Text = Session["AdminId"].ToString();
Session["AdminId"] = Session["AdminId"].ToString();
}
}
protected void BtnShow_Click1(object sender, EventArgs e)
{
string RoomStaus = ddlRoomType.SelectedItem.ToString();
switch (RoomStaus)
{
case "Booked":
case "Vacant":
{
if (ddlRoomType.Text == "Booked")
{
Boolean IsPickedUpBookedRoomNo = false;
string Formate = "dd/MM/yyyy";
string MyDate = DateTime.Now.ToString("dd/MM/yyyy");
DateTime Today = DateTime.ParseExact(MyDate, Formate,
CultureInfo.InvariantCulture);
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms ", SqlCon);

DataSet ds = new DataSet();


Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int row = ds.Tables[0].Rows.Count;
if (row != 0)
{
int i = 0;
int totalsRoom = 0;
DataTable tempTable = new DataTable();
tempTable.Columns.Add("RoomNo");
tempTable.Columns.Add("CheckInDate");
tempTable.Columns.Add("CheckOutDate");
tempTable.Columns.Add("BookingId");
tempTable.Columns.Add("GuestId");
foreach (DataRow dr in dt.Rows)
{
string CheckInDate = dt.Rows[i][1].ToString();
DateTime TableDateIn = DateTime.ParseExact(CheckInDate,
Formate, CultureInfo.InvariantCulture);
string CheckOutDate = dt.Rows[i][2].ToString();
DateTime TableDateOut = DateTime.ParseExact(CheckOutDate,
Formate, CultureInfo.InvariantCulture);
int result1 = DateTime.Compare(Today, TableDateIn);//guest
datein is less then old guest datein
int result2 = DateTime.Compare(Today, TableDateOut);//old guest
outdate is before then new guest checkin
if (result1 >= 0 && result2 < 0)//true when Date1 is greter then
{
DataRow NewDr = tempTable.NewRow();
NewDr["RoomNo"] = dt.Rows[i][0].ToString();
NewDr["CheckInDate"] = dt.Rows[i][1].ToString();
NewDr["CheckOutDate"] = dt.Rows[i][2].ToString();
NewDr["BookingId"] = dt.Rows[i][3].ToString();
NewDr["GuestId"] = dt.Rows[i][4].ToString();
tempTable.Rows.Add(NewDr);
tempTable.AcceptChanges();
ViewState["tempTable"] = tempTable;
IsPickedUpBookedRoomNo = true;
totalsRoom = totalsRoom + 1;
}
i = i + 1;
}
if (!IsPickedUpBookedRoomNo)
{
lblNo.Text = "";
lblNo.Text = row.ToString() + "---Room(s) Found...!!!";
GrdRooms.DataSource = null;
GrdRooms.DataBind();
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GRDBookedRoom.DataSource = dt;
GRDBookedRoom.DataBind();

}
else
{
lblNo.Text = "";
lblNo.Text = totalsRoom + "---Room(s) Found...!!!";
GrdRooms.DataSource = null;
GrdRooms.DataBind();
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GRDBookedRoom.DataSource = ViewState["tempTable"];
GRDBookedRoom.DataBind();
}
}
else
{
lblNo.Text = "";
lblNo.Text = "Report Not Found...!!!";
}
}
else
{
Boolean IsPickedUpBookedRoomNo = false;
string Formate = "dd/MM/yyyy";
string MyDate = DateTime.Now.ToString("dd/MM/yyyy");
DateTime Today = DateTime.ParseExact(MyDate, Formate,
CultureInfo.InvariantCulture);
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int row = ds.Tables[0].Rows.Count;
if (row != 0)
{
int i = 0;
DataTable tempTable = new DataTable();
tempTable.Columns.Add("RoomNo");
foreach (DataRow dr in dt.Rows)
{
string CheckInDate = dt.Rows[i][1].ToString();
DateTime TableDateIn = DateTime.ParseExact(CheckInDate,
Formate, CultureInfo.InvariantCulture);
string CheckOutDate = dt.Rows[i][2].ToString();
DateTime TableDateOut = DateTime.ParseExact(CheckOutDate,
Formate, CultureInfo.InvariantCulture);
int result1 = DateTime.Compare(Today, TableDateIn);//guest
datein is less then old guest datein
int result2 = DateTime.Compare(Today, TableDateOut);//old guest
outdate is before then new guest checkin

if (result1 > 0 && result2 <= 0)//true when Date1 is greter then
{
DataRow NewDr = tempTable.NewRow();
string SelectedRoomNo = dt.Rows[i][0].ToString();
NewDr["RoomNo"] = SelectedRoomNo;
tempTable.Rows.Add(NewDr);
tempTable.AcceptChanges();
ViewState["tempTable"] = tempTable;
IsPickedUpBookedRoomNo = true;
}
i = i + 1;
}
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from Room ",
SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "Room");
DataTable dt1 = ds1.Tables[0];
int row1 = ds1.Tables[0].Rows.Count;
if (row1 != 0)
{
if (!IsPickedUpBookedRoomNo)
{
lblNo.Text = "";
lblNo.Text = row1.ToString() + " Room(s) Available...!!!";
GRDBookedRoom.DataSource = null;
GRDBookedRoom.DataBind();
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GrdRooms.DataSource = dt1;
GrdRooms.DataBind();
}
else
{
DataTable tempdt = new DataTable(); // creating temp table to
store Booked Room no details
tempdt.Columns.Add("RoomNo");//adding culumns to temp
table
tempdt.Columns.Add("Type");
tempdt.Columns.Add("Capacity");
tempdt.Columns.Add("Rate");
tempdt.Columns.Add("Status");
tempdt.Columns.Add("Image");
int n = 0, l = 0;
Boolean IsMatchedBoothRoom = false;
foreach (DataRow dr2 in dt1.Rows)
{
int k = 0;
foreach (DataRow dr in tempTable.Rows)

{
string AvailableRoomNo = dt1.Rows[l][0].ToString();
string BookedRoomNo = tempTable.Rows[k][0].ToString();
if (AvailableRoomNo == BookedRoomNo) // finding all
booked room no from room table
{
IsMatchedBoothRoom = true;
}
k = k + 1;
}
if (!IsMatchedBoothRoom)
{
DataRow NewDR = tempdt.NewRow();
NewDR["RoomNo"] = dt1.Rows[n][0].ToString();
NewDR["Type"] = dt1.Rows[n][1].ToString();
NewDR["Capacity"] = dt1.Rows[n][2].ToString();
NewDR["Rate"] = dt1.Rows[n][3].ToString();
NewDR["Status"] = dt1.Rows[n][4].ToString();
NewDR["Image"] = dt1.Rows[n][5].ToString();
tempdt.Rows.Add(NewDR);
tempdt.AcceptChanges();
n = n + 1;
}
IsMatchedBoothRoom = false;
l = l + 1;
}
ViewState["tempdt"] = tempdt;
int TempTableData = tempdt.Rows.Count;
if (TempTableData != 0)
{
lblNo.Text = "";
lblNo.Text = n.ToString() + "---Room(s) Available...!!!";
GRDBookedRoom.DataSource = null;
GRDBookedRoom.DataBind();
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GrdRooms.DataSource = tempdt;
GrdRooms.DataBind();
}
else
{
lblNo.Text = "";
lblNo.Text = " Room Is Not Found...!!!";
}
}
}
}
}
}
break;

case "AC":
case "Non-AC":
case "General":
{
PathStringClass path1 = new PathStringClass(); // retriving room table
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from Room where
Type='" + RoomStaus + "' ", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, " Room");
DataTable dt1 = ds1.Tables[0];
int row1 = ds1.Tables[0].Rows.Count;
if (row1 != 0)
{
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GRDBookedRoom.DataSource = null;
GRDBookedRoom.DataBind();
GrdRooms.DataSource = ds1;
GrdRooms.DataBind();
lblNo.Text = "";
lblNo.Text = row1.ToString() + "---Room(s) Found...!!!";
}
else
{
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GRDBookedRoom.DataSource = null;
GRDBookedRoom.DataBind();
GrdRooms.DataSource = null;
GrdRooms.DataBind();
lblNo.Text = "";
lblNo.Text = "Room not found...!!!";
}
}
break;
default:
lblNo.Text = "";
lblNo.Text = "Report not found...!!!";
GRDBookedRoom.DataSource = null;
GRDBookedRoom.DataBind();
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GrdRooms.DataSource = null;
GrdRooms.DataBind();
break;
}
}
protected void BtnGuest_Click(object sender, EventArgs e)
{

Button btnBookedShow = (Button)sender;


GridViewRow row = (GridViewRow)btnBookedShow.Parent.Parent;
Label LblGuestId = (Label)row.FindControl("LblGuestId");
string Guestid = LblGuestId.Text;
PathStringClass path3 = new PathStringClass();
string DatabasePath3 = path3.Get_path();
SqlConnection SqlCon3 = new SqlConnection(DatabasePath3);
SqlDataAdapter Sqd3 = new SqlDataAdapter("select * from GuestDetails where
GuestId='" + Guestid + "' ", SqlCon3);
DataSet ds3 = new DataSet();
Sqd3.Fill(ds3, "GuestDetails");
DataTable dt3 = ds3.Tables[0];
int PayentRow = dt3.Rows.Count;
if (PayentRow != 0)
{
lblNo.Text = "";
GrdGuestDetails.DataSource = ds3;
GrdGuestDetails.DataBind();
}
}
protected void BtnCloseReport_Click(object sender, EventArgs e)
{
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GrdRooms.DataSource = null;
GrdRooms.DataBind();
GRDBookedRoom.DataSource = null;
GRDBookedRoom.DataBind();
lblNo.Text = "";
}
protected void CloseGuestDetails_Click(object sender, EventArgs e)
{
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
}
}
}
Roomupdate.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Admin
{
public partial class RoomUpdate : System.Web.UI.Page
{
string ImgPath;
Boolean Value = false;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] != null)
{
lblShowingName.Text = Session["AdminId"].ToString();
Session["AdminId"] = Session["AdminId"].ToString();
}
if (Session["RoomNo"] != null)
{
lblmessage0.Text = "Enter The Room Information To be Updated...!!!";
txtRoomNo.Text = Session["RoomNo"].ToString();
txtRoomNo.ReadOnly = true;
}
else
{
lblmessage0.Text = "First Select The Room No...!!!";
txtRoomNo.ReadOnly = true;
txtRoomNo.BackColor = System.Drawing.Color.Red;
btnUpdate.Enabled = false;
btncancel.Text = "Go To Select";
btncancel.ToolTip = "Go To Select The Room";
}
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
if (UploadImage.HasFile)
{
ImgPath = ImagePath();
if (ImgPath != null)
{
Update_This_Room(ImgPath);
Display_Added_Room();
}
}
else

{
lblmessage0.Text = "Please select Picture...!!!";
}
}
else
{
lblmessage0.Text = "Please check all given information";
}
}
private void Update_This_Room(string ImgPath)
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Room where
RoomNo='" + txtRoomNo.Text + "' ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Room");
DataTable dt = ds.Tables[0];
int Room = dt.Rows.Count;
if (Room != 0)
{
foreach (DataRow dr in dt.Rows)
{
dr[1] = ddlroomtype.Text;
dr[2] = ddlroomcapacity.Text;
dr[3] = txtrate.Text;
dr[4] = ddlroomstatus.Text;
dr[5] = ImgPath;
SqlCommandBuilder cd = new SqlCommandBuilder(Sqd);
Sqd.Update(dt);
}
lblmessage0.Text = "Room Is Updated...!!!";
btncancel.Text = "Go Back";
btncancel.ToolTip = "Go Back To Select Another Room";
}
else
{
lblmessage0.Text="An Error Is Orrured";
}
}
private string ImagePath()
{
Boolean FileOK = false;
int k = 0;
Session["WorkingImage"] = UploadImage.FileName;
String FileExtension =
Path.GetExtension(Session["WorkingImage"].ToString()).ToLower();
//renaming File

Random MyRandom = new Random();


string FilenameWithoutExtension =
Path.GetFileNameWithoutExtension(Session["WorkingImage"].ToString());
string fileNameIncreament = Convert.ToString(MyRandom.Next(10, 300000));
FilenameWithoutExtension = FilenameWithoutExtension + fileNameIncreament;
Session["ImageFileName"] = FilenameWithoutExtension + FileExtension;
String[] allowedExtensions = { ".png", ".jpeg", ".jpg", ".gif", ".htm" };
for (int i = 0; i < allowedExtensions.Length; i++)
{
k++;
if (FileExtension == allowedExtensions[i])
{
FileOK = true;
break;
}
}
if (FileOK)
{
try
{
string path = (Server.MapPath("../RoomImages")).ToString();
UploadImage.SaveAs(path + "/" + Session["ImageFileName"].ToString());
}
catch (Exception ex)
{
}
}
else
{
lblmessage0.Text = "Please Select Valid Image";
}
string dbfilePath;
string fileName = Path.GetFileName(Session["ImageFileName"].ToString());
dbfilePath = @"../RoomImages/" + fileName;
if (!FileOK)
{
dbfilePath = null;
}
return dbfilePath;
}
private void Display_Added_Room()
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd2 = new SqlDataAdapter("select * from Room where
RoomNo='" + txtRoomNo.Text + "'", SqlCon);
DataSet ds2 = new DataSet();
Sqd2.Fill(ds2, "Room");
DataTable dt2 = ds2.Tables[0];
int noofrow = dt2.Rows.Count;

if (noofrow != 0)
{
GrdRooms.DataSource = ds2;
GrdRooms.DataBind();
}
}
protected void btnselect_Click(object sender, EventArgs e)
{
Button imgbtn = (Button)sender;
GridViewRow row = (GridViewRow)imgbtn.Parent.Parent;
Label lblRoomNo = (Label)row.FindControl("lblRoomNo");
txtRoomNo.ReadOnly = false;
txtRoomNo.Text = lblRoomNo.Text;
txtRoomNo.ReadOnly = true;
lblmessage0.Text = "Again Enter Room Information...!!!";
GrdRooms.DataSource = null;
GrdRooms.DataBind();
lblmessage0.Text = "";
}
protected void btnDelete_Click(object sender, EventArgs e)
{
Button imgbtn = (Button)sender;
GridViewRow row = (GridViewRow)imgbtn.Parent.Parent;
Label lblRoomNo = (Label)row.FindControl("lblRoomNo");
Session["RoomNo"] = lblRoomNo.Text;
Session["BackToUpdate"] = "BackToUpdate";
Response.Redirect("~/Admin/DeleteSelectedRoom.aspx");
}
protected void btncancel_Click(object sender, EventArgs e)
{
Response.Redirect("~/Admin/UpdateRoom.aspx");
}
protected void CustomValidator1_ServerValidate(object source,
ServerValidateEventArgs args)
{
Boolean check;
int number;
check = int.TryParse(args.Value, out number);
args.IsValid = check;
}
protected void CustomValidator2_ServerValidate(object source,
ServerValidateEventArgs args)
{
Boolean check;

int number;
check = int.TryParse(args.Value, out number);
args.IsValid = check;
}

}
}
Rulemanagement.aspx.cs
ACAusing System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Admin
{
public partial class RuleManagement : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] != null)
{
lblShowingName.Text = Session["AdminId"].ToString();
Session["AdminId"] = Session["AdminId"].ToString();
}
UpdateThis.Enabled = false;
}
protected void BtnPublishedRules_Click(object sender, EventArgs e)
{
string today = DateTime.Now.ToString();
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Rules ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Rules");
DataTable dt = ds.Tables[0];
DataRow dr = dt.NewRow();

dr[0] = today;
dr[1] = txtRules.Text;
dt.Rows.Add(dr);
SqlCommandBuilder cd = new SqlCommandBuilder(Sqd);
Sqd.Update(dt);
LblMessge.Text = "Entered Rules has been added to the list...!!!";
//Display current added rule
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from Rules where
TodaysDate='" + today + "' ", SqlCon);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "Rules");
DataTable dt1 = ds1.Tables[0];
int row1 = dt1.Rows.Count;
if (row1 != 0)
{
GrdRueles.DataSource = ds1;
GrdRueles.DataBind();
}
txtRules.Text = "";
}
protected void BtnShowRules_Click(object sender, EventArgs e)
{
txtRules.Text = "";
show_allRulew();
}
private void show_allRulew()
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Rules ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Rules");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
GrdRueles.DataSource = ds;
GrdRueles.DataBind();
LblMessge.Text = "All the previous rules are displayed in the bellow...";
}
else
{

LblMessge.Text = "Rules are not found...!!!";


}
}
protected void Btnupdate_Click(object sender, EventArgs e)
{
BtnPublishedRules.Enabled = true;
Button BtnDelete = (Button)sender;
GridViewRow row = (GridViewRow)BtnDelete.Parent.Parent;
Label LblDate = (Label)row.FindControl("LblDate");
string date = LblDate.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Rules where
TodaysDate='" + date + "' ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Rules");
DataTable dt = ds.Tables[0];
int row1 = dt.Rows.Count;
if (row1 != 0)
{
txtRules.Text = dt.Rows[0][1].ToString();
}
UpdateThis.Enabled = true;
}
protected void BtnDelete_Click(object sender, EventArgs e)
{
Button BtnDelete = (Button)sender;
GridViewRow row = (GridViewRow)BtnDelete.Parent.Parent;
Label LblDate = (Label)row.FindControl("LblDate");
string date = LblDate.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Rules where
TodaysDate='"+date+"' ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Rules");
DataTable dt = ds.Tables[0];
int row1 = dt.Rows.Count;
if (row1 != 0)
{
foreach (DataRow dr in dt.Rows)
{
dr.Delete();
SqlCommandBuilder cb = new SqlCommandBuilder(Sqd);
Sqd.Update(dt);
LblMessge.Text = "Rule is successfully deleted...!!!";

break;
}
show_allRulew();
}

}
protected void UpdateThis_Click(object sender, EventArgs e)
{
string today = DateTime.Now.ToString();
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Rules ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Rules");
DataTable dt = ds.Tables[0];
dt.Rows[0][0] = today;
dt.Rows[0][1] = txtRules.Text;
SqlCommandBuilder cd = new SqlCommandBuilder(Sqd);
Sqd.Update(dt);
LblMessge.Text = "Entered Rules has been Updated to the list...!!!";
}
protected void btncancel_Click(object sender, EventArgs e)
{
Response.Redirect("~/Admin/Default.aspx");
}

}
}
UpdateReceptionistDetails.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;

namespace HotelManagementSystem.Admin
{
public partial class UpdateReceptionistDetails : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] != null)
{
lblShowingName.Text = Session["AdminId"].ToString();
Session["AdminId"] = Session["AdminId"].ToString();
}

}
protected void btnShow_Click(object sender, EventArgs e)
{
string Role = DDlPost.SelectedItem.ToString();
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from ReceptionistDetails
where Post='" + Role + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "ReceptionistDetails");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
GrdGuestDetails.DataSource = ds;
GrdGuestDetails.DataBind();
}
else
{
lblmessage.Text = "Receptionist not found";
}
}
protected void BtnSelect_Click(object sender, EventArgs e)
{
Button BtnSelect = (Button)sender;
GridViewRow row = (GridViewRow)BtnSelect.Parent.Parent;
Label lbluserid = (Label)row.FindControl("lbluserid");
Session["ReceptionistId"] = lbluserid.Text;
Response.Redirect("~/Admin/ReceptionistUpdation.aspx");
}
protected void btnShowAll_Click(object sender, EventArgs e)
{

lblmessage.Text = "";
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from ReceptionistDetails",
SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "ReceptionistDetails");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
GrdGuestDetails.DataSource = ds;
GrdGuestDetails.DataBind();
}
else
{
lblmessage.Text = "Receptionist not found";
}
}
}
}
Updateroom.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Admin
{
public partial class UpdateRoom : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AdminId"] != null)
{
lblShowingName.Text = Session["AdminId"].ToString();
Session["AdminId"] = Session["AdminId"].ToString();
}
lblmessage0.Text = "";
}

protected void btnUpdate_Click(object sender, EventArgs e)


{
Button imgbtn = (Button)sender;
GridViewRow row = (GridViewRow)imgbtn.Parent.Parent;
Label lblRoomNo = (Label)row.FindControl("lblRoomNo");
Session["RoomNo"] = lblRoomNo.Text;
Response.Redirect("~/Admin/RoomUpdate.aspx");

}
protected void ShowAllRooms_Click(object sender, EventArgs e)
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Room ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Room");
DataTable dt = ds.Tables[0];
int Room = dt.Rows.Count;
if (Room != 0)
{
GrdRooms.DataSource = ds;
GrdRooms.DataBind();
}
else
{
lblmessage0.Text = "Not Available Room";
}
}
protected void BtnGoToUpdate_Click1(object sender, EventArgs e)
{
if (txtroomno.Text =="")
{
lblmessage0.Text = "Enter The Roo No...!!!";
}
else
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Room where
RoomNo='"+ txtroomno.Text+"'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Room");
DataTable dt = ds.Tables[0];
int Room = dt.Rows.Count;

if (Room != 0)
{
Session["RoomNo"] = txtroomno.Text;
Server.Transfer("~/Admin/RoomUpdate.aspx");
}
else
{
lblmessage0.Text = "Room No Is Not Exist...!!!";
}

}
}
}
}
Availableroom.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;

namespace HotelManagementSystem.Guest
{
public partial class AvailableRooms : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["GuestId"] != null && Session["GuestName"]!=null)
{
Session["GuestName"] = Session["GuestName"].ToString();
Session["GuestId"] = Session["GuestId"].ToString();
lblShowingName.Text = "Hi... " + Session["GuestName"].ToString()+", "+ "
User-Id:- " + Session["GuestId"].ToString();
}
if (Session["CheckInDate"] != null && Session["CheckOutDate"] != null)
{
Session["CheckInDate"] = Session["CheckInDate"].ToString();
Session["CheckOutDate"] = Session["CheckOutDate"].ToString();
}

if (Session["Message"] != null)
{
lblmessage.Text = Session["Message"].ToString();
}
if (!IsPostBack && Session["AvailableRooms"] != null)
{
DataTable dt = (DataTable)Session["AvailableRooms"];
GrdRooms.DataSource = dt;
GrdRooms.DataBind();
}

}
protected void BtnShow_Click(object sender, EventArgs e)
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Room ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Room");
DataTable dt = ds.Tables[0];
int Room = dt.Rows.Count;
if (Room != 0)
{
GrdRooms.DataSource = ds;
GrdRooms.DataBind();
}
else
{
lblmessage.Text = "Not Available Room";
}
}
protected void btnregister_Click(object sender, EventArgs e)
{
Response.Redirect("../Default.aspx");
}
protected void btnselect_Click(object sender, EventArgs e)
{
Button btnselect = (Button)sender;
GridViewRow row = (GridViewRow)btnselect.Parent.Parent;
Label lblRoomNo = (Label)row.FindControl("lblRoomNo");
Session["CheckInDate"] = Session["CheckInDate"].ToString();
Session["CheckOutDate"] = Session["CheckOutDate"].ToString();
Session["SelectedRoomNo"] = lblRoomNo.Text;
Response.Redirect("~/Guest/SelelectedRoom.aspx");
}

}
}
Bookingcancelation.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Guest
{
public partial class BookingCancelation : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["GuestId"] != null && Session["GuestName"] != null)
{
Session["GuestName"] = Session["GuestName"].ToString();
Session["GuestId"] = Session["GuestId"].ToString();
lblShowingName.Text = "Hi... " + Session["GuestName"].ToString() + ", " +"
User-Id:- " + Session["GuestId"].ToString();
}
if (Session["BookingId"] != null && !IsPostBack )
{
string BookingId = Session["BookingId"].ToString();
txtId.Text = BookingId;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from BookedRooms where
BookingId ='" + BookingId + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
lblmessage.Text = "";
GrdAvailableRooms.DataSource = ds;
GrdAvailableRooms.DataBind();
GrdGuestDetails.DataSource = null;

GrdGuestDetails.DataBind();
GrdSelectedBookedRoom.DataSource = null;
GrdSelectedBookedRoom.DataBind();
GrdFoundGuest.DataSource = null;
GrdFoundGuest.DataBind();
}
else
{
lblmessage.Text = "Booked Room Not Found. Please Try Another...!!!";
}
}
}
protected void BtnFind_Click(object sender, EventArgs e)
{
string id = ddlId.SelectedItem.ToString();
switch (id)
{
case "Guest-Id":
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from BookedRooms
where GuestId ='" + txtId.Text + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
lblmessage.Text = "";
GrdAvailableRooms.DataSource = ds;
GrdAvailableRooms.DataBind();
GrdFoundGuest.DataSource = null;
GrdFoundGuest.DataBind();
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GrdSelectedBookedRoom.DataSource = null;
GrdSelectedBookedRoom.DataBind();
}
else
{
lblmessage.Text = "Booked Room Not Found. Please Try Another...!!!";
}
}
break;
case "Booking-Id":
{

PathStringClass path = new PathStringClass();


string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from BookedRooms
where BookingId ='" + txtId.Text + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
lblmessage.Text = "";
GrdAvailableRooms.DataSource = ds;
GrdAvailableRooms.DataBind();
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GrdSelectedBookedRoom.DataSource = null;
GrdSelectedBookedRoom.DataBind();
GrdFoundGuest.DataSource = null;
GrdFoundGuest.DataBind();
}
else
{
lblmessage.Text = "Booked Room Not Found. Please Try Another...!!!";
}
}
break;
case "Name":
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from GuestDetails
where Name like '%" + txtId.Text + "%'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "GuestDetails");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
lblmessage.Text = "";
GrdFoundGuest.DataSource = ds;
GrdFoundGuest.DataBind();
GrdAvailableRooms.DataSource = null;
GrdAvailableRooms.DataBind();
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GrdSelectedBookedRoom.DataSource = null;

GrdSelectedBookedRoom.DataBind();
}
else
{
lblmessage.Text = "Booked Room Not Found. Please Try Another...!!!";
}

}
break;
}
}
protected void BtnFindGuestDetails_Click(object sender, EventArgs e)
{
Button BtnFindGuestDetails = (Button)sender;
GridViewRow row = (GridViewRow)BtnFindGuestDetails.Parent.Parent;
Label LblUserId = (Label)row.FindControl("LblUserId");
string GuestId = LblUserId.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from GuestDetails where
GuestId ='" + GuestId + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "GuestDetails");
DataTable dt = ds.Tables[0];
int row1 = dt.Rows.Count;
if (row1 != 0)
{
lblmessage.Text = "";
GrdGuestDetails.DataSource = ds;
GrdGuestDetails.DataBind();
}
else
{
lblmessage.Text = "Not Found...!!!";
}
}
protected void BtnSelect_Click(object sender, EventArgs e)
{
Button BtnFindGuestDetails = (Button)sender;
GridViewRow row = (GridViewRow)BtnFindGuestDetails.Parent.Parent;
Label LblBookingId = (Label)row.FindControl("LblBookingId");
string BookingId = LblBookingId.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();

SqlConnection SqlCon = new SqlConnection(DatabasePath);


SqlDataAdapter Sqd = new SqlDataAdapter("select * from BookedRooms where
BookingId ='" + BookingId + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "BookedRooms");
DataTable dt = ds.Tables[0];
int row1 = dt.Rows.Count;
if (row1 != 0)
{
lblmessage.Text = "";
GrdSelectedBookedRoom.DataSource = ds;
GrdSelectedBookedRoom.DataBind();
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GrdAvailableRooms.DataSource = null;
GrdAvailableRooms.DataBind();
}
else
{
lblmessage.Text = "Room Could Not Selected. Please Try Again...!!!";
}
}
protected void BtnDelete_Click(object sender, EventArgs e)
{
Button BtnFindGuestDetails = (Button)sender;
GridViewRow row = (GridViewRow)BtnFindGuestDetails.Parent.Parent;
Label lblBookingId = (Label)row.FindControl("lblBookingId");
string BookingId = lblBookingId.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from BookedRooms where
BookingId ='" + BookingId + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "BookedRooms");
DataTable dt = ds.Tables[0];
int row1 = dt.Rows.Count;
if (row1 != 0)
{
foreach (DataRow dr in dt.Rows)
{
dr.Delete();
SqlCommandBuilder cd = new SqlCommandBuilder(Sqd);
Sqd.Update(dt);
break;
}
}
else
{

lblmessage.Text = "Cancelation Failured, Please try Again...!!!";


}
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from PaymentDetails
where BookingId ='" + BookingId + "'", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "BookedRooms");
DataTable dt1 = ds1.Tables[0];
int row2 = dt1.Rows.Count;
if (row2 != 0)
{
foreach (DataRow dr1 in dt.Rows)
{
dr1.Delete();
SqlCommandBuilder cd1 = new SqlCommandBuilder(Sqd1);
Sqd.Update(dt1);
break;
}
}
else
{
PathStringClass path11 = new PathStringClass();
string DatabasePath11 = path11.Get_path();
SqlConnection SqlCon11 = new SqlConnection(DatabasePath11);
SqlDataAdapter Sqd11 = new SqlDataAdapter("select * from PaymentDetails
where BookingId ='" + BookingId + "'", SqlCon11);
DataSet ds11 = new DataSet();
Sqd11.Fill(ds11, "BookedRooms");
DataTable dt11 = ds11.Tables[0];
int row21 = dt11.Rows.Count;
if (row21 != 0)
{
foreach (DataRow dr11 in dt.Rows)
{
dr11.Delete();
SqlCommandBuilder cd11 = new SqlCommandBuilder(Sqd11);
Sqd.Update(dt11);
break;
}
}
}
lblmessage.Text = "Your Booking Has Been Canceled successfully!!!";
}
protected void BtnClose_Click(object sender, EventArgs e)

{
lblmessage.Text = "";
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
}
protected void BtnSelectGuest_Click(object sender, EventArgs e)
{
Button BtnSelectGuest = (Button)sender;
GridViewRow row = (GridViewRow)BtnSelectGuest.Parent.Parent;
Label lbluserid = (Label)row.FindControl("lbluserid");
Label LblMessageOfBooking = (Label)row.FindControl("LblMessageOfBooking");
string GuestId = lbluserid.Text;

PathStringClass path = new PathStringClass();


string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from BookedRooms where
GuestId ='" + GuestId + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "BookedRooms");
DataTable dt = ds.Tables[0];
int row22 = dt.Rows.Count;
if (row22 != 0)
{
lblmessage.Text = "";
GrdAvailableRooms.DataSource = ds; ;
GrdAvailableRooms.DataBind();
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GrdSelectedBookedRoom.DataSource = null;
GrdSelectedBookedRoom.DataBind();
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from GuestDetails where
GuestId ='" + GuestId + "'", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "BookedRooms");
DataTable dt1 = ds1.Tables[0];
int row1 = dt1.Rows.Count;
if (row1 != 0)
{
lblmessage.Text = "";
GrdFoundGuest.DataSource = null;
GrdFoundGuest.DataBind();

GrdGuestDetails.DataSource = ds1;
GrdGuestDetails.DataBind();
GrdSelectedBookedRoom.DataSource = null;
GrdSelectedBookedRoom.DataBind();
}
}
else
{
LblMessageOfBooking.Text = "Booked Room Not Found With This User-Id....!!!";
}
}
protected void BtnSelectGuestClose_Click(object sender, EventArgs e)
{
GrdFoundGuest.DataSource = null;
GrdFoundGuest.DataBind();
}
}
}
Bookinginformation.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Guest
{
public partial class BookingInformation : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["GuestId"] != null && Session["GuestName"] != null)
{
Session["GuestName"] = Session["GuestName"].ToString();
Session["GuestId"] = Session["GuestId"].ToString();
lblShowingName.Text = "Hi... " + Session["GuestName"].ToString() + ", " + "
User-Id:- " + Session["GuestId"].ToString();
}
if (!IsPostBack)
{

if (Session["BookingId"] != null)
{
string BookingId = Session["BookingId"].ToString();
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from PaymentDetails
where BookingId='"+BookingId +"'", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "PaymentDetails");
DataTable dt1 = ds1.Tables[0];
int row = dt1.Rows.Count;
if (row != 0)
{
GRDPaymentDetails.DataSource = ds1;
GRDPaymentDetails.DataBind();
}
}
}
}
protected void btnBookedRoom_Click(object sender, EventArgs e)
{
Button btnRoomDetailsShow = (Button)sender;
GridViewRow row = (GridViewRow)btnRoomDetailsShow.Parent.Parent;
Label lblBookingId = (Label)row.FindControl("lblBookingId");
string Bookingid = lblBookingId.Text;

PathStringClass path4 = new PathStringClass();


string DatabasePath4 = path4.Get_path();
SqlConnection SqlCon4 = new SqlConnection(DatabasePath4);
SqlDataAdapter Sqd4 = new SqlDataAdapter("select * from BookedRooms where
BookingId='" + Bookingid + "'", SqlCon4);
DataSet ds4 = new DataSet();
Sqd4.Fill(ds4, "BookedRooms");
DataTable dt4 = ds4.Tables[0];
int rowno = dt4.Rows.Count;
if (rowno != 0)
{
GRDBookedRoom.DataSource=ds4;
GRDBookedRoom.DataBind();
}
}

protected void BtnGuest_Click(object sender, EventArgs e)


{
Button btnBookedShow= (Button)sender;
GridViewRow row = (GridViewRow)btnBookedShow.Parent.Parent;
Label LblGuestId= (Label)row.FindControl("LblGuestId");
string Guestid=LblGuestId.Text;
PathStringClass path3 = new PathStringClass();
string DatabasePath3 = path3.Get_path();
SqlConnection SqlCon3 = new SqlConnection(DatabasePath3);
SqlDataAdapter Sqd3 = new SqlDataAdapter("select * from GuestDetails where
GuestId='"+Guestid+"' ",SqlCon3 );
DataSet ds3 = new DataSet();
Sqd3.Fill(ds3, "GuestDetails");
DataTable dt3 = ds3.Tables[0];
int PayentRow = dt3.Rows.Count;
if (PayentRow != 0)
{
GrdGuestDetails.DataSource = ds3;
GrdGuestDetails.DataBind();
}
}
protected void btnCloseGuest_Click(object sender, EventArgs e)
{
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
}
protected void BtnClose_Click(object sender, EventArgs e)
{
GRDBookedRoom.DataSource = null;
GRDBookedRoom.DataBind();
}
protected void Payment_Click(object sender, EventArgs e)
{
Session["UserId"] = Session["UserId"].ToString();
Response.Redirect("~/Guest/Default.aspx");
}
protected void btnok_Click(object sender, EventArgs e)
{
Response.Redirect("~/Guest/Default.aspx");
}
}
}
Bookingstatus.aspx.cs
using System;
using System.Collections;

using
using
using
using
using
using
using
using
using
using
using
using

System.Configuration;
System.Data;
System.Linq;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.HtmlControls;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Xml.Linq;
System.Data.SqlClient;
System.IO;

namespace HotelManagementSystem.Guest
{
public partial class BookingStatus : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["GuestId"] != null && Session["GuestName"] != null)
{
Session["GuestName"] = Session["GuestName"].ToString();
Session["GuestId"] = Session["GuestId"].ToString();
lblShowingName.Text = "Hi... " + Session["GuestName"].ToString() + ", " + "
User-Id:- " + Session["GuestId"].ToString();

}
if (!IsPostBack)
{
Boolean DataLoaded = false;
string GuestId = Session["GuestId"].ToString();
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from PaymentDetails
where GuestId='" + GuestId + "'", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "PaymentDetails");
DataTable dt1 = ds1.Tables[0];
int row1 = dt1.Rows.Count;
if (row1 != 0)
{
GrdConfimedBookInfo.DataSource = ds1;
GrdConfimedBookInfo.DataBind();
DataLoaded = true;
}
PathStringClass path = new PathStringClass();

string DatabasePath = path.Get_path();


SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from TempBookedRooms
where GuestId='" + GuestId + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "TempBookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
LblMessge.Text = "Please clear your payment of displayed bellow room(s) to
confirm your Booking...!!!";
GrdTempPaymentDetails.DataSource = ds;
GrdTempPaymentDetails.DataBind();
DataLoaded = true;
}
if (!DataLoaded)
{
lblmessage.Text = "You have not Booked Room....!!!";
}
}
}
protected void BtnOk_Click(object sender, EventArgs e)
{
GrdTempPaymentDetails.DataSource = null;
GrdTempPaymentDetails.DataBind();
GrdConfimedBookInfo.DataSource = null;
GrdConfimedBookInfo.DataBind();
lblmessage.Text = "";
LblMessge.Text = "";
}
protected void BtnPay_Click(object sender, EventArgs e)
{
Button BtnPay = (Button)sender;
GridViewRow row = (GridViewRow)BtnPay.Parent.Parent;
Label LblPaymentId = (Label)row.FindControl("LblPaymentId");
Session["PaymentId"] = LblPaymentId.Text;
Response.Redirect("~/Guest/MakePayment.aspx");
}
protected void BtnCancelBooking_Click(object sender, EventArgs e)
{
Button BtnCancelBooking = (Button)sender;
GridViewRow row = (GridViewRow)BtnCancelBooking.Parent.Parent;
Label LblBookingId = (Label)row.FindControl("LblBookingId");
Session["BookingId"] = LblBookingId.Text;
Response.Redirect("~/Guest/BookingCancelation.aspx");
}

protected void BtnPrint_Click(object sender, EventArgs e)


{
lblmessage.Text = "Please Collect the Booking Information for further use...!!!";
}
}
}
Cancelpayment.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Guest
{
public partial class CancelPayment : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["GuestId"] != null && Session["GuestName"] != null)
{
Session["GuestName"] = Session["GuestName"].ToString();
Session["GuestId"] = Session["GuestId"].ToString();
lblShowingName.Text = "Hi... " + Session["GuestName"].ToString() + ", " + "
User-Id:- " + Session["GuestId"].ToString();
}
if (!IsPostBack)
{
string GuestId = Session["GuestName"].ToString();
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from TempBookedRooms
where GuestId='" + GuestId + "' ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "TempBookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
GrdTempPaymentDetails.DataSource = ds;
GrdTempPaymentDetails.DataBind();

lblmessage.Text = "Your Temporary payment daetails displayed in bellow..";


}
else
{
lblmessage.Text = "Your Temporary Payment information is not faound...";
}
}
}
protected void btnMakePayment_Click(object sender, EventArgs e)
{
Button btnMakePayment = (Button)sender;
GridViewRow row = (GridViewRow)btnMakePayment.Parent.Parent;
Label lblRoomNo = (Label)row.FindControl("lblRoomNo");
Label lblCheckInDate = (Label)row.FindControl("lblCheckInDate");
Label LblCheckOutDate = (Label)row.FindControl("LblCheckOutDate");
Label LblRate = (Label)row.FindControl("LblRate");
if (Session["GuestName"] != null)
{
string Guestid = Session["GuestName"].ToString();
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from GuestDetails where
GuestId='" + Guestid + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "GuestDetails");
DataTable dt = ds.Tables[0];
int Room = dt.Rows.Count;
if (Room != 0)
{
string Name = dt.Rows[0][0].ToString();
Session["Name"] = Name;
}
Session["Amount"] = LblRate.Text;
Session["GuestName"] = Session["GuestName"].ToString();
Session["Amount"] = LblRate.Text;
Session["CheckInDate"] = lblCheckInDate.Text;
Session["CheckOutDate"] = LblCheckOutDate.Text;
Session["SelectedRoomNo"] = lblRoomNo.Text;
Response.Redirect("~/Guest/MakePayment.aspx");
}
}
protected void btnMakePaymentLetter_Click(object sender, EventArgs e)
{
Button btnMakePayment = (Button)sender;
BtnPrint.Enabled = true;
btnMakePayment.Enabled = false;

Button btnMakePaymentLetter = (Button)sender;


GridViewRow row = (GridViewRow)btnMakePaymentLetter.Parent.Parent;
Label lblRoomNo = (Label)row.FindControl("lblRoomNo");
Label lblCheckInDate = (Label)row.FindControl("lblCheckInDate");
Label LblCheckOutDate = (Label)row.FindControl("LblCheckOutDate");
Label LblRate = (Label)row.FindControl("LblRate");
Random MyRandom = new Random();
string TempBookingId = Convert.ToString(MyRandom.Next(10, 3000));

PathStringClass path1 = new PathStringClass();


string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from TempBookedRooms",
SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "TempBookedRooms");
DataTable dt1 = ds1.Tables[0];
DataRow dr1 = dt1.NewRow();
dr1[0]
dr1[1]
dr1[2]
dr1[3]
dr1[4]
dr1[5]
dr1[6]

=
=
=
=
=
=
=

TempBookingId;
Session["GuestId"].ToString();
Session["GuestName"].ToString();
lblRoomNo.Text;
lblCheckInDate.Text;
LblCheckOutDate.Text;
LblRate.Text;

dt1.Rows.Add(dr1);
SqlCommandBuilder cd = new SqlCommandBuilder(Sqd1);
Sqd1.Update(dt1);
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from TempBookedRooms
where TempBookingId='" + TempBookingId + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "TempBookedRooms");
DataTable dt = ds.Tables[0];
int Mydata = dt.Rows.Count;
if (Mydata != 0)
{
GrdTempPaymentDetails.DataSource = ds;
GrdTempPaymentDetails.DataBind();
lblmessage.Text = "Please Print your Temprary Booking information for further
use...!!!";
}

}
protected void BtnPrint_Click(object sender, EventArgs e)
{
lblmessage.Text = "Please save your temporary payment information for further
use";
}
protected void BtnOk_Click(object sender, EventArgs e)
{
Response.Redirect("~/Guest/Default.aspx");
}
protected void BtnPay_Click(object sender, EventArgs e)
{
Button BtnPay = (Button)sender;
GridViewRow row = (GridViewRow)BtnPay.Parent.Parent;
Label LblPaymentId = (Label)row.FindControl("LblPaymentId");
Label LblGuestId = (Label)row.FindControl("LblGuestId");
Label LblName = (Label)row.FindControl("LblName");
Label LblRoomNo = (Label)row.FindControl("LblRoomNo");
Label lblCheckInDate = (Label)row.FindControl("lblCheckInDate");
Label LblCheckOutDate = (Label)row.FindControl("LblCheckOutDate");
Label LblAmount = (Label)row.FindControl("LblAmount");
Session["PaymentId"] = LblPaymentId.Text;
Session["GuestId"] = LblGuestId.Text;
Session["Amount"] = LblAmount.Text;
Session["GuestName"] = LblName.Text;
Session["CheckInDate"] = lblCheckInDate.Text;
Session["CheckOutDate"] = LblCheckOutDate.Text;
Session["SelectedRoomNo"] = LblRoomNo.Text;
Response.Redirect("~/Guest/MakePayment.aspx");
}
protected void btnCancel_Click(object sender, EventArgs e)
{
Response.Redirect("~/Guest/Default.aspx");
}
}
}
Customerhome.masteraspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace HotelManagementSystem.Customer
{
public partial class CustomerHome : System.Web.UI.MasterPage

{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["GuestId"] == null && Session["GuestName"] == null)
{
Response.Redirect("../Account/GuestLogin.aspx");
}
}
}
}
Default.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
using System.Globalization;
namespace HotelManagementSystem.Customer
{
public partial class CustomerHome1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["GuestId"] != null && Session["GuestName"] != null)
{
Session["GuestName"] = Session["GuestName"].ToString();
Session["GuestId"] = Session["GuestId"].ToString();
lblShowingName.Text = "Hi... " + Session["GuestName"].ToString() + ", " + "
User-Id:- " + Session["GuestId"].ToString();
}
}
protected void btnCheck_Click(object sender, EventArgs e)
{
DataTable tempTable = new DataTable();
tempTable.Columns.Add("RoomNo");
Boolean IsPickedUpBookedRoomNo = false, Taken = false;
string indate = ddldd.Text + "/" + ddlmm.Text + "/" + ddlyyyy.Text;
string outdate = ddlddout.Text + "/" + ddlmmout.Text + "/" + ddlyyyyout.Text;
string Formate = "dd/MM/yyyy";

DateTime GuestDateIn = DateTime.ParseExact(indate, Formate,


CultureInfo.InvariantCulture);
DateTime GuestDateOut = DateTime.ParseExact(outdate, Formate,
CultureInfo.InvariantCulture);
int CheckDate = DateTime.Compare(GuestDateOut, GuestDateIn);
if (CheckDate >= 0)
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from BookedRooms ",
SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int row = ds.Tables[0].Rows.Count;
if (row != 0)
{
int i = 0;
foreach (DataRow dr in dt.Rows)
{
string CheckInDate = dt.Rows[i][1].ToString();
DateTime TableDateIn = DateTime.ParseExact(CheckInDate, Formate,
CultureInfo.InvariantCulture);
string CheckOutDate = dt.Rows[i][2].ToString();
DateTime TableDateOut = DateTime.ParseExact(CheckOutDate, Formate,
CultureInfo.InvariantCulture);

int result1 = DateTime.Compare(GuestDateIn, TableDateIn);//guest datein


is less then old guest datein
int result2 = DateTime.Compare(GuestDateOut, TableDateOut);//old guest
outdate is before then new guest checkin
int result3 = DateTime.Compare(GuestDateIn, TableDateOut);
int result4 = DateTime.Compare(GuestDateOut, TableDateIn);
if (result1 <= 0 && result2 >= 0)//true when Date1 is greter then
{
DataRow NewDr = tempTable.NewRow();
string SelectedRoomNo = dt.Rows[i][0].ToString();
NewDr["RoomNo"] = SelectedRoomNo;
tempTable.Rows.Add(NewDr);
tempTable.AcceptChanges();
IsPickedUpBookedRoomNo = true;
Taken = true;

}
if (result1 >= 0 && result2 <= 0 && !Taken)
{
DataRow NewDr = tempTable.NewRow();
NewDr["RoomNo"] = dt.Rows[i][0].ToString();
tempTable.Rows.Add(NewDr);
tempTable.AcceptChanges();
IsPickedUpBookedRoomNo = true;
Taken = true;

}
if (result1 > 1 && result3 > 0 && !Taken)
{
DataRow NewDr = tempTable.NewRow();
NewDr["RoomNo"] = dt.Rows[i][0].ToString();
tempTable.Rows.Add(NewDr);
tempTable.AcceptChanges();
IsPickedUpBookedRoomNo = true;
Taken = true;

}
if (result1 > 0 && result4 < 0 && !Taken)
{
DataRow NewDr = tempTable.NewRow();
NewDr["RoomNo"] = dt.Rows[i][0].ToString();
tempTable.Rows.Add(NewDr);
tempTable.AcceptChanges();
IsPickedUpBookedRoomNo = true;
Taken = true;

}
Taken = false;
i = i + 1;
}
}
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from Room ", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "Room");
DataTable dt1 = ds1.Tables[0];
int row1 = ds1.Tables[0].Rows.Count;
if (row1 != 0)
{

if (!IsPickedUpBookedRoomNo)
{
Session["AvailableRooms"] = dt1;
}
else
{
DataTable tempdt = new DataTable(); // creating temp table to store
Booked Room no details
tempdt.Columns.Add("RoomNo");//adding culumns to temp table
tempdt.Columns.Add("Type");
tempdt.Columns.Add("Capacity");
tempdt.Columns.Add("Rate");
tempdt.Columns.Add("Status");
tempdt.Columns.Add("Image");
int n = 0, l = 0;
Boolean IsMatchedBoothRoom = false;
foreach (DataRow dr2 in dt1.Rows)
{
int k = 0;
foreach (DataRow dr in tempTable.Rows)
{
string AvailableRoomNo = dt1.Rows[l][0].ToString();
string BookedRoomNo = tempTable.Rows[k][0].ToString();
if (AvailableRoomNo == BookedRoomNo) // finding all booked room
no from room table
{
IsMatchedBoothRoom = true;
}
k = k + 1;
}
if (!IsMatchedBoothRoom)
{
DataRow NewDR = tempdt.NewRow();
NewDR["RoomNo"] = dt1.Rows[n][0].ToString();
NewDR["Type"] = dt1.Rows[n][1].ToString();
NewDR["Capacity"] = dt1.Rows[n][2].ToString();
NewDR["Rate"] = dt1.Rows[n][3].ToString();
NewDR["Status"] = dt1.Rows[n][4].ToString();
NewDR["Image"] = dt1.Rows[n][5].ToString();
tempdt.Rows.Add(NewDR);
tempdt.AcceptChanges();
n = n + 1;
}
IsMatchedBoothRoom = false;
l = l + 1;
}
ViewState["tempdt"] = tempdt;

int TempTableData = tempdt.Rows.Count;


if (TempTableData != 0)
{
Session["AvailableRooms"] = tempdt;
}
else
{
Session["Message"] = "Room Is Not Available For you Between The
Given Date...!!!";
}
}
Session["CheckInDate"] = indate;
Session["CheckOutDate"] = outdate;
Response.Redirect("~/Guest/AvailableRooms.aspx");
}
}
else
{
LblMessge.Text = "Please Check Input Dates...!!!";
}
}
}
}
Feedback.aspx.cs
Gallery.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace HotelManagementSystem.Guest
{
public partial class Gallery : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["GuestId"] != null && Session["GuestName"] != null)
{
Session["GuestName"] = Session["GuestName"].ToString();
Session["GuestId"] = Session["GuestId"].ToString();
lblShowingName.Text = "Hi... " + Session["GuestName"].ToString() + ", " + "
User-Id:- " + Session["GuestId"].ToString();
}
}
}
}
Logout.aspx.cs
using System;

using
using
using
using
using

System.Collections.Generic;
System.Linq;
System.Web;
System.Web.UI;
System.Web.UI.WebControls;

namespace HotelManagementSystem.Guest
{
public partial class LogOut : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Session.Abandon();
Session.Clear();
Response.Redirect("../Account/GuestLogin.aspx");
}
}
}
Makepayment.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;

namespace HotelManagementSystem.Customer
{
public partial class MakePayment : System.Web.UI.Page
{
public void Page_Load(object sender, EventArgs e)
{
if (Session["GuestId"] != null && Session["GuestName"] != null)
{
Session["GuestName"] = Session["GuestName"].ToString();
Session["GuestId"] = Session["GuestId"].ToString();
lblShowingName.Text = "Hi... " + Session["GuestName"].ToString() + ", " + "
User-Id:- " + Session["GuestId"].ToString();
}
//Loading session value to the payment page
if (Session["SelectedRoomNo"] != null)
{

txtname.Text = Session["GuestName"].ToString();
if (Session["GuestId"] != null)
{
txtguestid.Text = Session["GuestId"].ToString();
}
else
{
txtguestid.Text = Session["GuestName"].ToString();
}
txtamount.Text = Session["Amount"].ToString();
txtInDate.Text = Session["CheckInDate"].ToString();
txtOutDate.Text = Session["CheckOutDate"].ToString();
txtRoomNo.Text = Session["SelectedRoomNo"].ToString();
txtguestid.ReadOnly = true;
txtInDate.ReadOnly = true;
txtOutDate.ReadOnly = true;
txtRoomNo.ReadOnly = true;
txtname.ReadOnly = true;
txtamount.ReadOnly = true;
}
if (Session["PaymentId"] != null)
{
//Loading session value to the payment information page from temp booking
string PamentId = Session["PaymentId"].ToString();
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from TempBookedRooms
where TempBookingId='" + PamentId + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "TempBookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
txtguestid.Text = dt.Rows[0][1].ToString();
txtname.Text=dt.Rows[0][2].ToString ();
txtRoomNo .Text=dt.Rows[0][3].ToString ();
txtInDate .Text =dt.Rows [0][4].ToString ();
txtOutDate.Text =dt.Rows[0][5].ToString ();
txtamount.Text =dt.Rows [0][6].ToString ();
txtguestid.ReadOnly = true;
txtInDate.ReadOnly = true;
txtOutDate.ReadOnly = true;
txtRoomNo.ReadOnly = true;
txtname.ReadOnly = true;
txtamount.ReadOnly = true;
}
}
}

protected void ddlpaymentmode_SelectedIndexChanged(object sender, EventArgs


e)
{
if (ddlpaymentmode.SelectedItem.ToString() == "Using Net Banking")
{
ddlCardType.Enabled = false;
txtCardNo.Enabled = false;
ddlmm.Enabled = false;
ddlyyyy.Enabled = false;
TxtsecurityCode.Enabled = false;
}
if (ddlpaymentmode.SelectedItem.ToString() == "Using Credit Card")
{
ddlCardType.Enabled = true;
txtCardNo.Enabled = true;
ddlmm.Enabled = true;
ddlyyyy.Enabled = true;
TxtsecurityCode.Enabled = true;
}
}
protected void Payment_Click(object sender, EventArgs e)
{
Random MyRandom = new Random();
string BookingId = Convert.ToString(MyRandom.Next(10, 3000));
string Today=System.DateTime.Now.ToString("dd/MM/yyyy");
//Storing Payment details
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from PaymentDetails",
SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "PaymentDetails");
DataTable dt1 = ds1.Tables[0];
DataRow dr1 = dt1.NewRow();
if (ddlpaymentmode.SelectedItem.ToString() == "Using Credit Card")
{
dr1[0] = txtguestid.Text;
dr1[1] = txtname.Text;
dr1[2] = txtRoomNo.Text;
dr1[3] = txtInDate.Text;
dr1[4] = txtOutDate.Text;
dr1[5] = txtamount.Text ;
dr1[6] = ddlpaymentmode.Text;
dr1[7] = ddlCardType.Text;
dr1[8] = txtCardNo.Text;
dr1[9] = ddlmm.Text + ddlyyyy.Text;
dr1[10] = TxtsecurityCode.Text;
dr1[11] = BookingId;
dr1[12] = Today;

}
else
{
dr1[0] = txtguestid.Text;
dr1[1] = txtname.Text;
dr1[2] = txtRoomNo.Text;
dr1[3] = txtInDate.Text;
dr1[4] = txtOutDate.Text;
dr1[5] = txtamount.Text;
dr1[6] = ddlpaymentmode.Text;
dr1[7] = "XXXXXXXXXXXX";
dr1[8] = "XXXXXXXXXXXX";
dr1[9] = "XXXXXXXXXXXX";
dr1[10] = "XXXXXXXXXXXX";
dr1[11] = BookingId;
dr1[12] = Today;
}

dt1.Rows.Add(dr1);
Session["BookingId"] = BookingId;
SqlCommandBuilder cd = new SqlCommandBuilder(Sqd1);
Sqd1.Update(dt1);
//storing room information
PathStringClass path2 = new PathStringClass();
string DatabasePath2 = path2.Get_path();
SqlConnection SqlCon2 = new SqlConnection(DatabasePath2);
SqlDataAdapter Sqd2 = new SqlDataAdapter("select * from BookedRooms",
SqlCon2);
DataSet ds2 = new DataSet();
Sqd2.Fill(ds2, "BookedRooms");
DataTable dt2 = ds2.Tables[0];
DataRow dr2 = dt2.NewRow();
dr2[0]
dr2[1]
dr2[2]
dr2[3]
dr2[4]

=
=
=
=
=

txtRoomNo.Text;
txtInDate.Text;
txtOutDate.Text;
BookingId;
txtguestid.Text;

dt2.Rows.Add(dr2);
SqlCommandBuilder cd2 = new SqlCommandBuilder(Sqd2);
Sqd2.Update(dt2);
//deleting temp Booking information
if (Session["PaymentId"] != null)
{
string PaymentId = Session["PaymentId"].ToString();
PathStringClass path3 = new PathStringClass();
string DatabasePath3 = path3.Get_path();
SqlConnection SqlCon3 = new SqlConnection(DatabasePath3);

SqlDataAdapter Sqd3 = new SqlDataAdapter("select * from c where


TempBookingId='" + PaymentId + "'", SqlCon3);
DataSet ds3 = new DataSet();
Sqd3.Fill(ds3, "TempBookedRoom");
DataTable dt3 = ds3.Tables[0];
int row3 = dt3.Rows.Count;
if (row3 != 0)
{
foreach (DataRow dr3 in dt3.Rows)
{
dr3.Delete();
SqlCommandBuilder cb = new SqlCommandBuilder(Sqd3);
Sqd3.Update(dt3);
break;
}
}

Session["BookingId"] = BookingId;
Session["GuestId"] = Session["GuestId"].ToString();
Response.Redirect("~/Guest/BookingInformation.aspx");//going to Booking
conformation page by taking payment information
}
protected void btnregister_Click(object sender, EventArgs e)
{
Response.Redirect("~/Guest/Default.aspx");
Session["GuestId"] = txtguestid.Text;
}
}
}
Paymentstatus.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Guest
{

public partial class PaymentStatus : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["GuestId"] != null && Session["GuestName"] != null)
{
Session["GuestName"] = Session["GuestName"].ToString();
Session["GuestId"] = Session["GuestId"].ToString();
lblShowingName.Text = "Hi... " + Session["GuestName"].ToString() + ", " + "
User-Id:- " + Session["GuestId"].ToString();
}
}
protected void BtnStatus_Click(object sender, EventArgs e)
{
string StatusType = ddlBookingIdType.SelectedItem.ToString();
switch (StatusType)
{
case "Booking-Id":
{
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from
PaymentDetails where BookingId='"+ TxtId .Text +"'", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "PaymentDetails");
DataTable dt1 = ds1.Tables[0];
int row1 = dt1.Rows.Count;
if (row1 != 0)
{
GrdConfimedBookInfo.DataSource = ds1;
GrdConfimedBookInfo.DataBind();
lblmessage.Text = "Your payment information(s) are displayed in the
bellow:--";
LblMessge.Text = "";
GrdTempPaymentDetails.DataSource = null;
GrdTempPaymentDetails.DataBind();
}
else
{
lblmessage.Text = "Your payment information is not found...!!!";
LblMessge.Text = "";
}
}
break;
case "TepmBooking-Id":
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();

SqlConnection SqlCon = new SqlConnection(DatabasePath);


SqlDataAdapter Sqd = new SqlDataAdapter("select * from
TempBookedRooms where TempBookingId='" + TxtId .Text + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "TempBookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
GrdTempPaymentDetails.DataSource = ds;
GrdTempPaymentDetails.DataBind();
lblmessage.Text = "";
LblMessge.Text = "Your payment(s) is/are if process, please clear your
payment to confirm your booking Status:--";
GrdConfimedBookInfo.DataSource = null;
GrdConfimedBookInfo.DataBind();
}
else
{
LblMessge.Text = "Your Temparary Booked room not found...!!!";
lblmessage.Text = "";
}
}
break;
case "Guest-Id":
{
Boolean booked = false;
Boolean Unbooked = false;
//Payments of Booked rooms
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from
PaymentDetails where GuestId='" + TxtId.Text + "'", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "PaymentDetails");
DataTable dt1 = ds1.Tables[0];
int row1 = dt1.Rows.Count;
if (row1 != 0)
{
GrdConfimedBookInfo.DataSource = ds1;
GrdConfimedBookInfo.DataBind();
lblmessage.Text = "Your payment information(s) are displayed in the
bellow:--";
booked = true;
}
else
{
GrdConfimedBookInfo.DataSource = null;
GrdConfimedBookInfo.DataBind();

//payment information of temprary booked rooms


PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
TempBookedRooms where GuestId='" + TxtId.Text + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "TempBookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
GrdTempPaymentDetails.DataSource = ds;
GrdTempPaymentDetails.DataBind();
LblMessge.Text = "Your payment(s) is/are in process, please clear your
payment to confirm your booking Status:--";
Unbooked = true;
}
else
{
GrdTempPaymentDetails.DataSource = null;
GrdTempPaymentDetails.DataBind();
}
if (!booked)
{
lblmessage.Text = "";
}
if (!Unbooked)
{
LblMessge.Text = "";
}
}
break;
}
}
protected void BtnPay_Click(object sender, EventArgs e)
{
Button BtnPay = (Button)sender;
GridViewRow row = (GridViewRow)BtnPay.Parent.Parent;
Label LblPaymentId = (Label)row.FindControl("LblPaymentId");
Session["PaymentId"] = LblPaymentId.Text;
Response.Redirect("~/Guest/MakePayment.aspx");
}
protected void BtnOk_Click(object sender, EventArgs e)
{
GrdConfimedBookInfo.DataSource = null;

GrdConfimedBookInfo.DataBind();
GrdTempPaymentDetails.DataSource = null;
GrdTempPaymentDetails.DataBind();
lblmessage.Text = "";
LblMessge.Text = "";
}
protected void BtnPrint_Click(object sender, EventArgs e)
{
lblmessage.Text = "Please Collect your booking information for further use...!!!";
}
}
}
Roomsearching.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
using System.Globalization;
namespace HotelManagementSystem.Guest
{
public partial class RoomSearching : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["GuestId"] != null && Session["GuestName"] != null)
{
Session["GuestName"] = Session["GuestName"].ToString();
Session["GuestId"] = Session["GuestId"].ToString();
lblShowingName.Text = "Hi... " + Session["GuestName"].ToString() + ", " + "
User-Id:- " + Session["GuestId"].ToString();
}
}
protected void BtnSearch_Click(object sender, EventArgs e)
{
DataTable tempTable = new DataTable();
tempTable.Columns.Add("RoomNo");
Boolean IsPickedUpBookedRoomNo = false, Taken = false;
string indate = ddldin.Text + "/" + ddlmin.Text + "/" + ddlyin.Text;

string outdate = ddldout.Text + "/" + ddlmout.Text + "/" + ddlyout.Text;


string Formate = "dd/MM/yyyy";
DateTime GuestDateIn = DateTime.ParseExact(indate, Formate,
CultureInfo.InvariantCulture);
DateTime GuestDateOut = DateTime.ParseExact(outdate, Formate,
CultureInfo.InvariantCulture);
int CheckDate = DateTime.Compare(GuestDateOut, GuestDateIn);
if (CheckDate >= 0)
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from BookedRooms ",
SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int row = ds.Tables[0].Rows.Count;
if (row != 0)
{
int i = 0;
foreach (DataRow dr in dt.Rows)
{
string CheckInDate = dt.Rows[i][1].ToString();
DateTime TableDateIn = DateTime.ParseExact(CheckInDate, Formate,
CultureInfo.InvariantCulture);
string CheckOutDate = dt.Rows[i][2].ToString();
DateTime TableDateOut = DateTime.ParseExact(CheckOutDate, Formate,
CultureInfo.InvariantCulture);

int result1 = DateTime.Compare(GuestDateIn, TableDateIn);//guest datein


is less then old guest datein
int result2 = DateTime.Compare(GuestDateOut, TableDateOut);//old guest
outdate is before then new guest checkin
int result3 = DateTime.Compare(GuestDateIn, TableDateOut);
int result4 = DateTime.Compare(GuestDateOut, TableDateIn);
if (result1 <= 0 && result2 >= 0)//true when Date1 is greter then
{
DataRow NewDr = tempTable.NewRow();
string SelectedRoomNo = dt.Rows[i][0].ToString();
NewDr["RoomNo"] = SelectedRoomNo;
tempTable.Rows.Add(NewDr);
tempTable.AcceptChanges();
IsPickedUpBookedRoomNo = true;

Taken = true;

}
if (result1 >= 0 && result2 <= 0 && !Taken)
{
DataRow NewDr = tempTable.NewRow();
NewDr["RoomNo"] = dt.Rows[i][0].ToString();
tempTable.Rows.Add(NewDr);
tempTable.AcceptChanges();
IsPickedUpBookedRoomNo = true;
Taken = true;

}
if (result1 > 1 && result3 > 0 && !Taken)
{
DataRow NewDr = tempTable.NewRow();
NewDr["RoomNo"] = dt.Rows[i][0].ToString();
tempTable.Rows.Add(NewDr);
tempTable.AcceptChanges();
IsPickedUpBookedRoomNo = true;
Taken = true;

}
if (result1 > 0 && result4 < 0 && !Taken)
{
DataRow NewDr = tempTable.NewRow();
NewDr["RoomNo"] = dt.Rows[i][0].ToString();
tempTable.Rows.Add(NewDr);
tempTable.AcceptChanges();
IsPickedUpBookedRoomNo = true;
Taken = true;

}
Taken = false;
i = i + 1;
}
}
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from Room ", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "Room");
DataTable dt1 = ds1.Tables[0];

int row1 = ds1.Tables[0].Rows.Count;


if (row1 != 0)
{

if (!IsPickedUpBookedRoomNo)
{
GrdRooms.DataSource = dt1;
GrdRooms.DataBind();
}
else
{
DataTable tempdt = new DataTable(); // creating temp table to store
Booked Room no details
tempdt.Columns.Add("RoomNo");//adding culumns to temp table
tempdt.Columns.Add("Type");
tempdt.Columns.Add("Capacity");
tempdt.Columns.Add("Rate");
tempdt.Columns.Add("Status");
tempdt.Columns.Add("Image");
int n = 0, l = 0;
Boolean IsMatchedBoothRoom = false;
foreach (DataRow dr2 in dt1.Rows)
{
int k = 0;
foreach (DataRow dr in tempTable.Rows)
{
string AvailableRoomNo = dt1.Rows[l][0].ToString();
string BookedRoomNo = tempTable.Rows[k][0].ToString();
if (AvailableRoomNo == BookedRoomNo) // finding all booked room
no from room table
{
IsMatchedBoothRoom = true;
}
k = k + 1;
}
if (!IsMatchedBoothRoom)
{
DataRow NewDR = tempdt.NewRow();
NewDR["RoomNo"] = dt1.Rows[n][0].ToString();
NewDR["Type"] = dt1.Rows[n][1].ToString();
NewDR["Capacity"] = dt1.Rows[n][2].ToString();
NewDR["Rate"] = dt1.Rows[n][3].ToString();
NewDR["Status"] = dt1.Rows[n][4].ToString();
NewDR["Image"] = dt1.Rows[n][5].ToString();
tempdt.Rows.Add(NewDR);
tempdt.AcceptChanges();
n = n + 1;

}
IsMatchedBoothRoom = false;
l = l + 1;
}
ViewState["tempdt"] = tempdt;
int TempTableData = tempdt.Rows.Count;
if (TempTableData != 0)
{
GrdRooms.DataSource = tempdt;
GrdRooms.DataBind();
}
else
{
lblmessage.Text = "Room Is Not Available For you Between The Given
Date...!!!";
}
}
}
}
else
{
lblmessage.Text = "Please Check Entered Dates";
}
}
protected void btnselect_Click(object sender, EventArgs e)
{
Button btnselect = (Button)sender;
GridViewRow row = (GridViewRow)btnselect.Parent.Parent;
Label lblRoomNo = (Label)row.FindControl("lblRoomNo");
Session["SelectedRoomNo"] = lblRoomNo.Text;
string indate = ddldin.Text + "/" + ddlmin.Text + "/" + ddlyin.Text;
string outdate = ddldout.Text + "/" + ddlmout.Text + "/" + ddlyout.Text;
Session["CheckInDate"] = indate;
Session["CheckOutDate"] = outdate;
Response.Redirect("~/Guest/SelelectedRoom.aspx");
}
}
}
Selectedroom.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;

using
using
using
using
using
using

System.Web.UI.HtmlControls;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Xml.Linq;
System.Data.SqlClient;
System.IO;

namespace HotelManagementSystem.Guest
{
public partial class SelelectedRoom : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["GuestId"] != null && Session["GuestName"] != null)
{
Session["GuestName"] = Session["GuestName"].ToString();
Session["GuestId"] = Session["GuestId"].ToString();
lblShowingName.Text = "Hi... " + Session["GuestName"].ToString() + ", " + "
User-Id:- " + Session["GuestId"].ToString();
}
if (!IsPostBack && Session["SelectedRoomNo"] != null)
{

string str = Session["SelectedRoomNo"].ToString();


string Indate = Session["CheckInDate"].ToString();
string OutDate = Session["CheckOutDate"].ToString();

PathStringClass path = new PathStringClass();


string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Room where
RoomNo='" + str + "' ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Room");
DataTable dt = ds.Tables[0];
int Room = dt.Rows.Count;

DataTable TempTable = new DataTable();


TempTable.Columns.Add("RoomNo");
TempTable.Columns.Add("Type");
TempTable.Columns.Add("Capacity");
TempTable.Columns.Add("Rate");
TempTable.Columns.Add("Status");
TempTable.Columns.Add("Image");
TempTable.Columns.Add("CheckInDate");
TempTable.Columns.Add("CheckOutDate");
foreach (DataRow dr in dt.Rows)

{
DataRow TempDr = TempTable.NewRow();
TempDr["RoomNo"] = dt.Rows[0][0].ToString();
TempDr["Type"] = dt.Rows[0][1].ToString();
TempDr["Capacity"] = dt.Rows[0][2].ToString();
TempDr["Rate"] = dt.Rows[0][3].ToString();
TempDr["Status"] = dt.Rows[0][4].ToString();
TempDr["Image"] = dt.Rows[0][5].ToString();
TempDr["CheckInDate"] = Indate;
TempDr["CheckOutDate"] = OutDate;
TempTable.Rows.Add(TempDr);
TempTable.AcceptChanges();
ViewState["TempTable"] = TempTable;
}
if (TempTable.Rows.Count > 0)
{
GrdRooms.DataSource = TempTable;
GrdRooms.DataBind();
}
}
BtnPrint.Enabled = false;
BtnOk.Enabled = false;
}
protected void btnMakePayment_Click(object sender, EventArgs e)
{
Button btnMakePayment = (Button)sender;
GridViewRow row = (GridViewRow)btnMakePayment.Parent.Parent;
Label lblRoomNo = (Label)row.FindControl("lblRoomNo");
Label lblCheckInDate = (Label)row.FindControl("lblCheckInDate");
Label LblCheckOutDate = (Label)row.FindControl("LblCheckOutDate");
Label LblRate = (Label)row.FindControl("LblRate");

if (Session["GuestName"] != null)
{
string Guestid = Session["GuestName"].ToString();
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from GuestDetails where
GuestId='" + Guestid + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "GuestDetails");
DataTable dt = ds.Tables[0];
int Room = dt.Rows.Count;
if (Room != 0)

{
string Name = dt.Rows[0][0].ToString();
Session["Name"] = Name;
}
Session["Amount"] = LblRate.Text;
Session["GuestName"] = Session["GuestName"].ToString();
Session["Amount"] = LblRate.Text;
Session["CheckInDate"] = lblCheckInDate.Text;
Session["CheckOutDate"] = LblCheckOutDate.Text;
Session["SelectedRoomNo"] = lblRoomNo.Text;
Response.Redirect("~/Guest/MakePayment.aspx");
}
}
protected void btnMakePaymentLetter_Click(object sender, EventArgs e)
{
Button btnMakePayment = (Button)sender;
BtnPrint.Enabled = true;
btnMakePayment.Enabled = false;

Button btnMakePaymentLetter = (Button)sender;


GridViewRow row = (GridViewRow)btnMakePaymentLetter.Parent.Parent;
Label lblRoomNo = (Label)row.FindControl("lblRoomNo");
Label lblCheckInDate = (Label)row.FindControl("lblCheckInDate");
Label LblCheckOutDate = (Label)row.FindControl("LblCheckOutDate");
Label LblRate = (Label)row.FindControl("LblRate");
Random MyRandom = new Random();
string TempBookingId = Convert.ToString(MyRandom.Next(10, 3000));

PathStringClass path1 = new PathStringClass();


string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from TempBookedRooms",
SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "TempBookedRooms");
DataTable dt1 = ds1.Tables[0];
DataRow dr1 = dt1.NewRow();
dr1[0]
dr1[1]
dr1[2]
dr1[3]
dr1[4]
dr1[5]
dr1[6]

=
=
=
=
=
=
=

TempBookingId;
Session["GuestId"].ToString();
Session["GuestName"].ToString();
lblRoomNo.Text;
lblCheckInDate.Text;
LblCheckOutDate.Text;
LblRate.Text;

dt1.Rows.Add(dr1);

SqlCommandBuilder cd = new SqlCommandBuilder(Sqd1);


Sqd1.Update(dt1);
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from TempBookedRooms
where TempBookingId='" + TempBookingId + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "TempBookedRooms");
DataTable dt = ds.Tables[0];
int Mydata= dt.Rows.Count;
if (Mydata != 0)
{
GrdRooms.DataSource = null;
GrdRooms.DataBind();
GrdTempPaymentDetails.DataSource = ds;
GrdTempPaymentDetails.DataBind();
lblmessage.Text = "Please Print your Temprary Booking information for further
use...!!!";
}
}
protected void BtnPrint_Click(object sender, EventArgs e)
{
BtnOk.Enabled = true;
GrdRooms.DataSource = null;
GrdRooms.DataBind();
}
protected void BtnOk_Click(object sender, EventArgs e)
{
Response.Redirect("~/Guest/Default.aspx");
}
protected void BtnPay_Click(object sender, EventArgs e)
{
Button BtnPay = (Button)sender;
GridViewRow row = (GridViewRow)BtnPay.Parent.Parent;
Label LblPaymentId = (Label)row.FindControl("LblPaymentId");
Label LblGuestId = (Label)row.FindControl("LblGuestId");
Label LblName = (Label)row.FindControl("LblName");
Label LblRoomNo = (Label)row.FindControl("LblRoomNo");
Label lblCheckInDate = (Label)row.FindControl("lblCheckInDate");
Label LblCheckOutDate = (Label)row.FindControl("LblCheckOutDate");
Label LblAmount = (Label)row.FindControl("LblAmount");
Session["PaymentId"] = LblPaymentId.Text;
Session["GuestId"]=LblGuestId .Text ;
Session["Amount"] =LblAmount .Text;
Session["GuestName"] =LblName.Text;

Session["CheckInDate"] =lblCheckInDate.Text;
Session["CheckOutDate"] =LblCheckOutDate.Text;
Session["SelectedRoomNo"] =LblRoomNo .Text;
Response.Redirect("~/Guest/MakePayment.aspx");
}
protected void btnCancel_Click(object sender, EventArgs e)
{
Response.Redirect("~/Guest/Default.aspx");
}
}
}
AddingCustomerDetails.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Receptionist
{
public partial class AddingCustomerDetails : System.Web.UI.Page
{
string ImgPath;//Image storing
Boolean value = false;
Boolean IsExistId = false;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["ReceptionistId"] != null && Session["ReceptionistName"] != null)
{
Session["ReceptionistName"] = Session["ReceptionistName"].ToString();
Session["ReceptionistId"] = Session["ReceptionistId"].ToString();
lblShowingName.Text = "Hi... " + Session["ReceptionistName"].ToString() + ", "
+ " User-Id:- " + Session["ReceptionistId"].ToString();
}
}
protected void BtnRegisterGuest_Click(object sender, EventArgs e)
{
if (Page.IsValid)

{
if (UploadImage.HasFile)
{
ImgPath = ImagePath();
IsExistId = check_ID();
if (ImgPath != null && IsExistId)
{
Register_Guest(ImgPath);
Show_Guest_Registered_Iformation();
}
}
else
{
LblPictureMessege.Text = "Please Select Image";
}
}
else
{
LblValidateMessage.Text = "Uknown Error occured!!!";
}
BtnRegisterGuest.Enabled = false;
}
private string ImagePath()
{
Boolean FileOK = false;
//Boolean FileSaved = false;
int k = 0;

Session["WorkingImage"] = UploadImage.FileName;
String FileExtension =
Path.GetExtension(Session["WorkingImage"].ToString()).ToLower();
//renaming File
Random MyRandom = new Random();
string FilenameWithoutExtension =
Path.GetFileNameWithoutExtension(Session["WorkingImage"].ToString());
string fileNameIncreament = Convert.ToString(MyRandom.Next(10, 300000));
FilenameWithoutExtension = FilenameWithoutExtension + fileNameIncreament;
Session["ImageFileName"] = FilenameWithoutExtension + FileExtension;
String[] allowedExtensions = { ".png", ".jpeg", ".jpg", ".gif", ".htm" };
for (int i = 0; i < allowedExtensions.Length; i++)
{
k++;
if (FileExtension == allowedExtensions[i])
{
FileOK = true;
break;
}
}
if (FileOK)
{

try
{
string path = (Server.MapPath("../GuestImages")).ToString();
UploadImage.SaveAs(path + "/" + Session["ImageFileName"].ToString());
}
catch (Exception ex)
{
}
}
string dbfilePath;
string fileName = Path.GetFileName(Session["ImageFileName"].ToString());
dbfilePath = @"../GuestImages/" + fileName;
if (!FileOK)
{
dbfilePath = null;
}
return dbfilePath;
}
private bool check_ID()
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from GuestDetails where
GuestId='" + txtuserid.Text + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "GuestDetails");
DataTable dt = ds.Tables[0];
DataRow dr = dt.NewRow();
int Room = 0;
Room = dt.Rows.Count;
if (Room != 0)
{
GrdGuestDetails.DataSource = ds;
GrdGuestDetails.DataBind();
IsExistId = false;
lblmessage.Text = "A user is already registered with this User-Id";
}
else
{
IsExistId = true;
}
return IsExistId;
}
private void Register_Guest(string ImgPath)
{
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);

SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from GuestDetails",


SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "GuestDetails");
DataTable dt1 = ds1.Tables[0];
DataRow dr1 = dt1.NewRow();
dr1[0] = ddlnametitle.SelectedItem.ToString() + txtname.Text;
dr1[1] = ddlfnametitle.SelectedItem.ToString() + txtfname.Text;
dr1[2] = ddldd.SelectedItem.ToString() + "/" + ddlmm.SelectedItem.ToString() +
"/" + ddlyyyy.SelectedItem.ToString();
dr1[3] = ddlgender.SelectedItem.ToString();
dr1[4] = txtidmark.Text;
dr1[5] = txtmobile.Text;
dr1[6] = txtemail.Text;
dr1[7] = ddlidtype.SelectedItem.ToString();
dr1[8] = txtidno.Text;
dr1[9] = txtaddress.Text;
dr1[10] = txtcity.Text;
dr1[11] = txtstate.Text;
dr1[12] = txtpinno.Text;
dr1[13] = txtcountry.Text;
dr1[14] = txtuserid.Text;
dr1[15] = txtpassword.Text;
dr1[16] = txtconfirmpassword.Text;
dr1[17] = ImgPath;
dt1.Rows.Add(dr1);
SqlCommandBuilder cd = new SqlCommandBuilder(Sqd1);
Sqd1.Update(dt1);
}
private void Show_Guest_Registered_Iformation()
{
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd2 = new SqlDataAdapter("select * from GuestDetails where
GuestId='" + txtuserid.Text + "'", SqlCon1);
DataSet ds2 = new DataSet();
Sqd2.Fill(ds2, "GuestDetails");
DataTable dt2 = ds2.Tables[0];
int noofrow = dt2.Rows.Count;
if (noofrow != 0)
{
GrdGuestDetails.DataSource = ds2;
GrdGuestDetails.DataBind();
}
else
{
LblValidateMessage.Text = "There an error...!!!";
}
}

protected void btncheckExistingid_Click(object sender, EventArgs e)


{
Boolean IsIdExist = false;
IsIdExist = check_ID();
if (IsIdExist)
{
lblmessage.Text = "Entered Id is avilable for you";
}
else
{
lblmessage.Text = "Entered Id is not available for you";
}
}
protected void BtnClose_Click(object sender, EventArgs e)
{
lblmessage.Text = "";
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
}
protected void BtnRoomBooking_Click(object sender, EventArgs e)
{
Button BtnRoomBooking = (Button)sender;
GridViewRow row = (GridViewRow)BtnRoomBooking.Parent.Parent;
Label lblName = (Label)row.FindControl("lblName");
Label lbluserid = (Label)row.FindControl("lbluserid");
Session["lblName"] = lblName.Text;
Session["UserId"] = lbluserid.Text;
Response.Redirect("~/Receptionist/SearchingRoom.aspx");
}
protected void BtnOk_Click(object sender, EventArgs e)
{
Response.Redirect("~/Receptionist/Default.aspx");
}
}
}
Addingroom.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Receptionist
{
public partial class AddingRoom : System.Web.UI.Page
{
string ImgPath;
Boolean Value = false;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["ReceptionistId"] != null && Session["ReceptionistName"] != null)
{
Session["ReceptionistName"] = Session["ReceptionistName"].ToString();
Session["ReceptionistId"] = Session["ReceptionistId"].ToString();
lblShowingName.Text = "Hi... " + Session["ReceptionistName"].ToString() + ", "
+ " User-Id:- " + Session["ReceptionistId"].ToString();
}
}
protected void btnaddroom_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
if (UploadImage.HasFile)
{
Boolean IsExistRoomNo = false;
ImgPath = ImagePath();
IsExistRoomNo = Check_RoomNo();
if (ImgPath != null && IsExistRoomNo)
{
Add_This_Room(ImgPath);
Display_Added_Room();
}
}
else
{
lblmessage.Text = "Please select Picture...!!!";
}
}
else
{
lblmessage.Text = "Please check all given information";
}
}
private string ImagePath()
{
Boolean FileOK = false;
int k = 0;
Session["WorkingImage"] = UploadImage.FileName;

String FileExtension =
Path.GetExtension(Session["WorkingImage"].ToString()).ToLower();
//renaming File
Random MyRandom = new Random();
string FilenameWithoutExtension =
Path.GetFileNameWithoutExtension(Session["WorkingImage"].ToString());
string fileNameIncreament = Convert.ToString(MyRandom.Next(10, 300000));
FilenameWithoutExtension = FilenameWithoutExtension + fileNameIncreament;
Session["ImageFileName"] = FilenameWithoutExtension + FileExtension;
String[] allowedExtensions = { ".png", ".jpeg", ".jpg", ".gif", ".htm" };
for (int i = 0; i < allowedExtensions.Length; i++)
{
k++;
if (FileExtension == allowedExtensions[i])
{
FileOK = true;
break;
}
}
if (FileOK)
{
try
{
string path = (Server.MapPath("../RoomImages")).ToString();
UploadImage.SaveAs(path + "/" + Session["ImageFileName"].ToString());
}
catch (Exception ex)
{
}
}
else
{
lblmessage.Text = "Please Select Valid Image";
}
string dbfilePath;
string fileName = Path.GetFileName(Session["ImageFileName"].ToString());
dbfilePath = @"../RoomImages/" + fileName;
if (!FileOK)
{
dbfilePath = null;
}
return dbfilePath;
}
private bool Check_RoomNo()
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd2 = new SqlDataAdapter("select * from Room where
RoomNo='" + txtRoomNo.Text + "'", SqlCon);
DataSet ds2 = new DataSet();

Sqd2.Fill(ds2, "Room");
DataTable dt2 = ds2.Tables[0];
int noofrow = dt2.Rows.Count;
if (noofrow != 0)
{
lblmessage.Text = "This Room is already added";
GrdRooms.DataSource = ds2;
GrdRooms.DataBind();
Value = false;
}
else
{
Value = true;
}
return Value;
}
private void Add_This_Room(string ImgPath)
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Room ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Room");
DataTable dt = ds.Tables[0];
DataRow dr = dt.NewRow();
dr[0] = txtRoomNo.Text;
dr[1] = ddlroomtype.SelectedItem.ToString();
dr[2] = ddlroomcapacity.SelectedItem.ToString();
dr[3] = txtrate.Text;
dr[4] = ddlroomstatus.SelectedItem.ToString();
dr[5] = ImgPath;
dt.Rows.Add(dr);
SqlCommandBuilder cd = new SqlCommandBuilder(Sqd);
Sqd.Update(dt);
lblmessage.Text = "Room Is successfully added..";
lblmessage.ForeColor = System.Drawing.Color.Green;
}
private void Display_Added_Room()
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd2 = new SqlDataAdapter("select * from Room where
RoomNo='" + txtRoomNo.Text + "'", SqlCon);
DataSet ds2 = new DataSet();
Sqd2.Fill(ds2, "Room");
DataTable dt2 = ds2.Tables[0];
int noofrow = dt2.Rows.Count;

if (noofrow != 0)
{
GrdRooms.DataSource = ds2;
GrdRooms.DataBind();
}
}
protected void ShowAllRooms_Click(object sender, EventArgs e)
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Room ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Room");
DataTable dt = ds.Tables[0];
DataRow dr = dt.NewRow();
int Room = 0;
Room = dt.Rows.Count;
if (Room != 0)
{
GrdRooms.DataSource = ds;
GrdRooms.DataBind();
lblmessage.Text = "";
}
else
{
lblmessage.Text = "There are no rooms found!!!";
}

}
protected void btnselect_Click(object sender, EventArgs e)
{
Button imgbtn = (Button)sender;
GridViewRow row = (GridViewRow)imgbtn.Parent.Parent;
Label lblRoomNo = (Label)row.FindControl("lblRoomNo");
Session["RoomNo"] = lblRoomNo.Text;
Session["ComeBack"] = "ComeBack";
Response.Redirect("~/Admin/DeleteSelectedRoom.aspx");
}
protected void CustomValidator1_ServerValidate(object source,
ServerValidateEventArgs args)
{
Boolean check;
int number;
check = int.TryParse(args.Value, out number);

args.IsValid = check;
}
protected void CustomValidator2_ServerValidate(object source,
ServerValidateEventArgs args)
{
Boolean check;
int number;
check = int.TryParse(args.Value, out number);
args.IsValid = check;
}
}
}
Bookingcancelation.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Receptionist
{
public partial class BookingCancelation : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["ReceptionistId"] != null && Session["ReceptionistName"] != null)
{
Session["ReceptionistName"] = Session["ReceptionistName"].ToString();
Session["ReceptionistId"] = Session["ReceptionistId"].ToString();
lblShowingName.Text = "Hi... " + Session["ReceptionistName"].ToString() + ", "
+ " User-Id:- " + Session["ReceptionistId"].ToString();
}
}
protected void BtnFind_Click(object sender, EventArgs e)
{
string id = ddlId.SelectedItem.ToString();
switch (id)
{

case "Guest-Id":
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from BookedRooms
where GuestId ='" + txtId.Text + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
lblmessage.Text = "";
GrdAvailableRooms.DataSource = ds;
GrdAvailableRooms.DataBind();
GrdFoundGuest.DataSource = null;
GrdFoundGuest.DataBind();
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GrdSelectedBookedRoom.DataSource = null;
GrdSelectedBookedRoom.DataBind();
}
else
{
lblmessage.Text = "Booked Room Not Found. Please Try Another...!!!";
}
}
break;
case "Booking-Id":
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from BookedRooms
where BookingId ='" + txtId.Text + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
lblmessage.Text = "";
GrdAvailableRooms.DataSource = ds;
GrdAvailableRooms.DataBind();
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GrdSelectedBookedRoom.DataSource = null;
GrdSelectedBookedRoom.DataBind();
GrdFoundGuest.DataSource = null;
GrdFoundGuest.DataBind();

}
else
{
lblmessage.Text = "Booked Room Not Found. Please Try Another...!!!";
}
}
break;
case "Name":
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from GuestDetails
where Name like '%" + txtId.Text + "%'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "GuestDetails");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row != 0)
{
lblmessage.Text = "";
GrdFoundGuest.DataSource = ds;
GrdFoundGuest.DataBind();
GrdAvailableRooms.DataSource = null;
GrdAvailableRooms.DataBind();
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GrdSelectedBookedRoom.DataSource = null;
GrdSelectedBookedRoom.DataBind();
}
else
{
lblmessage.Text = "Booked Room Not Found. Please Try Another...!!!";
}

}
break;
}
}
protected void BtnFindGuestDetails_Click(object sender, EventArgs e)
{
Button BtnFindGuestDetails = (Button)sender;
GridViewRow row = (GridViewRow)BtnFindGuestDetails.Parent.Parent;
Label LblUserId = (Label)row.FindControl("LblUserId");
string GuestId = LblUserId.Text;

PathStringClass path = new PathStringClass();


string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from GuestDetails where
GuestId ='" + GuestId + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "GuestDetails");
DataTable dt = ds.Tables[0];
int row1 = dt.Rows.Count;
if (row1 != 0)
{
lblmessage.Text = "";
GrdGuestDetails.DataSource = ds;
GrdGuestDetails.DataBind();
}
else
{
lblmessage.Text = "Not Found...!!!";
}
}
protected void BtnSelect_Click(object sender, EventArgs e)
{
Button BtnFindGuestDetails = (Button)sender;
GridViewRow row = (GridViewRow)BtnFindGuestDetails.Parent.Parent;
Label LblBookingId = (Label)row.FindControl("LblBookingId");
string BookingId = LblBookingId.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from BookedRooms where
BookingId ='" + BookingId + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "BookedRooms");
DataTable dt = ds.Tables[0];
int row1 = dt.Rows.Count;
if (row1 != 0)
{
lblmessage.Text = "";
GrdSelectedBookedRoom.DataSource = ds;
GrdSelectedBookedRoom.DataBind();
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GrdAvailableRooms.DataSource = null;
GrdAvailableRooms.DataBind();
}
else
{

lblmessage.Text = "Room Could Not Selected. Please Try Again...!!!";


}
}
protected void BtnDelete_Click(object sender, EventArgs e)
{
Button BtnFindGuestDetails = (Button)sender;
GridViewRow row = (GridViewRow)BtnFindGuestDetails.Parent.Parent;
Label lblBookingId = (Label)row.FindControl("lblBookingId");
string BookingId = lblBookingId.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from BookedRooms where
BookingId ='" + BookingId + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "BookedRooms");
DataTable dt = ds.Tables[0];
int row1 = dt.Rows.Count;
if (row1 != 0)
{
foreach (DataRow dr in dt.Rows)
{
dr.Delete();
SqlCommandBuilder cd = new SqlCommandBuilder(Sqd);
Sqd.Update(dt);
break;
}
}
else
{
lblmessage.Text = "Cancelation Failured, Please try Again...!!!";
}
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from PaymentDetails
where BookingId ='" + BookingId + "'", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "BookedRooms");
DataTable dt1 = ds1.Tables[0];
int row2 = dt1.Rows.Count;
if (row2 != 0)
{
foreach (DataRow dr1 in dt.Rows)
{
dr1.Delete();
SqlCommandBuilder cd1 = new SqlCommandBuilder(Sqd1);
Sqd.Update(dt1);
break;

}
}
else
{
PathStringClass path11 = new PathStringClass();
string DatabasePath11 = path11.Get_path();
SqlConnection SqlCon11 = new SqlConnection(DatabasePath11);
SqlDataAdapter Sqd11 = new SqlDataAdapter("select * from PaymentDetails
where BookingId ='" + BookingId + "'", SqlCon11);
DataSet ds11 = new DataSet();
Sqd11.Fill(ds11, "BookedRooms");
DataTable dt11 = ds11.Tables[0];
int row21 = dt11.Rows.Count;
if (row21 != 0)
{
foreach (DataRow dr11 in dt.Rows)
{
dr11.Delete();
SqlCommandBuilder cd11 = new SqlCommandBuilder(Sqd11);
Sqd.Update(dt11);
break;
}
}
}
lblmessage.Text = "Your Booking Has Been Canceled successfully!!!";
GrdSelectedBookedRoom.DataSource = null;
GrdSelectedBookedRoom.DataBind();
}
protected void BtnClose_Click(object sender, EventArgs e)
{
lblmessage.Text = "";
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
}
protected void BtnSelectGuest_Click(object sender, EventArgs e)
{
Button BtnSelectGuest = (Button)sender;
GridViewRow row = (GridViewRow)BtnSelectGuest.Parent.Parent;
Label lbluserid = (Label)row.FindControl("lbluserid");
Label LblMessageOfBooking = (Label)row.FindControl("LblMessageOfBooking");
string GuestId = lbluserid.Text;

PathStringClass path = new PathStringClass();


string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from BookedRooms where
GuestId ='" + GuestId + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "BookedRooms");
DataTable dt = ds.Tables[0];
int row22 = dt.Rows.Count;
if (row22 != 0)
{
lblmessage.Text = "";
GrdAvailableRooms.DataSource = ds; ;
GrdAvailableRooms.DataBind();
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GrdSelectedBookedRoom.DataSource = null;
GrdSelectedBookedRoom.DataBind();
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from GuestDetails where
GuestId ='" + GuestId + "'", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "BookedRooms");
DataTable dt1 = ds1.Tables[0];
int row1 = dt1.Rows.Count;
if (row1 != 0)
{
lblmessage.Text = "";
GrdFoundGuest.DataSource = null;
GrdFoundGuest.DataBind();
GrdGuestDetails.DataSource = ds1;
GrdGuestDetails.DataBind();
GrdSelectedBookedRoom.DataSource = null;
GrdSelectedBookedRoom.DataBind();
}
}
else
{
LblMessageOfBooking.Text = "Booked Room Not Found With This User-Id....!!!";
}
}
protected void BtnSelectGuestClose_Click(object sender, EventArgs e)
{
GrdFoundGuest.DataSource = null;
GrdFoundGuest.DataBind();
}

protected void BtnCancel_Click(object sender, EventArgs e)


{
Response.Redirect("~/Receptionist/Default.aspx");
}
}
}
Bookinginformation.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Receptionist
{
public partial class BookingInformation : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["ReceptionistId"] != null && Session["ReceptionistName"] != null)
{
Session["ReceptionistName"] = Session["ReceptionistName"].ToString();
Session["ReceptionistId"] = Session["ReceptionistId"].ToString();
lblShowingName.Text = "Hi... " + Session["ReceptionistName"].ToString() + ", "
+ " User-Id:- " + Session["ReceptionistId"].ToString();
}
if (!IsPostBack)
{
if (Session["BookingId"] != null)
{
string BookingId = Session["BookingId"].ToString();
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from
PaymentsFromReceptionist where BookingId='" + BookingId + "'", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "PaymentsFromReceptionist");
DataTable dt1 = ds1.Tables[0];
int row = dt1.Rows.Count;
if (row != 0)

{
GRDPaymentDetails.DataSource = ds1;
GRDPaymentDetails.DataBind();
}
}
}
}
protected void btnBookedRoom_Click(object sender, EventArgs e)
{
Button btnRoomDetailsShow = (Button)sender;
GridViewRow row = (GridViewRow)btnRoomDetailsShow.Parent.Parent;
Label lblBookingId = (Label)row.FindControl("lblBookingId");
string Bookingid = lblBookingId.Text;

PathStringClass path4 = new PathStringClass();


string DatabasePath4 = path4.Get_path();
SqlConnection SqlCon4 = new SqlConnection(DatabasePath4);
SqlDataAdapter Sqd4 = new SqlDataAdapter("select * from BookedRooms where
BookingId='" + Bookingid + "'", SqlCon4);
DataSet ds4 = new DataSet();
Sqd4.Fill(ds4, "BookedRooms");
DataTable dt4 = ds4.Tables[0];
int rowno = dt4.Rows.Count;
if (rowno != 0)
{
GRDBookedRoom.DataSource = ds4;
GRDBookedRoom.DataBind();
}
}
protected void BtnGuest_Click(object sender, EventArgs e)
{
Button btnBookedShow = (Button)sender;
GridViewRow row = (GridViewRow)btnBookedShow.Parent.Parent;
Label LblGuestId = (Label)row.FindControl("LblGuestId");
string Guestid = LblGuestId.Text;
PathStringClass path3 = new PathStringClass();
string DatabasePath3 = path3.Get_path();
SqlConnection SqlCon3 = new SqlConnection(DatabasePath3);
SqlDataAdapter Sqd3 = new SqlDataAdapter("select * from GuestDetails where
GuestId='" + Guestid + "' ", SqlCon3);
DataSet ds3 = new DataSet();

Sqd3.Fill(ds3, "PaymentDetails");
DataTable dt3 = ds3.Tables[0];
int PayentRow = dt3.Rows.Count;
if (PayentRow != 0)
{
GrdGuestDetails.DataSource = ds3;
GrdGuestDetails.DataBind();
}
}
protected void btnCloseGuest_Click(object sender, EventArgs e)
{
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
}
protected void BtnClose_Click(object sender, EventArgs e)
{
GRDBookedRoom.DataSource = null;
GRDBookedRoom.DataBind();
}
protected void Payment_Click(object sender, EventArgs e)
{
}
protected void btnok_Click(object sender, EventArgs e)
{
if (Session["UserId"] != null)
{
Session["UserId"] = Session["UserId"].ToString();
}
Response.Redirect("~/Receptionist/Default.aspx");
}
}
}
Bookingroom.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Receptionist
{
public partial class BookingRoom : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["ReceptionistId"] != null && Session["ReceptionistName"] != null)
{
Session["ReceptionistName"] = Session["ReceptionistName"].ToString();
Session["ReceptionistId"] = Session["ReceptionistId"].ToString();
lblShowingName.Text = "Hi... " + Session["ReceptionistName"].ToString() + ", "
+ " User-Id:- " + Session["ReceptionistId"].ToString();
}
if (Session["BookRoomNo"] != null)
{
string str = Session["BookRoomNo"].ToString();
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Room where
RoomNo='" + str + "' ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Room");
DataTable dt = ds.Tables[0];
int Room = dt.Rows.Count;
if (Room != 0)
{
GrdRooms.DataSource = ds;
GrdRooms.DataBind();
}
else
{
lblmessage.Text = "System Error!!!";
}
}
else
{
lblmessage.Text = "You have not selected any room";
BtnBooking.Enabled = false;
}
}
protected void BtnBooking_Click(object sender, EventArgs e)
{
Session["SelectedRoomNo"] = Session["BookRoomNo"].ToString();
Response.Redirect("~/Receptionist/Payment.aspx");

}
}
}
CheckInGuestMonitoring.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Receptionist
{
public partial class CheckInGuestMonitoring : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["ReceptionistId"] != null && Session["ReceptionistName"] != null)
{
Session["ReceptionistName"] = Session["ReceptionistName"].ToString();
Session["ReceptionistId"] = Session["ReceptionistId"].ToString();
lblShowingName.Text = "Hi... " + Session["ReceptionistName"].ToString() + ", "
+ " User-Id:- " + Session["ReceptionistId"].ToString();
}
}
protected void BtnRecord_Click1(object sender, EventArgs e)
{
if (Page.IsValid)
{
string RecordType = ddlReportType.SelectedItem.ToString();
DataTable TempDt = new DataTable();
TempDt.Columns.Add("GuestId");
switch (RecordType)
{
case "Daily":
{
string d1 = ddldd.Text + "/" + ddlmm.Text + "/" + ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckInDate like '%" + d1 + "%'", SqlCon);

DataSet ds = new DataSet();


Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
DataTable CheckDt = ds.Tables[0];
int i = 0, j = 0;
Boolean IsMatched = false;
if (row != 0)
{
foreach (DataRow dr1 in dt.Rows)
{
string PriviousGuestId = dt.Rows[i][4].ToString();
j = 0;
if (i != 0)
{
foreach (DataRow dr in CheckDt.Rows)
{
string CurrentGuestId = CheckDt.Rows[j][4].ToString();
if (PriviousGuestId == CurrentGuestId)
{
if (i == j)
{
break;
}
IsMatched = true;
}
j = j + 1;

}
}
if (!IsMatched)
{
DataRow NewDr = TempDt.NewRow();
NewDr["GuestId"] = PriviousGuestId;
TempDt.Rows.Add(NewDr);
TempDt.AcceptChanges();
ViewState["TempDt"] = TempDt;
}
IsMatched = false;
i = i + 1;
}
int GetRows = TempDt.Rows.Count;

}
else

{
lblmessage.Text = "Record Not Found...!!!";
GrdCheckInGuestDetails.DataSource = null;
GrdCheckInGuestDetails.DataBind();
}
}
break;
case "Monthly":
{
string d2 = ddlmm.Text + "/" + ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckInDate like '%" + d2 + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
DataTable CheckDt = ds.Tables[0];
int i = 0, j = 0;
Boolean IsMatched = false;
if (row != 0)
{
foreach (DataRow dr1 in dt.Rows)
{
string PriviousGuestId = dt.Rows[i][4].ToString();
j = 0;
if (i != 0)
{
foreach (DataRow dr in CheckDt.Rows)
{
string CurrentGuestId = CheckDt.Rows[j][4].ToString();
if (PriviousGuestId == CurrentGuestId)
{
if (i == j)
{
break;
}
IsMatched = true;
}
j = j + 1;

}
}
if (!IsMatched)
{

DataRow NewDr = TempDt.NewRow();


NewDr["GuestId"] = PriviousGuestId;
TempDt.Rows.Add(NewDr);
TempDt.AcceptChanges();
ViewState["TempDt"] = TempDt;
}
IsMatched = false;
i = i + 1;
}
int GetRows = TempDt.Rows.Count;
}
else
{
lblmessage.Text = "Record Not Found...!!!";
GrdCheckInGuestDetails.DataSource = null;
GrdCheckInGuestDetails.DataBind();
}
}
break;
case "Yearly":
{
string d3 = ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckInDate like '%" + d3 + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
DataTable CheckDt = ds.Tables[0];
int i = 0, j = 0;
Boolean DataLoaded = false;
Boolean Execute = false;
Boolean IsMatched = false;
if (row != 0)
{
foreach (DataRow dr in dt.Rows)
{
DataTable MyTable = (DataTable)ViewState["TempDt"];
if (Execute)
{
int LoadedDataRow = MyTable.Rows.Count;
}
if (DataLoaded)
{

j = 0;
foreach (DataRow dr1 in MyTable.Rows)
{
string GuestId = dt.Rows[i][4].ToString();
string GuestIdTemp = MyTable.Rows[j][0].ToString();
if (GuestId == GuestIdTemp)
{
IsMatched = true;
}
j = j + 1;
}
if (!IsMatched)
{
DataRow NewDr = TempDt.NewRow();
NewDr["GuestId"] = dt.Rows[i][4].ToString();
TempDt.Rows.Add(NewDr);
TempDt.AcceptChanges();
ViewState["TempDt"] = TempDt;
Execute = true;

}
}
else
{
DataRow NewDr = TempDt.NewRow();
NewDr["GuestId"] = dt.Rows[0][4].ToString();
TempDt.Rows.Add(NewDr);
TempDt.AcceptChanges();
ViewState["TempDt"] = TempDt;
Execute = true;
}
DataLoaded = true;
i = i + 1;
IsMatched = false;
}
}
else
{
lblmessage.Text = "Record Not Found...!!!";
GrdCheckInGuestDetails.DataSource = null;
GrdCheckInGuestDetails.DataBind();
}
}
break;
default:
{

}
break;
}
// ViewState["TempDt"] = TempDt;
DataTable ResultTable = new DataTable();
ResultTable.Columns.Add("Name");
ResultTable.Columns.Add("DOB");
ResultTable.Columns.Add("Gender");
ResultTable.Columns.Add("MobileNo");
ResultTable.Columns.Add("IdType");
ResultTable.Columns.Add("IdNo");
ResultTable.Columns.Add("State");
ResultTable.Columns.Add("PinNo");
ResultTable.Columns.Add("GuestId");
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from GuestDetails ",
SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, "GuestDetails");
DataTable dt1 = ds1.Tables[0];
int row1 = dt1.Rows.Count;
DataTable MyResultTable = (DataTable)ViewState["TempDt"];
//int RowData = MyResultTable.Rows.Count;
if (row1 != 0 && MyResultTable != null)
{
int i = 0, j = 0;
foreach (DataRow dr in MyResultTable.Rows)
{
i = 0;
foreach (DataRow dr1 in dt1.Rows)
{
if (MyResultTable.Rows[j][0].ToString() == dt1.Rows[i][14].ToString())
{
DataRow NewDR = ResultTable.NewRow();
NewDR["Name"] = dt1.Rows[i][0].ToString();
NewDR["DOB"] = dt1.Rows[i][2].ToString();
NewDR["Gender"] = dt1.Rows[i][3].ToString();
NewDR["MobileNo"] = dt1.Rows[i][5].ToString();
NewDR["IdType"] = dt1.Rows[i][7].ToString();
NewDR["IdNo"] = dt1.Rows[i][8].ToString();
NewDR["State"] = dt1.Rows[i][11].ToString();
NewDR["PinNo"] = dt1.Rows[i][12].ToString();
NewDR["GuestId"] = dt1.Rows[i][14].ToString();
ResultTable.Rows.Add(NewDR);
ResultTable.AcceptChanges();

ViewState["ResultTable"] = ResultTable;
}
i = i + 1;
}
j = j + 1;
}
lblmessage.Text = " Total " + ResultTable.Rows.Count.ToString() + " Guest(s)
Records found....!!!";
GrdCheckInGuestDetails.DataSource = ResultTable;
GrdCheckInGuestDetails.DataBind();
}
else
{
lblmessage.Text = "Guest Records not Found.......!!!!!";
}
}
}
protected void ddlReportType_SelectedIndexChanged(object sender, EventArgs e)
{
string ReportType = ddlReportType.SelectedItem.ToString();
switch (ReportType)
{
case "Daily":
{
ddldd.Enabled = true;
ddlmm.Enabled = true;
ddlyyyy.Enabled = true;
}
break;
case "Monthly":
{
ddldd.Enabled = false;
ddlmm.Enabled = true;
ddlyyyy.Enabled = true;
}
break;
case "Yearly":
{
ddldd.Enabled = false;
ddlmm.Enabled = false;
ddlyyyy.Enabled = true;
}
break;
}
}

protected void BntOk_Click(object sender, EventArgs e)


{
GrdCheckInGuestDetails.DataSource = null;
GrdCheckInGuestDetails.DataBind();
lblmessage.Text = "";
}
protected void CustomValidator1_ServerValidate(object source,
ServerValidateEventArgs args)
{
if (ddldd.Enabled)
{
if (ddldd.SelectedItem.ToString() == "Day")
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
else
{
args.IsValid = true;
}

}
protected void CustomValidator2_ServerValidate(object source,
ServerValidateEventArgs args)
{
if (ddlmm.Enabled)
{
if (ddlmm.SelectedItem.ToString() == "Month")
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
else
{
args.IsValid = true;
}
}
}
}

Deleterooms.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Receptionist
{
public partial class DeleteRoom : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["ReceptionistId"] != null && Session["ReceptionistName"] != null)
{
Session["ReceptionistName"] = Session["ReceptionistName"].ToString();
Session["ReceptionistId"] = Session["ReceptionistId"].ToString();
lblShowingName.Text = "Hi... " + Session["ReceptionistName"].ToString() + ", "
+ " User-Id:- " + Session["ReceptionistId"].ToString();
}
if (!IsPostBack)
{
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Room ", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Room");
DataTable dt = ds.Tables[0];
int Room = dt.Rows.Count;
if (Room != 0)
{
GrdRooms.DataSource = ds;
GrdRooms.DataBind();
}
else
{
lblmessage.Text = "Not Available Room";
}
}
}

protected void DeleteRoom_Click(object sender, EventArgs e)


{
Button DeleteRoom = (Button)sender;
GridViewRow row = (GridViewRow)DeleteRoom.Parent.Parent;
Label lblRoomNo = (Label)row.FindControl("lblRoomNo");
string RoomNo = lblRoomNo.Text;
Session["RoomNo"] = RoomNo;
Response.Redirect("~/Receptionist/DeleteSelectedRoom.aspx");
}
}
}
Deleteselectedroom.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace HotelManagementSystem.Receptionist
{
public partial class DeleteSelectedRoom : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["ReceptionistId"] != null && Session["ReceptionistName"] != null)
{
Session["ReceptionistName"] = Session["ReceptionistName"].ToString();
Session["ReceptionistId"] = Session["ReceptionistId"].ToString();
lblShowingName.Text = "Hi... " + Session["ReceptionistName"].ToString() + ", "
+ " User-Id:- " + Session["ReceptionistId"].ToString();
}
if (!IsPostBack)
{
if (Session["RoomNo"] != null)
{
string RoomNo = Session["RoomNo"].ToString();
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Room where
RoomNo='" + RoomNo + "'", SqlCon);

DataSet ds = new DataSet();


Sqd.Fill(ds, "Room");
DataTable dt = ds.Tables[0];
int Room = dt.Rows.Count;
if (Room != 0)
{
GrdSelectedRoom.DataSource = ds;
GrdSelectedRoom.DataBind();
}
else
{
lblmessage.Text = "Room No Could not be selected!!!";
}
}
else
{
lblmessage.Text = "First select the room for deletion";
}
}
}
protected void DeleteRoom_Click(object sender, EventArgs e)
{
string SelectedRoomNo = Session["RoomNo"].ToString();
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from Room where
RoomNo='" + SelectedRoomNo + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, "Room");
DataTable dt = ds.Tables[0];
int room = dt.Rows.Count;
if (room != 0)
{
foreach (DataRow dr in dt.Rows)
{
//ds.Tables[0].Rows[0].Delete();
dr.Delete();
SqlCommandBuilder cb = new SqlCommandBuilder(Sqd);
Sqd.Update(dt);
break;
}
GrdSelectedRoom.DataSource = null;
GrdSelectedRoom.DataBind();
lblmessage.Text = "Room Is Deleted...........!!!!!!!";
btnCancel.Text = "Back";

}
else
{
lblmessage.Text = "First select a room..........!!!!!!";
}
}
protected void btnCancel_Click(object sender, EventArgs e)
{
if (Session["ComeBack"] == null)
{
if (Session["BackToUpdate"] != null)
{
Response.Redirect("~/Receptionist/UpdateRoom.aspx");
}
else
{
Response.Redirect("~/Receptionist/DeleteRoom.aspx");
}
}
else
{
Response.Redirect("~/Admin/AddingRoom.aspx");
}
}
}
}
Guest report.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
using System.Globalization;
namespace HotelManagementSystem.Receptionist
{
public partial class CustomerReports : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

if (Session["ReceptionistId"] != null && Session["ReceptionistName"] != null)


{
Session["ReceptionistName"] = Session["ReceptionistName"].ToString();
Session["ReceptionistId"] = Session["ReceptionistId"].ToString();
lblShowingName.Text = "Hi... " + Session["ReceptionistName"].ToString() + ", "
+ " User-Id:- " + Session["ReceptionistId"].ToString();
}
}
protected void BtnRecord_Click1(object sender, EventArgs e)
{
if (Page.IsValid)
{
string GuestType = ddlGuestType.SelectedItem.ToString();
string RepotrType = ddlReportType.SelectedItem.ToString();
if (GuestType == "Check-In-Date")
{
switch (RepotrType)
{
case "Daily":
{
string d1 = ddldd.Text + "/" + ddlmm.Text + "/" + ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckInDate like '%" + d1 + "%'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row >= 0)
{
lblmessage.Text = row.ToString() + "---Report(s) Found...!!!";
GRDBookedRoom.DataSource = ds;
GRDBookedRoom.DataBind();
}
else
{
lblmessage.Text = "Record Not Found...!!!";
}
}
break;
case "Monthly":
{
string d2 = ddlmm.Text + "/" + ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckInDate like '%" + d2 + "'", SqlCon);

DataSet ds = new DataSet();


Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row >= 0)
{
lblmessage.Text = row.ToString() + "---Report(s) Found...!!!";
GRDBookedRoom.DataSource = ds;
GRDBookedRoom.DataBind();
}
else
{
lblmessage.Text = "Record Not Found...!!!";
}
}
break;
case "Yearly":
{
string d3 = ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckInDate like '%" + d3 + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row >= 0)
{
lblmessage.Text = row.ToString() + "---Report(s) Found...!!!";
GRDBookedRoom.DataSource = ds;
GRDBookedRoom.DataBind();
}
else
{
lblmessage.Text = "Record Not Found...!!!";
}
}
break;
default:
{
}
break;
}
}
else
{
switch (RepotrType)

{
case "Daily":
{
string d4 = ddldd.Text + "/" + ddlmm.Text + "/" + ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckOutDate like '%" + d4 + "%'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row >= 0)
{
lblmessage.Text = row.ToString() + "---Report(s) Found...!!!";
GRDBookedRoom.DataSource = ds;
GRDBookedRoom.DataBind();
}
else
{
lblmessage.Text = "";
lblmessage.Text = "Record Not Found...!!!";
}
}
break;
case "Monthly":
{
string d5 = ddlmm.Text + "/" + ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckOutDate like '%" + d5 + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row >= 0)
{
lblmessage.Text = row.ToString() + "---Report(s) Found...!!!";
GRDBookedRoom.DataSource = ds;
GRDBookedRoom.DataBind();
}
else
{
lblmessage.Text = "Record Not Found...!!!";
}
}
break;
case "Yearly":

{
string d6 = ddlyyyy.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from
BookedRooms where CheckOutDate like '%" + d6 + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " BookedRooms");
DataTable dt = ds.Tables[0];
int row = dt.Rows.Count;
if (row >= 0)
{
lblmessage.Text = row.ToString() + "---Report(s) Found...!!!";
GRDBookedRoom.DataSource = ds;
GRDBookedRoom.DataBind();
}
else
{
lblmessage.Text = "Record Not Found...!!!";
}
}
break;
default:
{
}
break;
}
}
}
}
protected void BtnShowPaymentDetails_Click(object sender, EventArgs e)
{
Button BtnShowPaymentDetails = (Button)sender;
GridViewRow row = (GridViewRow)BtnShowPaymentDetails.Parent.Parent;
Label lblBookingId = (Label)row.FindControl("lblBookingId");
Label LblCheckInDate = (Label)row.FindControl("LblCheckInDate");
Label LblCheckOutDate = (Label)row.FindControl("LblCheckOutDate");
string CheckIn = LblCheckInDate.Text;
string CheckOut = LblCheckOutDate.Text;
string BookingId = lblBookingId.Text;
PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from BookedRooms where
GuestId='" + BookingId + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " BookedRooms");

DataTable dt = ds.Tables[0];
int rows = dt.Rows.Count;
if (rows > 0)
{
PathStringClass path1 = new PathStringClass();
string DatabasePath1 = path1.Get_path();
SqlConnection SqlCon1 = new SqlConnection(DatabasePath1);
SqlDataAdapter Sqd1 = new SqlDataAdapter("select * from PaymentDetails
where GuestId='" + BookingId + "'", SqlCon1);
DataSet ds1 = new DataSet();
Sqd1.Fill(ds1, " PaymentDetails");
DataTable dt1 = ds1.Tables[0];
int rows1 = dt1.Rows.Count;
if (rows1 > 0)
{
PathStringClass path2 = new PathStringClass();
string DatabasePath2 = path2.Get_path();
SqlConnection SqlCon2 = new SqlConnection(DatabasePath2);
SqlDataAdapter Sqd2 = new SqlDataAdapter("select * from BookedRooms
where CheckInDate='" + CheckIn + "' and CheckOutDate='" + CheckOut + "'",
SqlCon2);
DataSet ds2 = new DataSet();
Sqd2.Fill(ds2, " BookedRooms");
DataTable dt2 = ds2.Tables[0];
int row2 = dt2.Rows.Count;
if (row2 > 0)
{
GRDBookedRoom.DataSource = ds2;
GRDBookedRoom.DataBind();
}
lblmessage.Text = "";
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GRDPaymentDetailsFromRecepTionist.DataSource = null;
GRDPaymentDetailsFromRecepTionist.DataBind();
GRDPaymentDetailsFromGuest.DataSource = ds1;
GRDPaymentDetailsFromGuest.DataBind();
}
else
{
lblmessage.Text = "Payment Report Not Found...!!!";
}

}
else
{
PathStringClass path3 = new PathStringClass();
string DatabasePath3 = path3.Get_path();
SqlConnection SqlCon3 = new SqlConnection(DatabasePath3);

SqlDataAdapter Sqd3 = new SqlDataAdapter("select * from


PaymentsFromReceptionist where BookingId='" + BookingId + "'", SqlCon3);
DataSet ds3 = new DataSet();
Sqd3.Fill(ds3, " PaymentsFromReceptionist");
DataTable dt3 = ds3.Tables[0];
int rows3 = dt3.Rows.Count;
if (rows3 > 0)
{
PathStringClass path2 = new PathStringClass();
string DatabasePath2 = path2.Get_path();
SqlConnection SqlCon2 = new SqlConnection(DatabasePath2);
SqlDataAdapter Sqd2 = new SqlDataAdapter("select * from BookedRooms
where CheckInDate='" + CheckIn + "' and CheckOutDate='" + CheckOut + "'",
SqlCon2);
DataSet ds2 = new DataSet();
Sqd2.Fill(ds2, " BookedRooms");
DataTable dt2 = ds2.Tables[0];
int row2 = dt2.Rows.Count;
if (row2 > 0)
{
GRDBookedRoom.DataSource = ds2;
GRDBookedRoom.DataBind();
}
lblmessage.Text = "";
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GRDPaymentDetailsFromGuest.DataSource = null;
GRDPaymentDetailsFromGuest.DataBind();
GRDPaymentDetailsFromRecepTionist.DataSource = ds3;
GRDPaymentDetailsFromRecepTionist.DataBind();
}
else
{
lblmessage.Text = "Payment Report Not Found...!!!";
}
}

}
protected void btnShowGuestDetails_Click(object sender, EventArgs e)
{
Button btnShow = (Button)sender;
GridViewRow row = (GridViewRow)btnShow.Parent.Parent;
Label LblGuestId = (Label)row.FindControl("LblGuestId");
Label LblCheckInDate = (Label)row.FindControl("LblCheckInDate");
Label LblCheckOutDate = (Label)row.FindControl("LblCheckOutDate");
string CheckIn = LblCheckInDate.Text;
string CheckOut = LblCheckOutDate.Text;

string GuestId = LblGuestId.Text;


PathStringClass path = new PathStringClass();
string DatabasePath = path.Get_path();
SqlConnection SqlCon = new SqlConnection(DatabasePath);
SqlDataAdapter Sqd = new SqlDataAdapter("select * from GuestDetails where
GuestId='" + GuestId + "'", SqlCon);
DataSet ds = new DataSet();
Sqd.Fill(ds, " GuestDetails");
DataTable dt = ds.Tables[0];
int rows = dt.Rows.Count;
if (rows != 0)
{
PathStringClass path2 = new PathStringClass();
string DatabasePath2 = path2.Get_path();
SqlConnection SqlCon2 = new SqlConnection(DatabasePath2);
SqlDataAdapter Sqd2 = new SqlDataAdapter("select * from BookedRooms
where CheckInDate='" + CheckIn + "' and CheckOutDate='" + CheckOut + "'",
SqlCon2);
DataSet ds2 = new DataSet();
Sqd2.Fill(ds2, " BookedRooms");
DataTable dt2 = ds2.Tables[0];
int row2 = dt2.Rows.Count;
if (row2 > 0)
{
GRDBookedRoom.DataSource = ds2;
GRDBookedRoom.DataBind();
}
lblmessage.Text = "";
GRDPaymentDetailsFromGuest.DataSource = null;
GRDPaymentDetailsFromGuest.DataBind();
GRDPaymentDetailsFromRecepTionist.DataSource = null;
GRDPaymentDetailsFromRecepTionist.DataBind();
GrdGuestDetails.DataSource = ds;
GrdGuestDetails.DataBind();
}
else
{
lblmessage.Text = "Record not found";
}
}
protected void btnClosePaymentDetailsFromGuest_Click(object sender, EventArgs e)
{
lblmessage.Text = "";
GRDPaymentDetailsFromGuest.DataSource = null;
GRDPaymentDetailsFromGuest.DataBind();
}

protected void btnClosePaymentDetailsFromReceptionist_Click(object sender,


EventArgs e)
{
lblmessage.Text = "";
GRDPaymentDetailsFromRecepTionist.DataSource = null;
GRDPaymentDetailsFromRecepTionist.DataBind();
}
protected void CloseAllReports_Click(object sender, EventArgs e)
{
lblmessage.Text = "";
GRDBookedRoom.DataSource = null;
GRDBookedRoom.DataBind();
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
GRDPaymentDetailsFromGuest.DataSource = null;
GRDPaymentDetailsFromGuest.DataBind();
GRDPaymentDetailsFromRecepTionist.DataSource = null;
GRDPaymentDetailsFromRecepTionist.DataBind();
}
protected void CloseGuestDetails_Click(object sender, EventArgs e)
{
lblmessage.Text = "";
GrdGuestDetails.DataSource = null;
GrdGuestDetails.DataBind();
}
protected void ddlReportType_SelectedIndexChanged(object sender, EventArgs e)
{
string ReportType = ddlReportType.SelectedItem.ToString();
switch (ReportType)
{
case "Daily":
{
ddldd.Enabled = true;
ddlmm.Enabled = true;
ddlyyyy.Enabled = true;
}
break;
case "Monthly":
{
ddldd.Enabled = false;
ddlmm.Enabled = true;
ddlyyyy.Enabled = true;
}
break;
case "Yearly":
{
ddldd.Enabled = false;
ddlmm.Enabled = false;

ddlyyyy.Enabled = true;
}
break;
}
}
protected void CustomValidator1_ServerValidate(object source,
ServerValidateEventArgs args)
{
if (ddldd.Enabled)
{
if (ddldd.SelectedItem.ToString() == "Day")
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
else
{
args.IsValid = true;
}

}
protected void CustomValidator2_ServerValidate(object source,
ServerValidateEventArgs args)
{
if (ddlmm.Enabled)
{
if (ddlmm.SelectedItem.ToString() == "Month")
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
else
{
args.IsValid = true;
}
}
protected void CustomValidator3_ServerValidate(object source,
ServerValidateEventArgs args)

{
if (ddlReportType.SelectedItem.ToString() == "Select")
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
}
}
Logout.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace HotelManagementSystem.Receptionist
{
public partial class LogOut : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Session.Abandon();
Session.Clear();
Response.Redirect("~/Account/ReceptionistLogin.aspx");
}
}

Вам также может понравиться