Vous êtes sur la page 1sur 35

FRONT OFFFICE MANAGEMENT FOR HOTELS

Table of Contents: 1) Introduction: 1.1) Statement 1.2) Objective 1.3) Description 1.4) Scope 1.5) Technologies used 2) System Design & Description: 2.1) System Design A) Input Design B) Output Design C) Schema Diagram 2.2) System Description A) Database B) Queries 2.3) Basic Operations 3) System Implementation 4) Program Coding 5) Output 6) Conclusion 7) References

1.1) Statement:
To design and implement front office management application for large hotels.

1.2) Objective:
To design a database that holds all details necessary to manage the luxury hotel from the front office-checking in and checking out from the reception. To design a convenient front end that helps to update the database To establish connection between the front end and the back end and implement the application.

1.3) Description of the problem:


Front office management in hotels includes facilitating the easy checking and checking out of the customers. Checking in process involves the selection of the room type from the various types the hotel offers and checking for the availability of a room of the same. Once a room is available it is necessary to get various details from the guest and add the data to the database, along with changing the status of the allocated room. Checking out process involves calculating the total amount that is to be paid by the guest and then changing the room status accordingly, so it is available further. The system must be user-friendly and feasible. It should provide facilities for making enquiries and booking, payment etc.

1.4) Scope of the problem:


This project covers the room booking aspects of front office management. It handles the checking in and checking out of guests.

1.5) Technologies used:

Developing:
The application has been designed with VB as front end and SQL as back end. Front end : Visual Basic Back end : SQL

Execution:
The application is Windows based and does not support open source. It requires the system to have Visual Studio running environment to support its execution. Also to connect the database, any version of SQL Server (above 2008) is required.

SYSTEM DESIGN AND DESCRIPTION

2.1) System Design :


Input Design: Input design is the process of converting user-oriented input to a computer based format. Input design is a part of overall system design, which requires very careful attention .Often the collection of input data is the most expensive part of the system. The main objectives of the input design are : 1. Produce cost effective method of input 2. Achieve highest possible level of accuracy 3. Ensure that the input is acceptable to and understood by the staff. After designing input and output, the analyst must concentrate on database design or how data should be organized around user requirements. The general objective is to make information access, easy quick, inexpensive and flexible for other users. During database design the following objectives are concerned:-

Controlled Redundancy Data independence Accurate and integrating More information at low cost Recovery from failure Privacy and security Performance Ease of learning and use

OUTPUT DESIGN Outputs from computer systems are required primarily to communicate the results of processing to users. They are also used to provide a permanent copy of these result for latter consultation. Computer output is the most important and direct source of information to the users. Designing computer output should proceed in an organized well throughout the manner. The right output must be available for the people who find the system easy to use. The outputs have been defined during the logical design stage. If not, they should defined at the beginning of the output designing terms of types of output connect, format, response etc.

Various types of outputs are External outputs Internal outputs Operational outputs Interactive outputs Turn around outputs All screens are informative and interactive in such a way that the user can fulfil his requirements through asking queries. Schema Diagram:

2.2)System Description

2.2 A) Database: A database is collection of information related to particular or purpose such as tracking customer orders or maintaining a music collection. If your database isnt stored on a computer or only parts of it are, you may be tracking information from variety of source that you have to coordinate and organize yourself. Using it, you can manage all our information from single database file. Within file divide your data using into separate storage containers called tables; view, add, and update table data using forms; find and retrieve just the data you want using queries and analyze or print data in specific layout using reports.

To find and retrieve just data that meet condition you specify including data from multiple tables create a query. A query can also update multiple records at the same time and perform built-in or custom calculations on your data. To easily view, enter and change directly in a table, create a form. When you open a form, it retrieves the data from one or more tables and display it on screen using the data from you chose in the form using a layout that you created from scratch.

TABLES: A table is a collection of data about a specific topic, such as products or suppliers. Using as separate table for each topic means you store that data only once which makes your database more efficient and reduces data entry errors. Table organizes data into columns and rows. In table datasheet view, you can add, edit or view the data in a table. You can also check the spelling and print your table data filter or sort records change the datasheets appearance or change the tables structure by adding or deleting columns. You can create an entire table from scratch, or add, delete, or customize an existing table fields.

