You are on page 1of 58

SIX WEEKS TRAINING REPORT (June-July, 2012)

HOTEL MANAGEMENT SYSTEM (Mini Project)

Submitted by Name : Santosh Kumar Panda Registration Number : 10906666 Programme Name B.Tech CSE(AIEEE) Section K2R01

Under the Guidance of MR. SRIKANT KUMAR,

School of Science and Technology Lovely Professional University, Phagwara

SIX WEEKS TRAINING REPORT (June-July, 2012)

HOTEL MANAGEMENT SYSTEM (Mini Project)

Submitted by Name : Santosh Kumar Panda Registration Number : 10906666 Programme Name B.Tech CSE(AIEEE) Section K2R01

Under the Guidance of MR. SRIKANT KUMAR,

School of Science and Technology Lovely Professional University, Phagwara

DECLARATION I hereby declare that I have completed my six weeks summer training at APTECH PARADEEP from 26/05/12 to 03/07/12 under the guidance of Mr Srikant Kumar. I have worked with full dedication during these six weeks of training and my learning outcomes fulfill the requirements of training for the award of degree of B.Tech CSE, Lovely Professional University, Phagwara.

SANTOSH KUAMAR PANDA 10906666

Date: 7th August 2012

Acknowledgement
I take this opportunity to present my votes of thanks to all those guidepost who really acted as lightening pillars to enlighten our way throughout this term paper that has led to successful and satisfactory completion of this study. I am really grateful to my C# Mentor Mr Srikant Kumar for providing me with an opportunity to undertake this project and providing me with all the facilities. I am highly thankful for his active support, valuable time and advice, whole-hearted guidance, sincere cooperation and pains-taking involvement during the study and in completing the said project within the stipulated time. Lastly, I am thankful to all those, particularly my friends, who have been instrumental in creating proper, healthy and conductive environment and including new and fresh innovative ideas for me during this, their help, it would have been extremely difficult for me to prepare this in a time bound framework.

Contents
Organisational Overview......................................................................................................................... 8 Type of Organisation ........................................................................................................................... 8 Specialisation of Work Culture ........................................................................................................... 8 Location............................................................................................................................................... 8 Profile of the Problem ............................................................................................................................. 9 Existing System ..................................................................................................................................... 10 Problem Analysis ................................................................................................................................... 11 Product Definition: ............................................................................................................................ 11 Feasibility Analysis: ........................................................................................................................... 11 Software Requirement Analysis ............................................................................................................ 11 Tables & Their Relationships ................................................................................................................. 12 Table 1-CurrentCustomer (CurCust) ................................................................................................. 12 Table 2- OldCustomer (OldCust) ....................................................................................................... 13 Table 3- Staffs ................................................................................................................................... 14 Table 4- Rooms ................................................................................................................................. 15 Source Codes & Screen Shots ............................................................................................................... 16 Admin Login ...................................................................................................................................... 16 Home Page ........................................................................................................................................ 18 Add Rooms ........................................................................................................................................ 21 Add Staffs .......................................................................................................................................... 24 Check-In ............................................................................................................................................ 28 Check-Out ......................................................................................................................................... 32 Business Logic Class for HMS ............................................................................................................ 36 Present Customers ............................................................................................................................ 39 Old Customers................................................................................................................................... 41 Check Booked Rooms........................................................................................................................ 43 Check Available Rooms ..................................................................................................................... 45 Delete Staffs ...................................................................................................................................... 47 Current Staffs .................................................................................................................................... 49 Old Staffs ........................................................................................................................................... 51

Bill...................................................................................................................................................... 53 Gantt-Chart ........................................................................................................................................... 56 Project Chart of HMS ........................................................................................................................ 56 Time Line ........................................................................................................................................... 56 Milestone .......................................................................................................................................... 56 Distribution of the Implementation Part .......................................................................................... 57 Project-Chart of Implementation...................................................................................................... 57 Time Line ........................................................................................................................................... 57 Project Legacy ....................................................................................................................................... 58 Bibliography .......................................................................................................................................... 58

Organisational Overview
Type of Organisation Aptech commenced its education and training business in 1986 and has globally trained over 6.4 million students. Aptech is an ISO 9001:2000 organization and the first IT Training and Education company to get this certification for Education Support Services in 1993. Aptech has presence in more than 40+ emerging countries through its two main streams of businesses Individual training and Enterprise Business. As a leader in career education, it has over 1305 centres of learning across the world. Under Individual Training, Aptech offers career and professional training through its Aptech Computer Education, Arena Animation & Maya Academy of Advanced Cinematic (both in Animation & Multimedia), Aptech Hardware & Networking Academy, Aptech Aviation & Hospitality Academy and Aptech English Learning Academy brands. Enterprise business includes Content Development (Aptech Learning Services), Training and Assessment Solutions for Corporates & Institutions (Aptech Training Solutions, Aptech Assessment & Testing Solutions).

