Net and Windows Application Project on Hotel Management

Preview:

DESCRIPTION

people how are searching for good .net application here is my documentation of my hotel management software.

Citation preview

NIIT Abhay Chambers, Jalori Gate, Jodhpur-342001 Ph.2614914 E-mail: niitjod@sancharnet.in

Developed by

Mujeeeb Rehman & Tamanna Solanki

Semester - B 2013

NIIT

PROJECT ON – HOTEL MANAGEMENT

- 2 -

Batch Code : B130293

Start Date : 03/05/2013

End Date : 20/07/2013

Name of the Coordinator : Akshay Nair

Name of the Developer : Mujeeb Rehman & Tamanna Solanki

Date of Submission :___/07/2013

Hotel Management

- 3 -

Certificate This is certifying that thesis work, “Apple Inc.” a bonfire

work has been successfully carried out and submitted in the

fulfillment of the requirement for the Semester -B of GNIIT

(Software Engineering) from NIIT. It is certified that all

correction / suggestion indicated for the internal assessment

have been incorporated in the Report. The report has been

approved as it satisfied the academic requirement in respect

of Minor work prescribed for the software Engineering

(GNIIT).

This thesis is done under the guidance of “Akshay Nair” by

“Mujeeb Rehman & Tamanna Solanki” of Semester “B”

GNIIT (Software Engineering).

Mr. Akshay Nair Mr. Mukesh Bansal

(Faculty) (Director)

- 4 -

Acknowledgement We are very thankful to everyone who supported us for this

assignment and gives their guidance to complete our theses

work effectively and moreover on time.

We are equally grateful to our faculty Mr. Akshay Nair, who

gave us moral support and guided us in different matters

regarding the topic.

We feel immensely proud in extending our heartiest thanks to

Mr. Mukesh Bansal, Director of NIIT (Jodhpur), Ms. Ritika

Maheshwari (GL Tech.), for providing us a platform to

improve in various fields. They went out of their way and

provide us with openhearted help and counsel. They have been

a source of inspiration for us and their experience and

knowledge have helped us in learning and giving this project

the shape it has assumed. Her cooperation in short was

immense.

Mujeeb Rehman & Tamanna Solanki.

- 5 -

Hardware and Software Requirements

• Cpu

• Monitor

• Keyboard & Mouse

• Minimum 2GB of RAM

• Minimum 200 GB of HDD

Hardware

• Microsoft Visual Studio Ultimate 2010

• Microsoft SQL Server 2008 with Management Studio

• .Net FrameWork 4.0

• Active X Plugin for Full Support Of Connectivity

Software

• Microsoft Windows 7 (Recommanded)

Operating System

- 6 -

Contents Page No.

1. Login Wizard 7.

2. Main Application Window 9.

3. Staff Registration Wizard 11.

4. Staff Details Wizard 14.

5. Staff Search Wizard 16.

6. Room Information Wizard 18.

7. Room Reservation Wizard 20.

8. Room AvailabilityWizard 24.

9. PaymentDetails 26.

10. Food and Beverages Dialog Box 27.

11. AnnouncementsDialog Box 28.

12. Bibliography 29.

- 7 -

Login Wizard of Hotel

using System; usingSystem.Collections.Generic; usingSystem.ComponentModel; usingSystem.Data; usingSystem.Drawing; usingSystem.Linq; usingSystem.Text; usingSystem.Windows.Forms; usingSystem.Data.SqlClient; namespaceHotel_Management { publicpartialclassfrmLogin : Form { publicfrmLogin() { InitializeComponent(); } staticint a; privatevoidbtnExit_Click(object sender, EventArgs e) { this.Close(); } privatevoidbtnLogin_Click(object sender, EventArgs e) {

SqlConnection con1 = newSqlConnection("Data Source=ENGINEER-PC\\SQLEXPRESS;Initial Catalog=HotelManagement;Integrated Security=True;User ID=sa;Password=***********;"); SqlDataAdapter da = newSqlDataAdapter("Select Count(*) From Login Where Username='" + txtUsername.Text + "' and Password='" + txtPassword.Text + "'", con1);

DataTabledt = newDataTable(); da.Fill(dt); if (((a < 2) || (txtPassword.Text == null))) {

- 8 -

if (dt.Rows[0][0].ToString() == "1") { this.Hide(); Royal_Hotel_Management r = newRoyal_Hotel_Management(); r.Show(); } else { MessageBox.Show("Please Check Your Username & Password...!!!"); a += 1; } } else { MessageBox.Show("Invalid Username or Password ! Aborting..."); this.Close(); } } } }