2.2 B) QUERIES: We use queries to view, change and analyze data in different ways. We can also use them as the source of records for forms and report. The most common type of query is a select query. A select query retrieves data from one or more tables using criteria you specify and then display it in the order you want.

2.3) BASIC OPERATIONS:


Check availability: This module is used to check if a room of that matches the user requirements is free or no. ALGORITHM: //input: Room type //output: List of vacant rooms of the specified type For Every room in the hotel, 1. Check if the room type is same as that required by the user. 2. If yes, then check if the room status is vacant, Else check next room. 3. If room is vacant, then display the room number.

Check in: This module is used to get details from the guest and insert the guest details in the database. ALGORITHM: //input: Guest details like name, address. //output: Guest details entered in the database and appropriate message displayed to the user 1) Get the following details from the guest, First name Last Name Address City Zip No. Of Guests Phone Number From Date To Date

2) Check if from date is less than or equal to To date. If not, display error message. 3) If data has been successfully entered in database display, check in complete message.

Room details: This module is used to display the details of the various room in the hotel.

ALGORITHM //input: room number //output: room details For every room in the hotel, 1. Check if room number matches the specified room number 2. If yes, then retrieve the details of the room from the database and display the details.

Check out: This module is used to carry out the check out process. ALGORITHM: //input: Room number //output: invoice for the user 1) Obtain the guest id of the occupant of the room. 2) From the guest id obtained, calculate the total payment for the guest, using details from room details table. 3) Display the total cost and other details in the invoice.

SYSTEM IMPLEMENTATION

HOTEL MANAGEMENT SYSTEM IMPLEMENTATION

HOTEL MANAGEMENT SYSTEM

CHECK AVAILABILTIY
Get room type

CHECK IN

CHECK OUT

ROOM DETAILS
Add Get room details & Update database Delete Get room number. Delete record from database Display

Get guest details

Get room number

Check if room of specified type available Yes Display room number no Check for other rooms

Check if dates are valid

Get guest id of occupant

Get room number

yes Enter guest details in DB and update room status to occupied

no Prompt user to enter valid date

Get room details

Calculate payment and generate invoice

Display details

Display success message

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

namespace HotelManagementApp { public partial class frmForm1 : Form { public frmForm1() { InitializeComponent(); } private void btn_ChkAvail_Click(object sender, EventArgs e) { Form2 form2 = new Form2(); form2.Activate(); form2.Show();

} private void btn_CheckIn_Click(object sender, EventArgs e) { Form3 form = new Form3(); form.Activate(); form.Show(); } private void btn_CheckOut_Click(object sender, EventArgs e) { Form5 form = new Form5(); form.Activate(); form.Show(); } private void btn_RoomDetails_Click(object sender, EventArgs e) { Form4 form = new Form4(); form.Activate(); form.Show(); } private void pictureBox4_MouseClick(object sender, MouseEventArgs e) { MessageBox.Show("Park Suite - $700per night "); } private void pictureBox3_MouseClick(object sender, MouseEventArgs e) { MessageBox.Show("Ocean view - $500per night "); } private void pictureBox2_MouseClick(object sender, MouseEventArgs e) { MessageBox.Show("Deluxe King's Suite - $240per night "); } private void pictureBox1_MouseClick(object sender, MouseEventArgs e) { MessageBox.Show("Single Suite - $120per night "); }

} }

Form 2
using System; using System.Collections.Generic; using System.ComponentModel;

using using using using using using

System.Data; System.Drawing; System.Linq; System.Text; System.Windows.Forms; System.Data.SqlClient;