Specialisation of Work Culture IT & Multimedia education pioneer. More than 2 decades of experience in training (since 1986). Trained over 6.4 million students. First IT education & training company in Asia to receive the ISO 9001: 2000 quality certifications. Aptech Learning Services receives two Apex 2010 - Awards for Excellence. Aptech Vietnam declared No. 1 IT training provider in Vietnam for 7 consecutive years. Among Brand Equitys Top 50 Most Trusted Service Brands. Among Forbes Global Best 300 Small Companies worldwide. Location As stated above APTECH has its 1305 centre over 35 Countries and I am really privileged to have completed my training from one of its centre located at PARADEEP.

Profile of the Problem


The Hotel Management System (HMS) Application developed by me performs all the basic functionalities that is deserved to be in a HMS. The Authorised User (Admin), after logging in can perform various functions like: Checking-In Customers Checking-Out Customers Adding Staffs Details Adding Room Details Viewing/Searching Present Customers Viewing/Searching Old Customers Checking Room Status Viewing Available or Booked Room in a Single Dedicated GUI Viewing Details about the Present/Old Staffs Other than the above mentioned tasks its extremely use friendly GUI elaborates itself and doesnt complicates unnecessary things.

Existing System
Hotel Management System as the name goes is used to facilitate the easy on goings or transaction in the hotels. It must contain all the features that is necessary to maintain all the management and transactional details going on in the Hotel. While taking an overview how to proceed with my project I have gone through a number of Hotel Managing Software Packages and I find a number of them just having the interface for Checking -In & CheckingOut Customers, but they lack a full-fledged Managing Tool which can help them to maintain other essential details like the Staffs and Rooms. It is a common experience that whenever we go to book a room (at the backend) the receptionist opens the Customer List to check which Rooms are Booked & which are Available, this a tedious & unnecessary event and should be avoided, the managing tool must itself detect the Rooms that are Booked & Available and the Available Rooms of the desired type must be displayed to the Customer. All the above mentioned problems are taken care of while designing the Hotel Management System that we are going to review in the following pages.

Problem Analysis
Product Definition: The Hotel Management System discussed below is one of the prime of its kind, though a little attention is given on the designing part, it can perform all the functions that can be done by any other Managing System of its kind. Special attention has been given to view every detail in different pages which makes the task of the user a lot easier to find every detailed and related information he is looking for. The various features of the Hotel Management System (HMS) that it contains a Login Interface which allows only the authorised user to have access to the system. After gaining access to the system (Tool) the User can offer Check-in or Check-out facilities for his Customers. A new feature that is the centre attraction of the HMS that it also allows the user to Add Staffs and Delete Staffs, and to view the details of various staffs working there and their respective Department. Different interfaces are provided to view the details of the Current Staffs & Old Staffs. Same feature is also provided for the Customers. One can view the Present Customers & Old Customers who had ever used the services of the Hotel. Another important aspect of the HMS is that it even allows the Admin (Authorised User) to add details about various Rooms like the Room-No & the Room-Type and Admin can also check weather a Room is Booked or Available.

Feasibility Analysis: Now talking about the Feasibility Analysis of the Project HMS, it has been completed with outmost ease and taking care of basic knowledge of C# and DBMS. It doesnt need to be a Programming nerd to understand the codes; one has to be good at basics to be able to understand the codes. Thus its feasibility is not an issue and taking into consideration its self-descriptive GUI a layman with basic knowledge of computers can use the HMS with ease.

Software Requirement Analysis


To be able to run HMS without any hiccups the users system need to attend the following requirements. MICROSOFT VISUAL STUDIO 2010 MICROSOFT SQL SERVER DENALI MICROSOFT WINDOWS VISTA /7/8

Tables & Their Relationships


Table 1-CurrentCustomer (CurCust)

In the above table we have used Room-No as Primary Key because no 2 Current Customers can be given same Room at a time, though this functionality is also checked programmatically, but the Primary Key functionality adds an extra layer of check. This table is used to save all the details about the Customers Currently staying at the Hotel.

Table 2- OldCustomer (OldCust)

The above table as the name goes Old Customer is used to save all the details of the Old Customers who had ever used the facilities of the Hotel. The design of the table is kept same as that of the CurCust with only an extra column Checkout which saves the checkout date of the user.