- 9 -

Main Application Window

using System;

usingSystem.Collections.Generic;

usingSystem.ComponentModel; usingSystem.Data; usingSystem.Drawing; usingSystem.Linq; usingSystem.Text; usingSystem.Windows.Forms; namespaceHotel_Management { publicpartialclassRoyal_Hotel_Management : Form { publicRoyal_Hotel_Management() { InitializeComponent(); } privatevoidexitToolStripMenuItem_Click(object sender, EventArgs e) { Application.Exit(); }

- 10 -

privatevoidstaffRegistrationChildFrmMenuItem_Click(object sender, EventArgs e) { frmStaffRegstfRegObj = newfrmStaffReg(); stfRegObj.MdiParent = this; stfRegObj.Show(); } privatevoidstaffDetailsToolStripMenuItem_Click(object sender, EventArgs e) { frmStaffDetailsstfDetlsObj = newfrmStaffDetails(); stfDetlsObj.MdiParent = this; stfDetlsObj.Show(); } privatevoidroomInformationToolStripMenuItem_Click(object sender, EventArgs e) { frmRoomInformInfobj = newfrmRoomInfo(); rmInfobj.MdiParent = this; rmInfobj.Show(); } privatevoidroomReservationToolStripMenuItem_Click(object sender, EventArgs e) { frmRoomReservationrmRsvObj = newfrmRoomReservation(); rmRsvObj.MdiParent = this; rmRsvObj.Show(); } privatevoidroomAvailabilityToolStripMenuItem_Click(object sender, EventArgs e) { frmRoomAvailabilityrmAvlObj = newfrmRoomAvailability(); rmAvlObj.MdiParent = this; rmAvlObj.Show(); } privatevoidfoodBeveragesToolStripMenuItem_Click(object sender, EventArgs e) { MessageBox.Show("Sorry For Our Inconvenience...!! No Services Are Available At This Moment.", "Food & Beverages", MessageBoxButtons.OK, MessageBoxIcon.Information); } privatevoidannouncementsToolStripMenuItem_Click(object sender, EventArgs e) { MessageBox.Show("Important Instructions !! For Staff:- Workers can take half day leave on every week of this month. IF they are willing to carry on with their fulltime, Manager gave them a gift voucher of Rs/-100.","Announcement",MessageBoxButtons.OK,MessageBoxIcon.Information); } } }

- 11 -

Staff Registration Wizard