namespace HotelManagementApp { public partial class Form2 : Form { public Form2() { InitializeComponent(); comboBox1.Items.Add("1"); comboBox1.Items.Add("2"); comboBox1.Items.Add("3"); comboBox1.Items.Add("4"); } private void btnCheck_Click(object sender, EventArgs e) { /* if(comboBox1.SelectedIndex==1) if (txt_RoomType.Text.Equals("")) MessageBox.Show("Please Enter room number"); else*/ //{ string ConStr = Properties.Resources.ConnectionString; SqlConnection sqlCon = new SqlConnection(ConStr); SqlCommand sqlCmd = new SqlCommand(); sqlCmd.CommandType = CommandType.Text ; sqlCmd.Connection = sqlCon; sqlCmd.CommandText = "Select Roomno as \'Room Number\' from Room where RoomType=\'" + comboBox1.SelectedItem + "\'and Status=\'Vacant\'"; SqlDataAdapter dataAdd = new SqlDataAdapter(sqlCmd); DataTable dTable; try { dTable = new DataTable(); sqlCon.Open(); dataAdd.Fill(dTable); if (dTable.Rows.Count == 0) MessageBox.Show("No Rooms were avilable"); else { dataGridView1.DataSource = dTable; dataGridView1.Visible = true; } } catch (Exception ex) { MessageBox.Show("Following Error Occured during processing\n" + ex.Message); } finally

{ sqlCon.Close(); } //} } private void Form2_Load(object sender, EventArgs e) { dataGridView1.Visible = false; } private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { int rommNo=int.Parse(dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()); Form3 frm3 = new Form3(rommNo); Form frm = Form2.ActiveForm; frm.Hide(); frm3.Activate(); frm3.Show(); frm.Close();

} private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { }

} }

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