Table 3- Staffs

The above table saves the details of the staffs at the Hotel. It also saves related data about the staffs like their Department, Designation, Salary, Employee id and another field Present Staffs is added to check whether the staff is currently working at the hotel, if this field is set to 1 then the staff is working or else it shows that the staff had left the Hotel, it basically helps us in differentiating between Current & Old staffs.

As discussed above this table is used to store information about the staffs currently working at the hotel and various related information about that particular staff. It is very well evident that to access information about the staffs all we need is go through the table. Thus it serves at as a one point access to any information regarding the staffs, it has also provided particular E_id to the employees which can be used to search information about employees with particular E_id.

Table 4- Rooms

The above table is used to save information about the Rooms that are available in the hotel, it saves information like the Room No, Room Type, Charge/night and the booking status of the Room i.e. weather the Room is Booked or not. It proves helpful at times while searching weather a particular kind of Room is available or not.

If the Booked status of the Room is enabled it means that the Room is Booked and the user have to choose a different Room for the Customer. Thus this table indeed makes it easier to have direct access to the related information about the Rooms.

Source Codes & Screen Shots


Admin Login

/* This Code is used to allow access only to the authorised users*/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;

namespace HMS { public partial class Form1 : Form { public Form1() { InitializeComponent(); }

private void Login_Click(object sender, EventArgs e) { if (txtName.Text == "Admin") { if (txtPass.Text == "santy") { MessageBox.Show("Login successful", "Login"); Home a = new Home(); Form1.ActiveForm.Visible = false; a.Show(); } else MessageBox.Show("Wrong Password");

} else { MessageBox.Show("Wrong Username"); } } } }

Home Page

/* This GUI allows the user to have access to all operations from a single window, it simply redirects the user to the desired window to carry out the desired operation*/

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace HMS { public partial class Home : Form { public Home() { InitializeComponent(); } private void bookRoomToolStripMenuItem_Click(object sender, EventArgs e)

{ BookRoom br = new BookRoom(); br.Show();

} private void checkRoomsToolStripMenuItem_Click(object sender, EventArgs e) { ChkOut c = new ChkOut(); c.Show(); } private void addRoomsToolStripMenuItem_Click(object sender, EventArgs e) { AddRooms ad = new AddRooms(); ad.Show(); } private void bookedToolStripMenuItem_Click(object sender, EventArgs e) { CheeckRoom c = new CheeckRoom(); c.Show(); } private void availableToolStripMenuItem_Click(object sender, EventArgs e) { AvailableRooms ar = new AvailableRooms(); ar.Show(); } private void presentCustomersToolStripMenuItem_Click(object sender, EventArgs e) { Present_Customers pc = new Present_Customers(); pc.Show(); }

private void oldCustomersToolStripMenuItem_Click(object sender, EventArgs e) { OldCustomers oc = new OldCustomers();

oc.Show(); } private void addStaffToolStripMenuItem_Click(object sender, EventArgs e) { AddStaffs a = new AddStaffs(); a.Show(); } private void curerntStaffsToolStripMenuItem_Click(object sender, EventArgs e) { CurrentStaffs cs = new CurrentStaffs(); cs.Show(); } private void deleteStaffToolStripMenuItem_Click(object sender, EventArgs e) { DeleteStaffs ds = new DeleteStaffs(); ds.Show(); } private void viewDetailsToolStripMenuItem_Click(object sender, EventArgs e) { All_Staffs all=new All_Staffs(); all.Show(); } private void oldStaffsToolStripMenuItem_Click(object sender, EventArgs e) { OldStaffs os = new OldStaffs(); os.Show(); } private void Home_Load(object sender, EventArgs e) { menuStrip1.ForeColor = System.Drawing.Color.Azure; menuStrip1.BackColor = System.Drawing.Color.Coral; } } }

Add Rooms

/* This page allows us to add Rooms related information like the Room-No, Room-Type and the Rental Charges to the Database */

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient;

