会议室预定系统数据库文件BookRoom

/*

本SQL脚本是本人毕业设计“会议室预定系统”的数据库文件,名为BookRoom.sql

DBMS:MySQL

*/

 

 

 

/*==============================================================*/

/* DBMS name:      MySQL 5.0                                    */

/* Created bookRoomon:     2009/03/15 19:55:29                          */

/*==============================================================*/

 

/*==============================================================*/

/* Database: BookRoom                                         */

/*==============================================================*/

create database if not exists BookRoom;

 

Use BookRoom;

 

drop table if exists tblEmployee;

 

drop table if exists tblRoom;

 

drop table if exists tblReserve;

 

 

/*==============================================================*/

/* Table: tblEmployee                                           */

/*==============================================================*/

create table if not exists tblEmployee

(

   empId           int not null AUTO_INCREMENT comment 'primary key can not have a default value',

   empCardNo         varchar(20) default '' comment 'Employee ID can be leaded by 0,  so we set it''s type varchar.',

   empName           varchar(100) default '',

   empSex            varchar(20) default '',

   empWorkDateBegin  date default NULL comment 'YYYY-MM-DD',

   empTel            varchar(100) default '' comment 'It can either be a mobile telephone number or a office telephone number or both.',

   empEMail          varchar(100) not null unique default '' comment 'this empty string equals the dbms own default value',

   empPwd            varchar(100) not null default '',

   empRole varchar(50) not null default '',

   constraint empId primary key (empId)

)engine=InnoDB, charset=utf8, comment='Every person including the boss in the company is defined as employee';

 

/*

create index idxEmpId on tblemployee(empId);

create index idxEmpEMail on tblemployee(empEMail);

*/

 

/*==============================================================*/

/* Table: tblRoom                                             */

/*==============================================================*/

create table if not exists tblRoom

(

   roomId            int not null AUTO_INCREMENT comment 'Generated by the database automatically.',

   roomBuilding        varchar(100) not null default '' comment 'When you reserve a meeting room, you may firstly choose a building. 

            And then choose one meeting room in the building.

            Of course all the buildings and meeting rooms are listed for you.',

   roomNo              varchar(50) default '' comment 'Meeting rooms belong to every building are listed out for choosing.',

   roomName            varchar(100) not null default '',

   roomAddr            varchar(300) default '',

   constraint roomId primary key (roomId)

)engine=InnoDB, charset=utf8, comment='There are meeting rooms, which names may be the same(eg:"The First Meeting Room';

 

/*create index idxRoomId on tblRoom(roomId);*/

 

/*==============================================================*/

/* Table: tblReserve                                        */

/*==============================================================*/

create table if not exists tblReserve

(

   rsrvId          int not null AUTO_INCREMENT comment 'Generated by the database automatically.',

   empId           int not null default 0 comment 'the default value of foreign key is better',

   roomId          int not null default 0,

   rsrvDateBegin     date not null comment 'if it is not null, its default value should be null',

   rsrvDateEnd       date not null,

   rsrvTimeBegin     time not null,

   rsrvTimeEnd       time not null,   

   rsrvMtTitle       varchar(100) default '',

   rsrvDateTime      datetime default NULL,

   constraint rsrvId primary key (rsrvId),

   constraint empId foreign key (empId) REFERENCES tblEmployee(empId) on delete cascade on update cascade,

   constraint roomId foreign key (roomId) REFERENCES tblRoom(roomId) on delete cascade on update cascade

)engine=InnoDB, charset=utf8;

 

/*

create index idxRsrvId on tblReserve(rsrvId);

create index idxEmpId on tblReserve(empId);

create index idxRoomId on tblReserve(roomId);

*/

 

/*向员工表tblEmployee插入测试数据*/

insert into tblEmployee(empCardNo, empName, empSex, empWorkDateBegin, 

empTel, empEMail, empPwd, empRole)

values('S200707M00001', 'admin', 'female', '2000-01-01', 

'024001', 'admin@neusoft.com', '21232f297a57a5a743894a0e4a801fc3', 'admin');

insert into tblEmployee(empCardNo, empName, empSex, empWorkDateBegin, 

empTel, empEMail, empPwd, empRole)

values('S200707M01395', 'xielj', 'male', '2009-07-01', 

'13073548356', 'xielj@neusoft.com', 'eb530b803b2c31fea96cda98a8eb377d', 'user');

insert into tblEmployee(empCardNo, empName, empSex, empWorkDateBegin, 

empTel, empEMail, empPwd, empRole)

values('S200707M00002', 'linice', 'male', '2009-07-01', 

'13080719544', 'linice@neusoft.com', '4937ab52f35373e3391d5b98a4817258', 'user');

 

insert into tblEmployee(empCardNo, empName, empSex, empWorkDateBegin, 

empTel, empEMail, empPwd, empRole)

values('S200707M01395', 'neusoft', 'female', '2000-07-01', 

'024002', 'neusoft@neusoft.com', 'f7377865580a02f9a89533b31e4ca7b7', 'user');

 

 

/*向会议室表tblRoom插入测试数据*/

insert into tblRoom(roomBuilding, roomNo, roomName, roomAddr)

values('conference center', '101', 'linux', 'conference center');

 

insert into tblRoom(roomBuilding, roomNo, roomName, roomAddr)

values('conference center', '102', 'C#', 'conference center');

 

insert into tblRoom(roomBuilding, roomNo, roomName, roomAddr)

values('conference center', '201', 'sql', 'conference center');

 

insert into tblRoom(roomBuilding, roomNo, roomName, roomAddr)