namespace HotelManagementApp { public partial class Form3 : Form

{ bool newUser = true; int guid; public Form3() { InitializeComponent(); } public Form3(int roomno) { InitializeComponent(); txt_RoomNo.Text =roomno.ToString(); txt_RoomNo.Enabled = false; } private void button1_Click(object sender, EventArgs e) { string ConStr = Properties.Resources.ConnectionString; SqlConnection sqlCon = new SqlConnection(ConStr); SqlCommand sqlCmd = new SqlCommand(); sqlCmd.CommandType = CommandType.Text; sqlCmd.Connection = sqlCon; SqlDataReader reader; string address = txt_Add.Text.Replace(',', ' '); System.TimeSpan tspan=dateTimePicker2.Value.Subtract(dateTimePicker1.Value);

int days = int.Parse(Math.Ceiling(tspan.TotalDays).ToString()); if (days <= 0) MessageBox.Show("Check in date less than or equal to Check out date."); else { if (newUser) { //INSERT INTO Hotelmgmt.dbo.guest ( Guestid, Fname,Lname,Address,City,Zipcode,No_days,No_guests,Roomno) Values ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & TextBox6.Text & "','" & TextBox7.Text & "','" & TextBox8.Text & "','" & TextBox9.Text & "')" sqlCmd.CommandText = "INSERT INTO guest values(\'" + txt_Fname.Text + "\',\'" + txt_Lname.Text + "\',\'" + address.ToString() + "\',\'" + txt_City.Text + "\'," + txt_Zip.Text + "," + days.ToString() + "," + txt_GNo.Text + "," + txt_RoomNo.Text + "," + txt_Phone.Text + ")"; } else { sqlCmd.CommandText = "Update guest set No_days=" + days.ToString() + ",No_guests=" + txt_GNo.Text + ",Roomno=" + txt_RoomNo.Text + " where Guestid=\'" + guid.ToString() + "\'"; } try { sqlCon.Open(); int check = sqlCmd.ExecuteNonQuery(); if (check <= 0)

MessageBox.Show("Checkin in Failed"); else { sqlCmd.CommandText = "Update Room set status=\'Occupied\' where Roomno=\'" + txt_RoomNo.Text + "\'"; sqlCmd.ExecuteNonQuery(); sqlCmd.CommandText = "Select Guestid from guest where Roomno=\'" + txt_RoomNo.Text + "\'"; reader = sqlCmd.ExecuteReader(); reader.Read(); string gid = reader[0].ToString(); MessageBox.Show("Checkin Successful...\nGuest ID is:" + gid); } } catch (Exception ex) { MessageBox.Show("Error Occurred during process\n" + ex.Message); } finally { sqlCon.Close(); } Form3.ActiveForm.Close(); } } private void btn_Search_Click(object sender, EventArgs e) { string ConStr = Properties.Resources.ConnectionString; SqlConnection sqlCon = new SqlConnection(ConStr); SqlCommand sqlCmd = new SqlCommand(); sqlCmd.CommandType = CommandType.Text; sqlCmd.Connection = sqlCon; if(txt_FnameS.Text.Equals("") && txt_LnameS.Text.Equals("") && txt_PhoneS.Text.Equals("")) sqlCmd.CommandText = "Select * from guest"; else if(!(txt_FnameS.Text.Equals("")) && txt_LnameS.Text.Equals("") && txt_PhoneS.Text.Equals("")) sqlCmd.CommandText = "Select * from guest where Fname=\'" + txt_FnameS.Text "\'"; else if(txt_FnameS.Text.Equals("") && !txt_LnameS.Text.Equals("") && txt_PhoneS.Text.Equals("")) sqlCmd.CommandText = "Select * from guest where Lname=\'" + txt_LnameS.Text "\'"; else if (!txt_FnameS.Text.Equals("") && !txt_LnameS.Text.Equals("") && txt_PhoneS.Text.Equals("")) sqlCmd.CommandText = "Select * from guest where Lname=\'" + txt_LnameS.Text "\' and Fname=\'" + txt_FnameS.Text + "\'"; else if (txt_FnameS.Text.Equals("") && txt_LnameS.Text.Equals("") && !txt_PhoneS.Text.Equals("")) sqlCmd.CommandText = "Select * from guest where Phone=\'" + txt_PhoneS.Text "\'";

else if (!txt_FnameS.Text.Equals("") && txt_LnameS.Text.Equals("") && !txt_PhoneS.Text.Equals("")) sqlCmd.CommandText = "Select * from guest where Phone=\'" + txt_PhoneS.Text + "\' and Fname=\'" + txt_FnameS.Text + "\'"; else if (txt_FnameS.Text.Equals("") && !txt_LnameS.Text.Equals("") && !txt_PhoneS.Text.Equals("")) sqlCmd.CommandText = "Select * from guest where Phone=\'" + txt_PhoneS.Text + "\' and Lname=\'" + txt_LnameS.Text+"\'"; else if (!txt_FnameS.Text.Equals("") && !txt_LnameS.Text.Equals("") && !txt_PhoneS.Text.Equals("")) sqlCmd.CommandText = "Select * from guest where Phone=\'" + txt_PhoneS.Text + "\' and Lname=\'" + txt_LnameS.Text + "\' and Fname=\'" + txt_FnameS.Text + "\'"; SqlDataAdapter dataAdd = new SqlDataAdapter(sqlCmd); DataTable dTable; try { dTable = new DataTable(); sqlCon.Open(); dataAdd.Fill(dTable); if (dTable.Rows.Count == 0) { MessageBox.Show("No Results Found"); newUser = true; dataGridView1.Enabled = false; } else { dataGridView1.DataSource = dTable; dataGridView1.Visible = true; dataGridView1.Enabled = true; } } catch (Exception ex) { MessageBox.Show("Following Error Occured during processing\n" + ex.Message); } finally { sqlCon.Close(); } } private void Form3_Load(object sender, EventArgs e) { panel2.Visible = false; } private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { Form3.ActiveForm.Text = "HMS Check In"; guid=int.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()); txt_Fname.Text= dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); txt_Lname.Text = dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString(); txt_Add.Text = dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString(); txt_City.Text = dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString(); txt_Zip.Text = dataGridView1.Rows[e.RowIndex].Cells[5].Value.ToString();

txt_Phone.Text = dataGridView1.Rows[e.RowIndex].Cells[9].Value.ToString(); newUser = false; panel2.Visible = false; panel1.Visible = true; dataGridView1.Enabled = false; btn_guestLookup.Visible = true; } private void btn_guestLookup_Click(object sender, EventArgs e) { panel1.Visible = false; panel2.Visible = true; Form3.ActiveForm.Text = "Search Guest"; btn_guestLookup.Visible = false; } private void btn_SearchClose_Click(object sender, EventArgs e) { Form3.ActiveForm.Text = "HMS Check In"; panel2.Visible = false; panel1.Visible = true; btn_guestLookup.Visible = true; }

} }

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