namespace HMS { public partial class AddRooms : Form {

public AddRooms() { InitializeComponent(); } hotel h = new hotel(); private void button1_Click(object sender, EventArgs e) { if (txtRn.Text != "" || cmbRt.Text != "" || cmbCost.Text != "") { if (h.validate(txtRn.Text, 1) && h.validate(cmbRt.Text, 0) && h.validate(cmbCost.Text, 1)) { string hi = "insert into Rooms values('" + Convert.ToInt16(txtRn.Text) + "','" + cmbRt.Text + "','" + Convert.ToInt32(cmbCost.Text) + "','"+Convert.ToString(0)+"')"; SqlDataReader dr = h.getvaluedr("select count(*) from Rooms where RoomNo='" + Convert.ToInt16(txtRn.Text) + "'"); dr.Read(); if (dr[0].ToString() == "0") { dr.Close(); int i = h.nonq(hi); if (i == 1) { MessageBox.Show("Room Added Successful"); } else { MessageBox.Show("Room Addition Failed"); }

} else MessageBox.Show("Room Already Present"); dr.Close();

} else MessageBox.Show("Fill All The Details"); } } private void cmbRt_SelectedIndexChanged(object sender, EventArgs e) { cmbCost.Items.Clear(); cmbCost.Text = ""; hotel h = new hotel(); SqlDataReader dt = h.getvaluedr("select DISTINCT(PerNight) from Rooms where RoomType='" + cmbRt.Text + "'"); while (dt.Read()) { cmbCost.Items.Add(dt[0]); } dt.Close(); } private void AddRooms_Load(object sender, EventArgs e) { hotel h = new hotel(); SqlDataReader dt = h.getvaluedr("select DISTINCT(RoomType) from Rooms"); while (dt.Read()) { cmbRt.Items.Add(dt[0]); } dt.Close(); } } }

Add Staffs

/* This page allows us to add Staffs to our database along with the related information like Department, Designation & Salary*/

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient;