using System; usingSystem.Collections.Generic; usingSystem.ComponentModel; usingSystem.Data; usingSystem.Drawing; usingSystem.Linq; usingSystem.Text; usingSystem.Windows.Forms; usingSystem.Data.SqlClient; using System.IO; namespaceHotel_Management { publicpartialclassfrmStaffReg : Form {

SqlConnection con = newSqlConnection("Data Source=ENGINEER-PC\\SQLEXPRESS;Initial Catalog=HotelManagement;Persist Security Info=True;User ID=sa;Password=secret");

SqlCommand command; stringimgloc = ""; publicfrmStaffReg() { InitializeComponent(); } privatevoidbtnClose_Click(object sender, EventArgs e) { this.Close();

- 12 -

} privatevoidbtnBrowse_Click(object sender, EventArgs e) { try { OpenFileDialogdlg = newOpenFileDialog();

dlg.Filter = "JPG Files(*.jpg)|*.jpg|GIF Files(*.gif)|*.gif|AllFIles(*.*)|*.*";

dlg.Title = "Select Employee Picture"; if (dlg.ShowDialog() == DialogResult.OK) { imgloc = dlg.FileName.ToString(); pictureBox1.ImageLocation = imgloc; } } catch(Exception ex) { MessageBox.Show(ex.Message); } } privatevoidbtnSubmit_Click(object sender, EventArgs e) { try {

FileStreamfs = newFileStream(imgloc, FileMode.OpenOrCreate, FileAccess.Read);

BinaryReaderbr = newBinaryReader(fs); //*************************** Byte[] img = null; img = br.ReadBytes((int)fs.Length);

stringsql = "INSERT into Staff(FirstName,LastName,Age,Address,City,State,Email,Phone,Sex,Designation,EmpPhoto,LastModifiedDate) values('" + textBox1.Text + "','" + textBox2.Text + "'," + textBox3.Text + ",'" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "'," + textBox8.Text + ",'" + textBox9.Text + "','" + textBox10.Text + "',@img,getdate())";

if(con.State!= ConnectionState.Open) con.Open(); command = newSqlCommand(sql,con); command.Parameters.Add(newSqlParameter("@img",img)); int x= command.ExecuteNonQuery(); command.Clone(); MessageBox.Show(x.ToString()+" Record(s) Saved...!"); con.Close(); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; textBox7.Text = ""; textBox8.Text = ""; textBox9.Text = ""; textBox10.Text = ""; //**************************** }

- 13 -

catch (Exception ex) { con.Close(); MessageBox.Show(ex.Message); } } } }

- 14 -

Staff Details Form

using System; usingSystem.Collections.Generic; usingSystem.ComponentModel; usingSystem.Data; usingSystem.Drawing; usingSystem.Linq; usingSystem.Text; usingSystem.Windows.Forms; namespaceHotel_Management { publicpartialclassfrmStaffDetails : Form { publicfrmStaffDetails() { InitializeComponent(); } privatevoid Form4_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'hotelManagementDataSet1.Staff' table. You can move, or remove it, as needed.

- 15 -

this.staffTableAdapter.Fill(this.hotelManagementDataSet1.Staff); // TODO: This line of code loads data into the 'hotelManagementDataSet.Staff' table. You can move, or remove it, as needed. this.staffTableAdapter.Fill(this.hotelManagementDataSet1.Staff); } privatevoidbtnRefresh_Click(object sender, EventArgs e) { frmStaffDetailsfsd = newfrmStaffDetails(); this.Hide(); fsd.Show(); } privatevoid button1_Click(object sender, EventArgs e) { this.Close(); } } }

- 16 -

Staff Search Wizard

using System; usingSystem.Collections.Generic; usingSystem.ComponentModel; usingSystem.Data; usingSystem.Drawing; usingSystem.Linq; usingSystem.Text; usingSystem.Windows.Forms; usingSystem.Data.SqlClient; namespaceHotel_Management { publicpartialclassfrmSearch : Form { publicfrmSearch() { InitializeComponent(); } privatevoidbtnSearch_Click(object sender, EventArgs e) { stringconnectionString = "Data Source=ENGINEER-PC\\SQLEXPRESS;Initial Catalog=HotelManagement;Persist Security Info=True;User ID=sa;Password=secret"; SqlConnection con = newSqlConnection(connectionString); con.Open(); try { SqlCommandcmd = newSqlCommand("select * from staff where Designation=@sn", con); cmd.Parameters.Add(newSqlParameter("@sn", cmbboxDesig.Text)); DataSet ds = newDataSet();

- 17 -

DataTabledt = newDataTable(); SqlDataReaderdr = cmd.ExecuteReader(); dt.Load(dr); dataGridViewSearch.DataSource = dt; } catch(SqlException ex) { MessageBox.Show("ERROR OCCURED" +ex); } } privatevoidfrmSearch_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'hotelManagementDataSet1.Staff' table. You can move, or remove it, as needed. this.staffTableAdapter.Fill(this.hotelManagementDataSet1.Staff); } privatevoidbtnClose_Click(object sender, EventArgs e) { this.Close(); } privatevoid label2_Click(object sender, EventArgs e) { } } }

- 18 -

Room Information Wizard

using System; usingSystem.Collections.Generic; usingSystem.ComponentModel; usingSystem.Data; usingSystem.Drawing; usingSystem.Linq; usingSystem.Text; usingSystem.Windows.Forms; usingSystem.Data.SqlClient; namespaceHotel_Management { publicpartialclassfrmRoomInfo : Form { SqlConnection con = newSqlConnection("Data Source=ENGINEER-PC\\SQLEXPRESS;Initial Catalog=HotelManagement;Persist Security Info=True;User ID=sa;Password=secret"); SqlCommandcmd; SqlDataAdapter da = newSqlDataAdapter(); BindingSourcebs = newBindingSource(); publicfrmRoomInfo() { InitializeComponent(); } privatevoidfrmRoomInfo_Load(object sender, EventArgs e) {

- 19 -

// TODO: This line of code loads data into the 'hotelManagementDataSet.RoomInfo' table. You can move, or remove it, as needed. this.roomInfoTableAdapter.Fill(this.hotelManagementDataSet2.RoomInfo); } privatevoid toolStripButton2_Click(object sender, EventArgs e) { this.Close(); } privatevoid toolStripButton1_Click(object sender, EventArgs e) { con.Open(); stringsql = "UPDATE RoomInfo set Status='" + txtStatus.Text + "',Assigned_To='" + txtAssigTo.Text + "' WHERE Room_Number='" + txtRoomNo.Text + "'"; cmd = newSqlCommand(sql, con); cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Record Updated"); } } }

- 20 -

Room Reservation Form

- 21 -

using System;

usingSystem.Collections.Generic; usingSystem.ComponentModel; usingSystem.Data; usingSystem.Drawing; usingSystem.Linq; usingSystem.Text; usingSystem.Windows.Forms; usingSystem.Data.SqlClient; namespaceHotel_Management { publicpartialclassfrmRoomReservation : Form { SqlConnection con = newSqlConnection("Data Source=ENGINEER-PC\\SQLEXPRESS;Initial Catalog=HotelManagement;Persist Security Info=True;User ID=sa;Password=secret;MultipleActiveResultSets = True"); SqlCommandcmd = newSqlCommand(); publicfrmRoomReservation() { InitializeComponent(); } privatevoidfrmRoomReservation_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'hotelManagementDataSet31.RoomCategory' table. You can move, or remove it, as needed. this.roomCategoryTableAdapter.Fill(this.hotelManagementDataSet31.RoomCategory); // TODO: This line of code loads data into the 'hotelManagementDataSet3.GuestInformation' table. You can move, or remove it, as needed. this.guestInformationTableAdapter.Fill(this.hotelManagementDataSet3.GuestInformation); cmd.Connection = con; } privatevoidbtnRegister_Click(object sender, EventArgs e) { if (txtName.Text != "") { con.Open(); cmd.CommandText = "Insert Into GuestInformation(Name,Age,Gender,Email,ContactNum) Values('" + txtName.Text + "'," + txtAge.Text + ",'" + txtGender.Text + "','" + txtEmail.Text + "'," + txtContact.Text + ")"; cmd.ExecuteNonQuery(); cmd.Clone(); MessageBox.Show("Guest Record Registered !!"); con.Close(); txtName.Text = ""; txtAge.Text = ""; txtGender.Text = ""; txtEmail.Text = ""; txtContact.Text = ""; } }

- 22 -

privatevoidbtnRoomReserved_Click(object sender, EventArgs e) { if (combBoxRoomNo.Text != "") { stringsql = "insert into RoomReservation(RoomNumber,ConfirmationNo,CheckInDate,CheckOutDate)Values(" + combBoxRoomNo.Text + ",'" + txtConfNo.Text + "','" + DateTimePicker1ChkIn.Text + "','" + DateTimePicker2ChkOut.Text + "')"; con.Open(); cmd = newSqlCommand(sql, con); cmd.ExecuteNonQuery(); cmd.Clone(); MessageBox.Show("Room(s) Reserved !!"); con.Close(); combBoxRoomNo.Text = ""; txtConfNo.Text = ""; DateTimePicker1ChkIn.Text = ""; DateTimePicker2ChkOut.Text = ""; } } privatevoidbtnCategory_Click(object sender, EventArgs e) { stringsql = "insert into TotalPayement(RoomType, Room, Price, Days)values('"+cmbRmTyp.Text+"'," + txtPresiRoom.Text + "," + txtPresiPrice.Text + "," + txtPresiDays.Text + ")"; con.Open(); cmd = newSqlCommand(sql, con); cmd.ExecuteNonQuery(); cmd.Clone(); MessageBox.Show("Registered !!"); con.Close(); cmbRmTyp.Text = ""; txtPresiRoom.Text = ""; txtPresiPrice.Text = ""; txtPresiDays.Text = ""; } privatevoid btnRefresh2_Click(object sender, EventArgs e) { frmRoomReservationfrr = newfrmRoomReservation(); this.Hide(); frr.Show(); } privatevoid groupBox2_Enter(object sender, EventArgs e) { } privatevoidbtnPrint_Click(object sender, EventArgs e) { printDialog1.Document = printDocument1; DialogResult result = printDialog1.ShowDialog(); if (result == DialogResult.OK) printDocument1.Print(); }

- 23 -

privatevoid printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.DrawString(combBoxRoomNo.Text, newFont("Arial", 40, FontStyle.Bold), Brushes.Black, 150, 125); e.Graphics.DrawString(txtConfNo.Text, newFont("Arial", 40, FontStyle.Bold), Brushes.Black, 150, 125); e.Graphics.DrawString(DateTimePicker1ChkIn.Text, newFont("Arial", 40, FontStyle.Bold), Brushes.Black, 150, 125); e.Graphics.DrawString(DateTimePicker2ChkOut.Text, newFont("Arial", 40, FontStyle.Bold), Brushes.Black, 150, 125); } } }

- 24 -

Room Availability

using System; usingSystem.Collections.Generic; usingSystem.ComponentModel; usingSystem.Data; usingSystem.Drawing; usingSystem.Linq; usingSystem.Text; usingSystem.Windows.Forms; namespaceHotel_Management { publicpartialclassfrmRoomAvailability : Form { publicfrmRoomAvailability() { InitializeComponent(); } privatevoidfrmRoomAvailability_Load(object sender, EventArgs e) {

- 25 -

// TODO: This line of code loads data into the 'hotelManagementDataSet4.RoomAvailability' table. You can move, or remove it, as needed. this.roomAvailabilityTableAdapter.Fill(this.hotelManagementDataSet4.RoomAvailability); } privatevoidfillByToolStripButton_Click(object sender, EventArgs e) { try { this.roomInfoTableAdapter.FillBy(this.hotelManagementDataSet5.RoomInfo); } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } } privatevoid fillByToolStripButton1_Click(object sender, EventArgs e) { try { this.roomAvailabilityTableAdapter.FillBy(this.hotelManagementDataSet4.RoomAvailability); } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } } privatevoidbtnLoad_Click(object sender, EventArgs e) { frmRoomAvailabilityfraty = newfrmRoomAvailability(); this.Hide(); fraty.Show(); } privatevoidbtnExit_Click(object sender, EventArgs e) { this.Close(); } } }

- 26 -

Payment Details

namespaceHotel_Management { publicpartialclassfrmPaymnt : Form { publicfrmPaymnt() { InitializeComponent(); } privatevoid Form13_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'hotelManagementDataSet7.Payement' table. You can move, or remove it, as needed. this.payementTableAdapter.Fill(this.hotelManagementDataSet7.Payement); } privatevoidbtnGetTotal_Click(object sender, EventArgs e) { int sum=0; for (int a = 0; a < dataGridView1.Rows.Count; ++a) { sum += Convert.ToInt32(dataGridView1.Rows[a].Cells[4].Value); } MessageBox.Show("Total Rs/- "+ sum.ToString()); } } }

- 27 -

Food & Beverages

privatevoidfoodBeveragesToolStripMenuItem_Click(object sender, EventArgs e) {

MessageBox.Show("Sorry For Our Inconvenience...!! No Services Are Available At This Moment.", "Food & Beverages", MessageBoxButtons.OK, MessageBoxIcon.Information);

}

- 28 -

Announcements

privatevoidannouncementsToolStripMenuItem_Click(object sender, EventArgs e) {

MessageBox.Show("Important Instructions !! For Staff:- Workers can take half day leave on every week of this month. IF they are willing to carry on with their fulltime, Manager gave them a gift voucher of Rs/-100.","Announcement",MessageBoxButtons.OK,MessageBoxIcon.Information);

}

- 29 -

Bibliography

******************************************

StackOverFlow.com

Msdn.com

w3schools.com

NIIT .NET Project Guide

NIIT ADO.Net Student Reference.

******************************************