namespace HotelManagementApp { public partial class Form4 : Form { public Form4() { InitializeComponent(); } private void Form4_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'hotelmgmtDataSet.Room' table. You can move, or remove it, as needed. this.roomTableAdapter.Fill(this.hotelmgmtDataSet.Room);

} private void button3_Click(object sender, EventArgs e) { Form6 form6 = new Form6(); form6.Activate(); form6.Show(); } private void button1_Click(object sender, EventArgs e) { Form6 form6 = new Form6(); form6.Activate(); form6.Show(); } private void button2_Click(object sender, EventArgs e) { Form7 form7 = new Form7(); form7.Activate(); form7.Show(); }

} }

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

namespace HotelManagementApp { public partial class Form5 : Form { public Form5() {

InitializeComponent(); } private void btn_checkout_Click(object sender, EventArgs e) { string ConStr = Properties.Resources.ConnectionString; SqlConnection sqlCon = new SqlConnection(ConStr); SqlCommand sqlCmd = new SqlCommand(); sqlCmd.CommandType = CommandType.Text; sqlCmd.Connection = sqlCon; SqlDataAdapter DA = new SqlDataAdapter(sqlCmd); DataTable Dt = new DataTable();

try { sqlCon.Open(); sqlCmd.CommandText = "select Fname,Lname,Address,City,ZipCode,No_Days,No_Guests,Room.Roomno,Phone,Cos_night from Room,guest where guest.Roomno=Room.Roomno AND guest.Roomno=" + txtRoomNo.Text; DA.Fill(Dt); if (Dt.Rows.Count <= 0) MessageBox.Show("Either Guest has already checked out or Room number entered is wrong"); else { sqlCmd.CommandText = "Update Room set status=\'Vacant\' where Roomno=\'" + txtRoomNo.Text + "\'"; sqlCmd.ExecuteNonQuery(); sqlCmd.CommandText = "Update guest set Roomno=NULL where Roomno=\'" + txtRoomNo.Text + "\'"; sqlCmd.ExecuteNonQuery(); MessageBox.Show("Checkout Successful."); lbl_Fname.Text = Dt.Rows[0][0].ToString(); lbl_LName.Text = Dt.Rows[0][1].ToString(); lbl_Add.Text = Dt.Rows[0][2].ToString(); lbl_City.Text = Dt.Rows[0][3].ToString(); lbl_zip.Text = Dt.Rows[0][4].ToString(); lbl_Dno.Text = Dt.Rows[0][5].ToString(); lbl_Gno.Text = Dt.Rows[0][6].ToString(); lbl_Rno.Text = Dt.Rows[0][7].ToString(); lbl_Phone.Text = Dt.Rows[0][8].ToString(); lbl_Cpn.Text = Dt.Rows[0][9].ToString(); lbl_Total.Text = (int.Parse(Dt.Rows[0][5].ToString()) * int.Parse(Dt.Rows[0][9].ToString())).ToString();

panel2.Visible = true;

} catch (Exception ex) { MessageBox.Show("Error Occurred during process\n" + ex.Message);

} finally { sqlCon.Close(); } } private void Form5_Load(object sender, EventArgs e) { panel2.Visible = false; }

} }

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

namespace HotelManagementApp { public partial class Form6 : Form { public Form6() { InitializeComponent(); comboBox1.Items.Add("1"); comboBox1.Items.Add("2"); comboBox1.Items.Add("3"); comboBox1.Items.Add("4"); } private void button1_Click(object sender, EventArgs e) { if ((textBox1.Text.Equals("101")) || (textBox1.Text.Equals("102")) || (textBox1.Text.Equals("103")) || (textBox1.Text.Equals("104")) || (textBox1.Text.Equals("105")) || (textBox1.Text.Equals("106")) || (textBox1.Text.Equals("107")) || (textBox1.Text.Equals("108")) || (textBox1.Text.Equals("109")) || (textBox1.Text.Equals("110")) || (textBox1.Text.Equals("111")) || (textBox1.Text.Equals("112")) || (textBox1.Text.Equals("113")) || (textBox1.Text.Equals("114")) || (textBox1.Text.Equals("115"))) {

MessageBox.Show("Room number exists already"); } else { string x = "Vacant"; string ConStr = Properties.Resources.ConnectionString; SqlConnection sqlCon = new SqlConnection(ConStr); SqlCommand sqlCmd = new SqlCommand(); sqlCmd.CommandType = CommandType.Text; sqlCmd.Connection = sqlCon; sqlCon.Open(); sqlCmd.CommandText = "INSERT INTO Room values(" + textBox1.Text + "," + comboBox1.SelectedItem + "," + 0 + "," + 0 + ")"; sqlCmd.ExecuteNonQuery(); if (comboBox1.SelectedItem.Equals("1")) { sqlCmd.CommandText = "Update Room set Cos_night=\'120\' where Roomno=\'" + textBox1.Text + "\'"; sqlCmd.ExecuteNonQuery(); sqlCmd.CommandText = "Update Room set Status =\'Vacant\' where Roomno=\'" + textBox1.Text + "\'"; sqlCmd.ExecuteNonQuery(); } else { if (comboBox1.SelectedItem.Equals("2")) { sqlCmd.CommandText = "Update Room set Cos_night=\'240\' where Roomno=\'" + textBox1.Text + "\'"; sqlCmd.ExecuteNonQuery(); sqlCmd.CommandText = "Update Room set Status =\'Vacant\' where Roomno=\'" + textBox1.Text + "\'"; sqlCmd.ExecuteNonQuery(); } else { if (comboBox1.SelectedItem.Equals("3")) { sqlCmd.CommandText = "Update Room set Cos_night=\'120\' where Roomno=\'" + textBox1.Text + "\'"; sqlCmd.ExecuteNonQuery(); sqlCmd.CommandText = "Update Room set Status =\'Vacant\' where Roomno=\'" + textBox1.Text + "\'"; sqlCmd.ExecuteNonQuery(); } else { if (comboBox1.SelectedItem.Equals("4")) { sqlCmd.CommandText = "Update Room set Cos_night=\'120\' where Roomno=\'" + textBox1.Text + "\'";

sqlCmd.ExecuteNonQuery(); sqlCmd.CommandText = "Update Room set Status =\'Vacant\' where Roomno=\'" + textBox1.Text + "\'"; sqlCmd.ExecuteNonQuery(); } } } } MessageBox.Show("New room added"); sqlCon.Close(); Form6.ActiveForm.Close(); } } } }

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

namespace HotelManagementApp { public partial class Form7 : Form { public Form7() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string ConStr = Properties.Resources.ConnectionString; SqlConnection sqlCon = new SqlConnection(ConStr); SqlCommand sqlCmd = new SqlCommand(); sqlCmd.CommandType = CommandType.Text; sqlCmd.Connection = sqlCon; SqlDataAdapter DA = new SqlDataAdapter(sqlCmd); DataTable Dt = new DataTable(); sqlCon.Open(); sqlCmd.CommandText = "DELETE from Room where Roomno=\'" + comboBox1.SelectedItem + "\'"; sqlCmd.ExecuteNonQuery(); MessageBox.Show("Room deleted"); sqlCon.Close();

Form7.ActiveForm.Close(); }

private void Form7_Load(object sender, EventArgs e) { comboBox1.Items.Clear(); string ConStr = Properties.Resources.ConnectionString; SqlConnection sqlCon = new SqlConnection(ConStr); SqlCommand sqlCmd = new SqlCommand("SELECT Roomno FROM Room where status=\'Vacant\' ORDER BY Roomno ASC"); sqlCmd.CommandType = CommandType.Text; sqlCmd.Connection = sqlCon; SqlDataAdapter dataAdd = new SqlDataAdapter(sqlCmd); DataTable dTable; try { dTable = new DataTable(); sqlCon.Open(); dataAdd.Fill(dTable); foreach (DataRow dr in dTable.Rows) { comboBox1.Items.Add(dr["Roomno"]); } } catch (Exception ex) { MessageBox.Show("Following Error Occured during processing\n" + ex.Message); } finally { sqlCon.Close(); } }

} }

OUTPUT

1.Homepage

2.Room overview

3.Check availability

4.Check in

4.Check out

5.Room details

Vous aimerez peut-être aussi