namespace HMS { public partial class AddStaffs : Form { public AddStaffs() {

InitializeComponent(); } hotel h = new hotel(); private void button1_Click(object sender, EventArgs e) { if (txtName.Text != "" || cmbDesig.Text != "" || cmbSal.Text != "" || cmbDeprt.Text!="") { if (h.validate(txtName.Text, 0) && h.validate(cmbDesig.Text, 0) && h.validate(cmbSal.Text, 1) && h.validate(cmbDeprt.Text,0)) { string hi = "insert into Staffs values ('" + txtName.Text + "','"+ cmbDeprt.Text +"','" + cmbDesig.Text + "','" + Convert.ToInt64(cmbSal.Text) + "','"+Convert.ToInt16(1)+"')"; SqlDataReader sd = h.getvaluedr("select count(*) from Staffs where (Name='" + txtName.Text + "' AND Designation='" + cmbDesig.Text + "')"); sd.Read(); if (sd[0].ToString() == "0") { sd.Close(); int i = h.nonq(hi); if (i == 1) { MessageBox.Show("Member Added Successfully Please Check Your E_id"); button2.Visible = true;

} else { MessageBox.Show("Error Occured"); } } else

{ MessageBox.Show("Member already Present"); sd.Close(); } } } else {

MessageBox.Show("Fill All The Details", "Add Staffs"); } }

private void AddStaffs_Load(object sender, EventArgs e) { SqlDataReader d = h.getvaluedr("select DISTINCT(Department) from Staffs"); while (d.Read()) { cmbDeprt.Items.Add(d[0]); } d.Close(); }

private void cmbDesig_SelectedIndexChanged(object sender, EventArgs e) { cmbSal.Text = ""; cmbSal.Items.Clear(); SqlDataReader dd = h.getvaluedr("select DISTINCT(Salary) from Staffs where Designation='"+cmbDesig.Text+"'"); while (dd.Read()) { cmbSal.Items.Add(dd[0]); } dd.Close();

private void button2_Click(object sender, EventArgs e) { CurrentStaffs cs = new CurrentStaffs(); cs.Show();

private void cmbDeprt_SelectedIndexChanged(object sender, EventArgs e) { SqlDataReader d = h.getvaluedr("select DISTINCT(Designation) from Staffs"); while (d.Read()) { cmbDesig.Items.Add(d[0]); } d.Close(); } } }

Check-In

/* As the name goes this page provides us a GUI to Check-in various Customers and connects us to the database where we can store related information about them */

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient;

namespace HMS { public partial class BookRoom : Form {

public BookRoom() { InitializeComponent();

hotel hi=new hotel(); private void button1_Click(object sender, EventArgs e) {

if (txtName.Text != "" && txtMobNo.Text != "" && txtAddress.Text != "" && comboBox1.Text != "" && comboBox2.Text != "") { if (hi.validate(txtName.Text, 0) && hi.validate(txtMobNo.Text, 1) && hi.validate(comboBox1.Text, 1)) { if (txtMobNo.Text.Length == 10 || txtMobNo.Text.Length == 11 || txtMobNo.Text.Length == 13) { string nq = "insert into CurCust values ('"+txtName.Text+"','" + Convert.ToInt64(txtMobNo.Text) + "','"+txtAddress.Text+"','" + Convert.ToInt16(comboBox1.Text) + "','" + comboBox2.Text + "','" + txtChkIn.Text + "')"; hotel h = new hotel();

SqlDataReader rd = h.getvaluedr("select count(*) from CurCust where RoomNo='" + comboBox1.Text + "'"); rd.Read(); if (rd[0].ToString() == "0") { rd.Close(); int i = h.nonq(nq); if (i == 1)

{ string n = "update Rooms SET Booked='" + Convert.ToString(1) + "'where RoomNo='" + comboBox1.Text + "'"; int j = h.nonq(n); if (j == 1) { MessageBox.Show("Checked In Successfully..", "CheckIn"); } } else { MessageBox.Show("CheckIn Faillure", "CheckIn"); } } else { MessageBox.Show("Room Already Booked, Try Some Other Room"); rd.Close(); } } else { MessageBox.Show("Invalid Mobile Number"); } } } else { MessageBox.Show("Please Fill All The Details"); } } private void BookRoom_Load(object sender, EventArgs e) {

DateTime dt = DateTime.Now; txtChkIn.Text = dt.ToString("dd/MM/yyyy"); txtChkIn.Visible = false; hotel h = new hotel(); SqlDataReader sd = h.getvaluedr("select DISTINCT(RoomType) from Rooms WHERE Booked='"+Convert.ToInt16(0)+"'"); while (sd.Read()) { comboBox2.Items.Add(sd[0]); } } private void comboBox1_Leave(object sender, EventArgs e) { txtChkIn.Visible = true; label6.Visible = true; } private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { comboBox1.Items.Clear(); hotel hj = new hotel(); SqlDataReader dr = hj.getvaluedr("select RoomNo from Rooms WHERE RoomType='" + comboBox2.Text + "'AND Booked='"+Convert.ToInt16(0)+"'"); while (dr.Read()) { comboBox1.Items.Add(dr[0]); } } private void button2_Click(object sender, EventArgs e) { this.Close(); }

} }

Check-Out

/* This GUI helps us to manage the Check-out Details and Connects it to the table OldCust where the details regarding the Old Customers are saved */

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace HMS { public partial class ChkOut : Form { public ChkOut() { InitializeComponent();

txtRoomNo.LostFocus += new EventHandler(txtRoomNo_LostFocus);

} hotel hi = new hotel(); void txtRoomNo_LostFocus(object sender, EventArgs e) { if (txtRoomNo.Text != "") { if (hi.validate(txtRoomNo.Text, 1)) { SqlDataReader dr = hi.getvaluedr("select count(*) from CurCust where RoomNo='" + Convert.ToInt16(txtRoomNo.Text) + "'"); dr.Read(); if (dr[0].ToString() == "0") { MessageBox.Show("Enter Correct RoomNo"); btnVd.Visible = true; } else { button3.Visible = true; } dr.Close(); } } else MessageBox.Show("Enter A Room No"); } private void txtRoomNo_Leave(object sender, EventArgs e) { if (hi.validate(txtRoomNo.Text, 1)) { hotel h = new hotel(); SqlDataReader dr;

dr = h.getvaluedr("select * from CurCust where RoomNo=" + Convert.ToInt16(txtRoomNo.Text) + ""); if (dr.Read()) { txtName.Text = dr[0].ToString(); txtMobNo.Text = dr[1].ToString(); txtAddress.Text = dr[2].ToString(); txtRoomType.Text = dr[4].ToString(); txtCheckIn.Text = dr[5].ToString(); } dr.Close(); } } private void button1_Click(object sender, EventArgs e) { DateTime dt = DateTime.Now.Date; hotel h = new hotel(); SqlDataReader dr; //SqlDataReader ds; dr = h.getvaluedr("insert into OldCust values('" + txtName.Text + "','" + Convert.ToInt64(txtMobNo.Text) + "','" + txtAddress.Text + "','" + Convert.ToInt16(txtRoomNo.Text) + "','" + txtRoomType.Text + "','" + txtCheckIn.Text + "','" + dt.ToString() + "')"); MessageBox.Show("Checked Out Sucessfully"); dr.Close(); SqlDataReader dr1; dr1 = h.getvaluedr("update Rooms SET Booked='" + Convert.ToString(0) + "' where RoomNo='" + Convert.ToInt16(txtRoomNo.Text) + "'"); dr1.Read(); dr1.Close(); SqlDataReader ds; ds = h.getvaluedr("delete from CurCust where RoomNo=" + Convert.ToInt16(txtRoomNo.Text) + ""); ds.Read();

ds.Close(); }

private void button2_Click(object sender, EventArgs e) { this.Close(); } private void btnVd_Click(object sender, EventArgs e) { Present_Customers ps = new Present_Customers(); ps.Show(); } private void button3_Click(object sender, EventArgs e) { Bill b = new Bill(txtRoomNo.Text); b.Show(); button1.Visible = true; button2.Visible = true; } } }

Business Logic Class for HMS This class is a single encapsulation to define all the connection based and validation based queries that are to be used in more than one form and thus needed to be stored at a Global Scope for all the Forms.

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.SqlClient; using System.Data; using System.Windows.Forms; namespace HMS { class hotel { SqlConnection c = new SqlConnection(@"Data Source=SANTOSHPC\SQLEXPRESS;Initial Catalog=HOTEL;Integrated Security=True"); SqlCommand sc; SqlDataAdapter da; SqlDataReader dr; public hotel() {

} public bool validate(string name, int type) { int j = 0; if (type == 0) {

while (j < name.Length) {

char ch = name[j]; if ((int)ch >= 48 && (int)ch <= 57) { MessageBox.Show("Invalid Input"); break; } j++; } } else if (type == 1) { while (j < name.Length) { char ch = name[j]; if ((int)ch < 48 || (int)ch > 57) { MessageBox.Show("Invalid Input"); break; } j++; } } if (j >= name.Length) return true; else return false;

} public int nonq(string nq) { sc= new SqlCommand(nq,c); if(c.State==ConnectionState.Closed) c.Open();

return(sc.ExecuteNonQuery()); } public DataSet getvalds(string ds) { if (c.State == ConnectionState.Closed) c.Open(); da = new SqlDataAdapter(ds, c); DataSet rd = new DataSet(); da.Fill(rd, "temp"); c.Close(); return rd; } public SqlDataReader getvaluedr(string querry) { if (c.State == ConnectionState.Closed) c.Open(); sc = new SqlCommand(querry, c); dr = sc.ExecuteReader(); return dr; } } }

Present Customers

/* This page is just a bridge between the front-end & back-end and allows the Admin to view the details of the Current Customers residing in the Hotel. It also has a text box on the top left which helps in searching for the Customers by providing any little detail */

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;

namespace HMS { public partial class Present_Customers : Form { public Present_Customers() { InitializeComponent();

txtspc.LostFocus += new EventHandler(txtspc_LostFocus); } hotel h = new hotel(); void txtspc_LostFocus(object sender, EventArgs e) { if (txtspc.Text != "") { DataSet dt = h.getvalds("select * from CurCust where C_name LIKE '%" + txtspc.Text + "%' OR Address LIKE '%" + txtspc.Text + "%' OR RoomNo LIKE '%" + txtspc.Text + "%' OR MobNo LIKE '%" + txtspc.Text + "%' OR RoomType LIKE '%" + txtspc.Text + "%' OR Checkin LIKE '%" + txtspc.Text + "%'"); dataGridView1.DataSource = dt.Tables["temp"]; } else MessageBox.Show("Enter Any Information");

private void Present_Customers_Load(object sender, EventArgs e) { DataSet dt = h.getvalds("select * from CurCust"); dataGridView1.DataSource = dt.Tables["temp"]; } } }

Old Customers

/* This page is just a bridge between the front-end & back-end and allows the Admin to view the details of the Old Customers of the Hotel. It also has a text box on the top left which helps in searching for the Customers by providing any little detail */

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;

namespace HMS { public partial class OldCustomers : Form { public OldCustomers() { InitializeComponent(); txtspc.LostFocus += new EventHandler(txtspc_LostFocus); }

void txtspc_LostFocus(object sender, EventArgs e) { if (txtspc.Text != "") { //throw new NotImplementedException(); hotel h = new hotel(); DataSet dt = h.getvalds("select * from OldCust where C_name LIKE '%" + txtspc.Text + "%' OR Address LIKE '%" + txtspc.Text + "%' OR RoomNo LIKE '%" + txtspc.Text + "%' OR MobNo LIKE '%" + txtspc.Text + "%' OR RoomType LIKE '%" + txtspc.Text + "%' OR Checkin LIKE '%" + txtspc.Text + "%' OR Checkout LIKE '%" + txtspc.Text + "%' "); dataGridView1.DataSource = dt.Tables["temp"]; } else MessageBox.Show("Enter Some Information"); }

private void OldCustomers_Load(object sender, EventArgs e) { hotel h = new hotel(); DataSet dt = h.getvalds("select * from OldCust"); dataGridView1.DataSource = dt.Tables["temp"]; } } }

Check Booked Rooms

/* This GUI helps us to view the details of the Room that are already booked and view details like the name of the customers staying in the Rooms. It also has a text box on the top left which helps in searching for the Rooms by providing any little detail */

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;

namespace HMS { public partial class CheeckRoom : Form { public CheeckRoom() {

InitializeComponent(); txtscr.LostFocus += new EventHandler(txtscr_LostFocus); } hotel h = new hotel(); void txtscr_LostFocus(object sender, EventArgs e) { if (txtscr.Text != "") { DataSet dt = h.getvalds("select C_name, Rooms.RoomNo,Checkin from Rooms,CurCust where (CurCust.RoomNo=Rooms.RoomNo)AND Rooms.RoomNo Like'%" + txtscr.Text + "%' "); dataGridView1.DataSource = dt.Tables["temp"]; } else MessageBox.Show("Enter Room No"); }

private void CheeckRoom_Load(object sender, EventArgs e) { hotel h = new hotel(); DataSet dt = h.getvalds("select C_name, Rooms.RoomNo,Checkin from Rooms,CurCust where (CurCust.RoomNo=Rooms.RoomNo)"); dataGridView1.DataSource = dt.Tables["temp"]; } } }

Check Available Rooms

/* This GUI helps us to view the details of the Room that are available and can be used by the Customers. It also has a text box on the top left which helps in searching for the Rooms by providing any little detail */

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;

namespace HMS { public partial class AvailableRooms : Form { public AvailableRooms()

{ InitializeComponent(); txtar.LostFocus += new EventHandler(txtar_LostFocus); }

void txtar_LostFocus(object sender, EventArgs e) { if (txtar.Text != "") { DataSet dt = h.getvalds("select RoomNo,RoomType From Rooms Where Booked=" + 0 + "AND RoomNo LIKE '%" + txtar.Text + "%'"); dataGridView1.DataSource = dt.Tables["temp"]; } else MessageBox.Show("Enter Room No"); } hotel h = new hotel(); private void AvailableRooms_Load(object sender, EventArgs e) {

DataSet dt = h.getvalds("select RoomNo,RoomType From Rooms Where Booked="+0+""); dataGridView1.DataSource = dt.Tables["temp"]; } } }

Delete Staffs

/* The GUI above helps us to Remove a staff from the Hotel if he desires for the same, it just fetches all the information about the staff by taking E_id as the input, then it changes its Present Staff status to 0, thus stating that the current staff is no more a working staff in the Hotel */

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace HMS { public partial class DeleteStaffs : Form { public DeleteStaffs() { InitializeComponent();

} hotel h = new hotel(); private void Delete_Click(object sender, EventArgs e) { string nq=("update Staffs SET PresentStaffs='"+Convert.ToInt16(0)+"' where E_id='"+txtE_id.Text+"'"); int i = h.nonq(nq); if (i == 1) { MessageBox.Show("Staff Deleted"); } else { MessageBox.Show("Error Occured"); } } private void button1_Click(object sender, EventArgs e) { if (txtE_id.Text != "") { if (h.validate(txtE_id.Text, 1)) { hotel hi = new hotel(); SqlDataReader dr; dr = hi.getvaluedr("select * from Staffs where E_id='" + Convert.ToInt16(txtE_id.Text) + "'"); if (dr.Read()) { txtName.Text = dr[0].ToString(); txtDept.Text = dr[1].ToString(); txtDesig.Text = dr[2].ToString(); txtSal.Text = dr[3].ToString(); } dr.Close();

} } else { MessageBox.Show("Please Fill the E_id"); } } } }

Current Staffs

/* This interface helps us in interacting with the back-end and finding the information about the Staffs Currently working in the Hotel. It also has a text box on the top left which helps in searching for the Current Staffs by providing any little detail */ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text;

using System.Windows.Forms;

namespace HMS { public partial class CurrentStaffs : Form { public CurrentStaffs() { InitializeComponent(); txtscs.LostFocus += new EventHandler(txtscs_LostFocus); } hotel h = new hotel(); void txtscs_LostFocus(object sender, EventArgs e) { if (txtscs.Text != "") { DataSet dt = h.getvalds("select * from Staffs where (PresentStaffs=1) AND Name LIKE '%" + txtscs.Text + "%' OR Department LIKE '%" + txtscs.Text + "%' OR Designation LIKE '%" + txtscs.Text + "%' OR Salary LIKE '%" + txtscs.Text + "%' OR E_id LIKE '%" + txtscs.Text + "%'"); dataGridView1.DataSource = dt.Tables["temp"]; } else MessageBox.Show("Enter Some Information"); }

private void CurrentStaffs_Load(object sender, EventArgs e) { hotel h = new hotel(); DataSet dt = h.getvalds("select * from Staffs where (PresentStaffs=1)"); dataGridView1.DataSource = dt.Tables["temp"]; } } }

Old Staffs

/* This interface helps us in interacting with the back-end and finding the information about the Old-Staffs who worked in the Hotel. It also has a text box on the top left which helps in searching for the Old Staffs by providing any little detail */

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;

namespace HMS { public partial class OldStaffs : Form { public OldStaffs() { InitializeComponent();

txtss.LostFocus += new EventHandler(txtss_LostFocus); }

void txtss_LostFocus(object sender, EventArgs e) { if (txtss.Text != "") { //throw new NotImplementedException(); hotel h = new hotel(); DataSet dt = h.getvalds("select * from Staffs where (PresentStaffs=0) AND Name LIKE '%" + txtss.Text + "%' OR Department LIKE '%" + txtss.Text + "%' OR Designation LIKE '%" + txtss.Text + "%' OR Salary LIKE '%" + txtss.Text + "%' OR E_id LIKE '%" + txtss.Text + "%'"); dataGridView1.DataSource = dt.Tables["temp"]; } else { MessageBox.Show("Enter Some Information"); }

private void OldStaffs_Load(object sender, EventArgs e) { hotel h = new hotel(); DataSet dt = h.getvalds("select * from Staffs where (PresentStaffs=0)"); dataGridView1.DataSource = dt.Tables["temp"]; } private void textBox1_TextChanged(object sender, EventArgs e) { } } }

Bill

/* This page displays the expenses details of the Customer Checking-Out of the Hotel*/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace HMS { public partial class Bill : Form { public Bill(string s) { InitializeComponent();

txtRno.Text = s; } hotel h = new hotel(); private void btnPrint_Click(object sender, EventArgs e) { this.Hide(); } private void Bill_Load(object sender, EventArgs e) { txtRno.LostFocus += new EventHandler(txtRno_LostFocus); } void txtRno_LostFocus(object sender, EventArgs e) { if (txtRno.Text != "") { if (h.validate(txtRno.Text, 1)) { SqlDataReader sd; sd = h.getvaluedr("select * from CurCust Where RoomNo='"+Convert.ToInt16(txtRno.Text)+"'"); if (sd.Read()) { DateTime ci, co; double days,amount=0,disc=0,vat=0,ser=0,ga=0; ci = Convert.ToDateTime(sd[5].ToString()); co = Convert.ToDateTime(DateTime.Now.Date); System.TimeSpan ts=(co.Date-ci.Date); days = ts.TotalDays+1.0; txtName.Text = sd[0].ToString(); txtRtype.Text = sd[4].ToString(); txtBdate.Text = co.ToString("dd/MM/yyyy"); txtChkin.Text = sd[5].ToString(); txtChkout.Text = co.ToString("dd/MM/yyyy"); txtDur.Text = days.ToString();

sd.Close(); SqlDataReader ds=h.getvaluedr("select PerNight from Rooms Where RoomNo='"+Convert.ToInt16(txtRno.Text)+"'"); if (ds.Read()) { txtCost.Text = ds[0].ToString(); amount = (days * Convert.ToInt16(txtCost.Text)); txtAmount.Text = amount.ToString(); if (amount > 10000) { disc = (0.10 * amount); } else { disc = 0; } txtDisc.Text = disc.ToString(); vat = (0.125 * amount); ser = (0.08 * amount); ga = (amount + vat + ser - disc); txtVat.Text = vat.ToString(); txtSerTax.Text = ser.ToString(); txtGa.Text = ga.ToString(); ds.Close(); } } } else { MessageBox.Show("Enter A Room No"); } } } } }

Gantt-Chart
Project Chart of HMS

The Project Chart above describes how I have divided my 6 week training in giving importance to the various aspects of the project. As expected the Implementation was the most difficult and had to be devoted the maximum time during the project. Time Line

Milestone

Distribution of the Implementation Part Project-Chart of Implementation

Time Line

Milestone

Project Legacy
The project gave an immense experience in its own method. Several things were learnt during the path of the accomplishment of the project. First of all I learned the importance of software engineering models as to how they play a very crucial role in building up of an application. Moreover, initially I felt that the coding was the main part of the application building, but it took a little time to understand that the code planned is quite to certain to have flaws. And such flaws can be cleared up with testing of the phase. Thus testing the application before finalising it helps cure a lot of unseen errors. A person always learns by practice and so did I.

Bibliography
Complete Reference C# 2.0 By Herb Schildt Professional C# 2.0

You might also like