values('A1', '101', 'java', 'A1');

 

insert into tblRoom(roomBuilding, roomNo, roomName, roomAddr)

values('A1', '102', 'C', 'A1');

 

insert into tblRoom(roomBuilding, roomNo, roomName, roomAddr)

values('A1', '103', 'C++', 'A1');

 

 

/*向预定表 tblReserve 插入测试数据*/

insert into tblReserve(empId, roomId, rsrvDateBegin, rsrvDateEnd, 

rsrvTimeBegin, rsrvTimeEnd, rsrvMtTitle, rsrvDateTime)

values(2, 4, '2009-5-2', '2009-5-2', '6:00', '8:00', 'why to learn java275', '2009-4-30 9:00');

 

insert into tblReserve(empId, roomId, rsrvDateBegin, rsrvDateEnd, 

rsrvTimeBegin, rsrvTimeEnd, rsrvMtTitle, rsrvDateTime)

values(2, 4, '2009-5-2', '2009-5-2', '13:00', '15:00', 'how to learn java275', '2009-4-30 15:45');

 

insert into tblReserve(empId, roomId, rsrvDateBegin, rsrvDateEnd, 

rsrvTimeBegin, rsrvTimeEnd, rsrvMtTitle, rsrvDateTime)

values(2, 4, '2009-5-2', '2009-5-2', '9:00', '11:00', 'learn java314', '2009-5-2 17:1');

bookmtroom

insert into tblReserve(empId, roomId, rsrvDateBegin, rsrvDateEnd, 

rsrvTimeBegin, rsrvTimeEnd, rsrvMtTitle, rsrvDateTime)

values(2, 4, '2009-5-2', '2009-5-2', '15:00', '17:00', 'why to learn japanese', '2009-5-7 8:30');

 

insert into tblReserve(empId, roomId, rsrvDateBegin, rsrvDateEnd, 

rsrvTimeBegin, rsrvTimeEnd, rsrvMtTitle, rsrvDateTime)

values(2, 4, '2009-5-2', '2009-5-2', '4:00', '6:00', 'learn japanese', '2009-5-7 8:30');

 

insert into tblReserve(empId, roomId, rsrvDateBegin, rsrvDateEnd, 

rsrvTimeBegin, rsrvTimeEnd, rsrvMtTitle, rsrvDateTime)

values(2, 4, '2009-5-2', '2009-5-2', '9:00', '14:00', 'learn japanese', '2009-5-7 8:30');

 

insert into tblReserve(empId, roomId, rsrvDateBegin, rsrvDateEnd, 

rsrvTimeBegin, rsrvTimeEnd, rsrvMtTitle, rsrvDateTime)

values(2, 4, '2009-5-2', '2009-5-2', '7:00', '13:00', 'learn japanese', '2009-5-7 8:30');

 

insert into tblReserve(empId, roomId, rsrvDateBegin, rsrvDateEnd, 

rsrvTimeBegin, rsrvTimeEnd, rsrvMtTitle, rsrvDateTime)

values(2, 4, '2009-5-2', '2009-5-2', '7:00', '14:00', 'learn japanese', '2009-5-7 8:30');

 

 

 

 

用C++编写一个宾馆客房管理系统涉及到多个组件和功能。下面是一个简单的概述和实现方案的介绍: ### 1. 需求分析 在开始编写代码之前,首先要确定系统需要哪些功能。一个基本的宾馆客房管理系统可能包括: - 房间管理:添加、修改、删除和查询房间信息。 - 预订管理:客人可以预订房间,并且可以查看预订状态。 - 客人管理:添加、修改、删除客人信息。 - 财务管理:记录客房的收入和支出情况。 ### 2. 系统设计 接下来要设计系统的数据结构和类的层次结构。比如可以设计以下几个类: - `Room`:代表房间,包含房间号、类型、价格、状态(空闲、预订、占用)等属性。 - `Guest`:代表客人,包含客人的姓名、身份证号、联系方式等属性。 - `Booking`:代表预订信息,包含客人信息、房间信息、预订时间、退房时间等属性。 - `HotelManager`:酒店管理类,提供接口来添加、删除、修改和查询房间和客人信息。 ### 3. 功能实现 根据设计,用C++实现具体的类和功能。例如: ```cpp class Room { public: int roomNumber; double price; bool isOccupied; // 其他属性和方法 }; class Guest { public: std::string name; std::string idNumber; std::string contact; // 其他属性和方法 }; class Booking { public: Guest guest; Room room; std::string checkInTime; std::string checkOutTime; // 其他属性和方法 }; class HotelManager { public: std::vector<Room> rooms; std::vector<Guest> guests; std::vector<Booking> bookings; void addRoom(Room room) { // 添加房间逻辑 } void bookRoom(Booking booking) { // 预订房间逻辑 } // 其他管理功能实现 }; ``` ### 4. 用户界面 为方便用户操作,需要设计一个简单的文本或图形用户界面。如果是文本界面,可以通过控制台输入和输出来实现。如果是图形界面,则可能需要使用如Qt、wxWidgets等图形界面库。 ### 5. 数据存储 系统需要持久化存储数据。可以将数据保存到文件数据库中。根据需要实现数据的加载、保存和更新。 ### 实现示例代码(房间添加功能): ```cpp void HotelManager::addRoom(Room room) { rooms.push_back(room); std::cout << "房间添加成功!房间号: " << room.roomNumber << std::endl; } ``` ### 注意事项: - 保证数据的一致性和完整性。 - 对输入数据进行有效性和合法性校验。 - 实现错误处理和异常管理机制。 - 考虑多线程环境下数据同步问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值