Professional Documents
Culture Documents
Introduction
1.1 backgrounds
One system to be well organized and technology based it must incorporate a good information and data storing system. Our project focus on hotel room reservation system we prepare database which used to store different information related to room reservation and this data base facilitate searching and retrieve of specific data. And we also prepare GUI. This GUI used to communicate end users the system. Generally our project focus on making the hotels system modern and technology oriented. 1.2 purposes The main purpose of this document is to simplify complexity of the system by identifying The functional and nonfunctional requirements of the system and representing them use modeling language (UML). This simplified representation is useful for the system end users, customers and software developer.
1.3 Objective
1.4 scopes
The new system should provide the following service store Reservation information in organize manner about Rooms information Customers information Employers information
1
Security issue To prevent unauthorized users from changing the already exist data Because of this the new system should have security for accessing the data; Back up it reserve data for future use, in the case of damaging and it also have backup mechanism The system doesnt allow payment using credit card or master card because of the system cant access other database like bank database.
1.5 Definitions, acronyms, and abbreviations -GUI:- graphical user interface -RE;-requirement elastration -UML: - unify modeling language
-ER DIGRAME: - Entity relational diagram -SDD: .System Design Document
1.6 References
1, system analysis design methods sixth edition by whiten Bentleydittman 2, software engineering seventh edition by Summerville 3,http://www.freetutes.com/systemanalysis/
1.7 Overview This documentation contains four sections. The first section contains about requirement elicitation and analysis phase and the second section contains design phase ,the third section contain implementation, the fourth section contain about quaternaries that we use to gather information. requirement elicitation and analysis includes what is being done on the current system, and all about the proposed system,,. Proposed system includes overview of the proposed system, functional requirements, on functional requirements and system models. System models contain scenarios, use case model, object model and dynamic models.
Actors and use case identification and use case diagram is described in use case model which describe about the external functionality of the system according to users point of view. Identifying participant objects and class diagram are described in object model which describe about structure of system. Dynamic model also includes diagrams that are used to describe internal interaction of the system such as sequence diagram, state diagram and activity diagram. In system design phase current software architecture and proposed software architecture are included. Proposed software architecture includes subsystem decomposition, hardware/software mapping, persistence data management, access control and security, global software control ,boundary condition and subsystem service. Implementation section describe a general description about how to operate each block of code. The last section that include in this document is questionnaires that we prepared for gathering information from the hotel.
Add room
manager Log in
Manger menu
Up date room Show room
Main Menu
receptionist Log in
Receptionist Menu
Cancel reservation ancel Update reservation rrrrereservation date reservation reservation Show reservation Update password password Show room
2.2.8 Documentation
The system includes help and support files. This help how to use the system and how to handle errors if it happens
2.3.1 Scenario
Scenario 1
Scenario name:-Guest wants to reserve room Participating actors:-Guest and Receptionist Flow of event:1. The guest gives all required information to Receptionist 2. The Receptionist informed about different room type availability and the price for each of room types 3. Guest can make an informed decision in what they want 4. After the reservation is complete the hotel database will assign a guest ID number to the new customer. 5. The Receptionist give confirmation number to the guest 6. The guest is concerned they are simply given a confirmation number for the reservation Which they present upon arrival.
Scenario 2
Scenario name:-Guest wants to cancel reservation Participating actors:-Guest and Receptionist Flow of event:1. the guest give the confirmation number to Receptionist 2. The Receptionist take confirmation number and using this number search the guest information from database then simple cancel reservation.
Scenario 3
Scenario name:-room failurity Participating actors:-room controller and manager Flow of event:1. If there is any failurity in the room e.g room window may brake, failurity in bath room etc room controller report this problem to the manger and also the room controller give the room number in which the failurity appear. 2. Manger accept the report and the room number if there is room that must be closed and it must be maintain the manger search the room according to room number and delete this room information from the data base.
Scenario 4
Scenario name:-add new room Participating actors:-room controller and manager Flow of event:1. If there is room that full fill quality and ready to be reserved the room controller report associated with all required room information this information to the manger. 2. Manger accepts the report and add the room based on information.
Use case name:-make reservation Participating actor: - initiated by guest communicate with Receptionist Entry condition:-1.guest request reservation service Flow of event:- 2. Receptionist choose receptionist login then create reservation 3.they will enter in the guest ID number(note: if it is a new guest they must enter in the guest information before making a reservation) the screen should fill the guest first and last name, address , phone number, nationality, room number data of arrival and departure. 4. After clicking button create conformation number will be displayed if the room is free or ths room is olredy resrved pleas select anoter room messge will display. Exit condition:-5 guests receive conformation number and give acknowledgment
Use case 2
Use case name:-cancel reservation Participating actor: - initiated by guest communicate with Receptionist Entry condition:-1.guest request to cancel reservation Flow of event: - 2. Receptionist choose receptionist login then cancel reservation 3. They will enter the guest id. After clicking button Cancel Successfully Deleted message is display if the guest id is correct.
8
Use case 3
Use case name:-change room pricing Participating actor: - manger Entry condition:-1.manger wants to change room price Flow of event: - 2. Manger select manger login then up date room information button from menu screen then enter room number and enter new price and other new information. After clicking button update if the room number is correct Successfully updated message will display. Exit condition:-3. exit
Use case 4
Use case name:-add room Participating actor: - manger Entry condition:-1.manger wants to add new room Flow of event: - 2. Manger select manger login button from menu screen then select add room button the screen should fill room number, room type, bed type .price per night and description. Then click add button. If the room number does not conflict previous room number. Successfully add room message will display. Exit condition:-3. exit
Use case 5
Use case name:-delete room Participating actor: - manger Entry condition:-1.manger wants to delete new room Flow of event: - 2. Manger select manger login button from menu screen then select delete room button
3. They will enter the room number and select delete button. if the room number is exist Successfully Deleted message will display Exit condition:-4 exit
Use case 6
Use case name:-check room availability Participating actor: - initiated by guest communicate with Receptionist Entry condition:-1. Receptionists want to check room availability Flow of event: - 2. Receptionist select receptionist login button from menu screen then select show room information button 3. They will enter the room number and select show button Exit condition:-4 if the room number is correct all information will display.
Use case 7:- pay for reservation Use case 8:- guarantee reservation Use case 9:- check and report room quality
2.3.2.3
10
cancel reservation
reseptionalist guest
make reservation
<<include>>
manager
2.4
object model
2.4.1 Identifying participant objects
This topic is concerned with describing objects that will be managed/manipulated by the system. The objects that will be managed are 1. Guest 2. Room
11
3. Employer 4. Reservation Attributes of the object are:. Object: - Guest Attribute: First_ name Last _name Address Nationality Phone number Id Object: - Room Attribute: Description Availability Bed type Room _number Priceper_night Object: - Employer Attribute: Employer first name Employer last name Employer id Password Phone number Address
Object: - Reservation
12
13
2.4.2
Class diagram
guest reservtion +conformation number -date of departure -date of arival * +room number -fname -lname +idno +address +nationality +phone number +make reservation() +cancel reservation() +payfor reservation() +gurantee reservation()
employer -fname -lname +idno +password +phone number +address +reservation service() * * * *
14
2.5
dynamic models
/Resptionsit
/GUI
/DB
6 : return message() 7 : return message() 8 : return message() 9 : give valide information() 10 : record informatin() 11 : get resrvation information,if valide()
/Resptionsit
/GUI
/DB
6 : return message() 7 : return message() 8 : return message() 9 : give valide room() 10 : inter room() 11 : get room number,if valide room number()
16
/GUI
/database
17
/GUI
/database
18
request reservation
select room
cancel reservation
19
20
requestresrvation
choose room
if[in valide]
else
else
21
delet room
add room
22
3. System design
3.1 Design goals
Design goals of the propose system
User interface:-it is front end the system and developed with Microsoft visual studio 2008 and this interface is convenient and attractive, easy to use, easily understandable by all users. Performance characteristics:- include the speed and space requirements imposed on the system. Speed:- the system should provide good response time and maximum throughput Space: - the system requires high memory available to optimize speed and the system should use memory sparingly. To achieve those Performance characteristics we use a relational database because, A relational database provides:-an abstraction of data that is higher than flat files, Complex queries over attributes, large dataset ,Relational databases have been used for awhile and are a mature technology. Security:-The application must implement basic security behaviors: Authentication: Login using a user name and a password Authorization: as per our software specifications, manager will have enhanced privileges to perform tasks that general user would not be authorized. Documentation:-The system includes help and support files. This help how to use the system and how to handle errors if it happens Error handling :- the system use exception handling mechanism and error report message box to indicate the error is occurred
interface
manager
recreationalist
Repository
database
24
Dell pc
Dell pc
Database server
Dell pc Acer pc
25
26
first name
nationality id
Guest
roomcost
roomno
Reservation
datearrival
comfiremno
datedeparture
make
Control Books
Employer
eaddress
username
eid
27
Guest table Attribute F_name L_name Id Phone no Address Nationality Room table Attribute room type bed type Availability room no Manger table Attribute F_name L_name Id Username Address Password Data type text text text text text text Data type text text text number Data type text text text text text text Length 25 25 25 25 25 Length 25 25 25
Length 25 25 25 25 25 25
Receptionist table Attribute F_name L_name Id Username Address Password Data type text text text text text text
28
Length 25 25 25 25 25 25
Reservation table Attribute room no in date Outdate Conformation no Cost per date Data type number number number number number Length
Guest
Room
Reservation
show reservation ()
Receptionist
Add room information () Delete room information () Update room information () Add guest information Show room () information() Delete guest information () Update guest information()
29
Application
30
manager resptionsit +crate reservation() +cancel reservation() +update reservation() +add room info() +delete room info() +update room info()
31
4. Implementation
1 create reservation
32
DateTime today= DateTime.Now; //to get the DateTime indate=dateTimePicker1.Value; DateTime outdate = dateTimePicker2.Value;
current date
if (fname.Text == "" && lname.Text == "" && nation.Text == "" && phone.Text == "") { MessageBox.Show("please fill all requrement"); } else if(indate<today||outdate<indate) { MessageBox.Show("please enter the correct date"); else { } if (isNumeric) MessageBox.Show("first name must text", "Error"); fname.Focus(); } else if (isNum) { MessageBox.Show("last name must text", "Error"); lname.Focus(); } else if (isn) { MessageBox.Show("nationality must text", "Error"); nation.Focus(); } else if (!isnu) { MessageBox.Show("phone number must be number");
try { if (phone.TextLength != 10) throw new Exception("pone number must be 10 diget"); } catch { MessageBox.Show("Invalid phone number", "Entry Error"); } }
/* the following code segement do first open connection with data base and reade the data from the room table by specifically select room number column records then coompare it with input room number if the input room number is not reserved previously all information in crete resrvation enter in to resrvation and geust tabe then Successfully create resrvation conformation number will display else ths room is olredy resrved pleas select anoter room message will displayed.or if the room number is doent exist in room table "there is no this type of room" message will display */
33
/ to open connection
OleDbDataReader reade = null; OleDbCommand cmdd = new OleDbCommand("select * from room where( r_number=" + room_no.Value + " ) ", con);//to
table
reade = cmdd.ExecuteReader(); while (reade.Read()) { rn = (int)reade["r_number"]; }
query = "insert into guest values ('" + fname.Text + "', ' " + lname.Text + "','" + id.Text + "', ' " + adress.Text + "','" + nation.Text + "'," + phone.Text + ",'" + male.Text + "')"; query2 = "insert into resrvation values ('" + dateTimePicker1.Value + "', '" + dateTimePicker2.Value + "'," + room_no.Value + ",'" + id.Text + "')";
in to database
OleDbCommand comm = new OleDbCommand(query2, con); OleDbCommand com = new OleDbCommand(query, con); com.ExecuteNonQuery(); comm.ExecuteNonQuery(); MessageBox.Show("Successfully create resrvation conformation number=>"+room_no.Value); } else if (female.Checked == true) { //con.Open(); query = "insert into guest values ('" + fname.Text + "', ' " + lname.Text + "','" + id.Text + "', ' " + adress.Text + "','" + nation.Text + "'," + phone.Text + ",'" + female.Text + "')";
34
query2 = "insert into resrvation values ('" + dateTimePicker1.Value + "', '" + dateTimePicker2.Value + "', " + room_no.Value + ",'" + id.Text + "')"; OleDbCommand comm = new OleDbCommand(query2, con); OleDbCommand com = new OleDbCommand(query, con); com.ExecuteNonQuery(); comm.ExecuteNonQuery(); MessageBox.Show("Successfully create resrvation conformation number=>" + room_no.Value); } } else { MessageBox.Show("there is no this type of room"); } } catch (OleDbException ) { MessageBox.Show("ths room is olredy resrved pleas select anoter room" ); } catch (Exception ex) { MessageBox.Show(ex.Message); } con.Close(); } }
35
2.Cancel reservation
/* the following code segement do first accept guest id to delet if the guest id is exist delet all information releted to this gust id number from guest and resrvation table then Successfully Deleted massage will displayed. Else there is no this roomnumbre massage will displayed.
string ss; OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\FAN\Documents\Visual Studio 2008\Projects\hotel\WindowsFormsApplication1\hotel.accdb"); public delet_resrvation() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string query; string query2; if (id.Text == "") { MessageBox.Show("enter the gguest id"); } else { try
36
{ con.Open(); OleDbDataReader reade = null; OleDbCommand cmdd = new OleDbCommand("select * from guest where (g_id='" + id.Text + "')", con); reade = cmdd.ExecuteReader(); while (reade.Read()) { ss = reade["g_id"].ToString(); } if (id.Text == ss) { query = "delete from guest where (g_id= '" + id.Text + "')"; query2 = "delete from resrvation where (g_id= '" + id.Text + "')"; OleDbCommand com = new OleDbCommand(query, con); OleDbCommand comm = new OleDbCommand(query2, con); com.ExecuteNonQuery(); comm.ExecuteNonQuery(); MessageBox.Show("Successfully } else { MessageBox.Show("there is no this roomnumbre"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } con.Close(); } } private void numericUpDown1_ValueChanged(object sender, EventArgs e) { } private void label3_Click(object sender, EventArgs e) { Form4 bbb = new Form4(); bbb.Show(); this.Hide(); } private void button2_Click(object sender, EventArgs e) Deleted ");
37
{ id.Text = ""; } private void button3_Click(object sender, EventArgs e) { this.Close(); } private void button4_Click(object sender, EventArgs e) { string query1; string query3; try { con.Open(); query1 = "delete * from guest "; query3 = "delete * from resrvation "; OleDbCommand comd = new OleDbCommand(query1, con); OleDbCommand commd = new OleDbCommand(query3, con); comd.ExecuteNonQuery(); commd.ExecuteNonQuery(); MessageBox.Show("Successfully Deleted"); } catch (Exception ex) { MessageBox.Show(ex.Message); } con.Close(); } } }
38
3.Update reservation
connect
//the following code segments used to validate input data that accept throw controls
private void button1_Click(object sender, EventArgs e) { int fnam, lnam, nat, phon,tex; bool isnumber = int.TryParse(textBox1.Text, out tex); bool isNumeric = int.TryParse(fname.Text, out fnam); bool isNum = int.TryParse(lname.Text, out lnam); bool isn = int.TryParse(nation.Text, out nat); bool isnu = int.TryParse(phone.Text, out phon); // bool isnumeri = int.TryParse(price.Text, out pr); DateTime today = DateTime.Now;
39
DateTime indate = dateTimePicker1.Value; DateTime outdate = dateTimePicker2.Value; if (textBox1.Text == "" && fname.Text == "" && lname.Text == "" && nation.Text == "" && phone.Text == "" ) { MessageBox.Show("please fill all requrement"); } else if (isNumeric) { MessageBox.Show("first name must text", "Error"); fname.Focus(); } else if (indate < today || outdate < indate) { MessageBox.Show("please enter the correct date"); } else if (isNum) { MessageBox.Show("last name must text", "Error"); lname.Focus(); } else if (isn) { MessageBox.Show("nationality must text", "Error"); nation.Focus(); } else if (!isnu) { MessageBox.Show("phone number must be number"); try { if (phone.TextLength != 10) throw new Exception("pone number must be 10 diget"); } catch { MessageBox.Show("Invalid phone number", "Entry Error"); } } else {
/*The following code segment do it accept guest id if the guest id is exist up date all information related to this guest id then Successfully updated message will
40
OleDbCommand cmdd = new OleDbCommand("select * from guest where (g_id=" + textBox1.Text + ")", con); reade = cmdd.ExecuteReader(); while (reade.Read()) { ss = reade["g_id"].ToString(); } if (textBox1.Text == ss) { if (male.Checked == true) { query = "update guest set g_fname='" + fname.Text + "', g_lname=' " + lname.Text + "',g_id= " + id.Text + ",g_address= '" + adress.Text + "',g_nation='" + nation.Text + "' ,g_phone=" + phone.Text + ",g_sex='" + male.Text + "' where ( g_id= '" +id.Text+ "')"; query2 = "update resrvation set in_date='" + dateTimePicker1.Value + "', out _date=' " + dateTimePicker2.Value + "',r_number= " + numericUpDown1.Value + ",g_address= '" + adress.Text + "',g_id='" + id.Text + "' where ( g_id= '" + id.Text + "')";
//sql command
query = "update guest set g_fname='" + fname.Text + "', g_lname=' " + lname.Text + "',g_id= " + id.Text + ",g_address= '" + adress.Text + "',g_nation='" + nation.Text + "' ,g_phone=" + phone.Text + ",g_sex='" + female.Text+ "' where ( g_id= '" +id.Text+ "')"; query2 = "update resrvation set in_date='" + dateTimePicker1.Value + "', out _date=' " + dateTimePicker2.Value + "',r_number= " + numericUpDown1.Value + ",g_address= '" + adress.Text + "',g_id='" + id.Text + "' where ( g_id= '" + id.Text + "')"; OleDbCommand com = new OleDbCommand(query, con); OleDbCommand comm = new OleDbCommand(query2, con); com.ExecuteNonQuery(); comm.ExecuteNonQuery(); MessageBox.Show("Successfully } } else { MessageBox.Show("incorreect gust id"); updated");
41
} } catch (Exception ex) { MessageBox.Show(ex.Message); } con.Close(); } } private void r_Click(object sender, EventArgs e) { } private void label15_Click(object sender, EventArgs e) { Form4 vvp = new Form4(); vvp.Show(); this.Hide(); } private void textBox4_TextChanged(object sender, EventArgs e) { } private void button2_Click(object sender, EventArgs e) { fname.Text = ""; lname.Text = ""; id.Text = ""; adress.Text = ""; numericUpDown1.Value =0 ; nation.Text = ""; phone.Text = ""; // level.SelectedIndex=0; // price.Text = ""; } private void numericUpDown1_ValueChanged(object sender, EventArgs e) { } private void label2_Click(object sender, EventArgs e) { } } }
42
4. Show reservation
/*The following code segment used to show specifically reservation information it first accept guest id then compare it with guest information in guest table if it excites it retrieve all reservation information related to inserted guest id and show in the data grid view else it return incorrect id message.*/
string ss; OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\FAN\Documents\Visual Studio 2008\Projects\hotel\WindowsFormsApplication1\hotel.accdb");//to
connect
43
{ try { con.Open(); OleDbDataReader reade = null; OleDbCommand cmdd = new OleDbCommand("select * from guest where (g_id='" + textBox1.Text + "')", con);
information in table */
reade = cmdd.ExecuteReader(); while (reade.Read()) { ss = reade["g_id"].ToString(); // pa = reade["pass"].ToString(); // ss = reade["g_id"]; } if (textBox1.Text == ss) { // con.Open(); string query = " select * from resrvation where(g_id='" + textBox1.Text + "')"; DataTable dt = new DataTable(); OleDbDataAdapter da = new OleDbDataAdapter(query, con); da.Fill(dt); dataGridView1.DataSource = dt; } else { MessageBox.Show("incorrect id"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } con.Close(); } }
44
con.Open(); string query = " select * from resrvation "; DataTable dt = new DataTable(); OleDbDataAdapter da = new OleDbDataAdapter(query, con); da.Fill(dt); dataGridView1.DataSource = dt; con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
// the following code segments used to up date receptionist password it first accept the previous receptionist password and compare it with receptionist password in the receptionist table if it exist update the password and user name then display Successfully up dated message else it display incoorect password please
45
private void button1_Click(object sender, EventArgs e) { string query; try { con.Open(); OleDbDataReader reade = null; OleDbCommand cmdd = new OleDbCommand("select * from receptionist", con); reade = cmdd.ExecuteReader(); while (reade.Read()) { pa = reade["pass"].ToString(); } if (p_pass.Text==pa) { query = "update receptionist set u_name='" + u_name.Text + "' ,pass='" + n_pass.Text + "' where ( pass= '" + p_pass.Text + "')"; OleDbCommand com = new OleDbCommand(query, con); com.ExecuteNonQuery(); MessageBox.Show("Successfully up dated"); } else { MessageBox.Show("enter correct information"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } con.Close(); }
46
// the following code segments used to up date manger password it first accept the previous manger password and compare it with manger password in the manger table if it exist update the password and user name then display Successfully up
dated message else it display incoorect password please enter the correct information message.*/
public partial class mang_login : Form { OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\FAN\Documents\Visual Studio 2008\Projects\hotel\WindowsFormsApplication1\hotel.accdb"); string pa; public mang_login() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string query; try { con.Open(); OleDbDataReader reade = null; OleDbCommand cmdd = new OleDbCommand("select * from manger", con); reade = cmdd.ExecuteReader();
47
while (reade.Read()) { pa = reade["pass"].ToString(); } if (p_pass.Text == pa) { query = "update manger set u_name='" + n_uname.Text + "', pass='" + n_pass.Text + "' where(pass='" + p_pass.Text + "')"; OleDbCommand com = new OleDbCommand(query, con); com.ExecuteNonQuery(); MessageBox.Show("Successfully cange password"); } else { MessageBox.Show("please enter the correct information"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } con.Close(); }
7. Add room
48
/* when the manager want to add new room first fill all required information and check weather it is in correct format or not and if the data is valid insert the data to room table and insert successfully message will be displayed.
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\FAN\Documents\Visual Studio 2008\Projects\hotel\WindowsFormsApplication1\hotel.accdb"); public add_room() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string query; int num; bool isnum = int.TryParse(price.Text, out num); if (price.Text == "" && numericUpDown1.Value == 0) { MessageBox.Show("please fill all requrment"); } else if (!isnum) { MessageBox.Show("price must be number"); } else { try { con.Open(); query = "insert into room values (" + numericUpDown1.Value + ", ' " + comboBox1.SelectedItem + "', " + numericUpDown2.Value + ", " + numericUpDown3.Value + "," + price.Text + ")"; OleDbCommand com = new OleDbCommand(query, con); com.ExecuteNonQuery(); MessageBox.Show("Successfully add room"); } catch (OleDbException t) { MessageBox.Show("ths room is olredy execet please enter anoter room number"+t); } catch (Exception ex) { MessageBox.Show(ex.Message); } con.Close(); }
49
8.cancel room
/* to cancel room from room table insert the room number and chcek wehter the room number is found or not and if it is found cancel the spesified room from room table and delate succesfuly message will be displayed. If the room is not avalable the room not found missage will be displayed.
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\FAN\Documents\Visual Studio 2008\Projects\hotel\WindowsFormsApplication1\hotel.accdb"); string ss; public delete_room() { InitializeComponent(); } private void button2_Click(object sender, EventArgs e) { textBox1.Text = ""; } private void button3_Click(object sender, EventArgs e) { this.Close(); }
50
{ MessageBox.Show("enter the room number"); } else if(!isnumbr) { MessageBox.Show("room number must be number"); } else { con.Open(); OleDbDataReader reade = null; OleDbCommand cmdd = new OleDbCommand("select * from room where (r_number=" + textBox1.Text+ ")", con); reade = cmdd.ExecuteReader(); while (reade.Read()) { ss = reade["r_number"].ToString(); } if (textBox1.Text == ss) { query = "delete * from room where ( r_number= " + textBox1.Text + ")"; OleDbCommand com = new OleDbCommand(query, con); com.ExecuteNonQuery(); MessageBox.Show("Successfully Deleted"); } else{ MessageBox.Show("room number note found"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } con.Close(); } private void label3_Click(object sender, EventArgs e) { Form3 ccc = new Form3(); ccc.Show(); this.Hide(); } } }
51
8. Update room
/* to update the room information first accept room number that need to be updated and check the room is found or not. if it is found, insert all information about the room and validate the data if it is in a correct format insert the updated information to room table and update successfully message will found. Else room is not found message will be displayed.
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\FAN\Documents\Visual Studio 2008\Projects\hotel\WindowsFormsApplication1\hotel.accdb"); string ss; public up_date_room() { InitializeComponent(); } private void up_date_room_Load(object sender, EventArgs e) { } private void textBox1_TextChanged(object sender, EventArgs e) {
52
} private void button1_Click(object sender, EventArgs e) { int num; bool isnum = int.TryParse(price.Text, out num); if (price.Text == "" &&pre_roomno.Value == 0) { MessageBox.Show("please fill all requrment"); } else if (!isnum) { MessageBox.Show("price must be number"); } else { try { con.Open(); OleDbDataReader reade = null; OleDbCommand cmdd = new OleDbCommand("select * from room where (r_number=" +pre_roomno.Value + ")", con);
string query; query = "update room set r_number=" + new_roomno.Value + ", r_level=' " + leve.SelectedItem + "',n_bed= " + no_bed.Value + ",buld= " + buld.Value + ",price=" + price.Text + " where ( r_number = " + pre_roomno.Value + ")";);
room information*/
OleDbCommand com = new OleDbCommand(query, con); com.ExecuteNonQuery(); MessageBox.Show("Successfully updated");
53
/*to show room information first insert the specified room number that need to be displayed and if the room number is available the room information is displayed through data grid view. Else room is not found message will be displayed.
*/ public partial class show_room : Form { OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data
54
Source=C:\Users\FAN\Documents\Visual Studio 2008\Projects\hotel\WindowsFormsApplication1\hotel.accdb"); string ss; public show_room() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { int room; bool isnumbr=int.TryParse(textBox1.Text,out room); try { if (textBox1.Text == "") { MessageBox.Show("enter the room number"); } else if(!isnumbr) { MessageBox.Show("room number must be number"); } else { con.Open(); OleDbDataReader reade = null; OleDbCommand cmdd = new OleDbCommand("select * from room where (r_number=" + textBox1.Text+ ")", con); reade = cmdd.ExecuteReader(); while (reade.Read()) { ss = reade["r_number"].ToString(); } if (textBox1.Text == ss) { string query = " select * from room where(r_number=" + textBox1.Text + ")"; DataTable dt = new DataTable(); OleDbDataAdapter da = new OleDbDataAdapter(query, con); da.Fill(dt); dataGridView1.DataSource = dt; } else{ MessageBox.Show("room number not found"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); }
55
con.Close(); }
56
5. Questioner
We prepare the question for gathering all information about the current system , to identify the problem and the requirement of users ,and we get all relevant information from hotel manger(Ato Zekarias Tefera). And he gives all response according to our question.
1. When the hotel was established? 2. What kind of system is using? 3. How many employers was there? 4. How mach was its capital? 5. What kind of data storage was used? 6. What are the statues of the current system? 7. How many employers are working on the organization currently? 8. What is work division looks like? 9. How mach capital it has currently? 10. What are the problems of the current system? 11. What kind of system need to be developed? 12. What are the requirements do you need to incorporate?
57