import pymysql
import datetime
connection = pymysql.connect(host='localhost', port=3306, user='root', password='123456', db='hotel', charset='utf8')
# 客户办理入住
def create_kh():
try:
uno = input('请输入客户编号>>: ')
uname = input('请输入客户姓名>>: ')
usex = input('请输入客户性别>>: ')
uid = input('请输入客户身份证号>>: ')
utel = input('请输入客户联系方式>>: ')
cursor = connection.cursor()
sql = 'INSERT INTO user(uno, uname, usex, uid,utel) VALUES(%s,%s,%s,%s,%s)'
result = cursor.execute(sql,(uno, uname, usex, uid,utel))
print('受影响行数:', result)
connection.commit()
cursor.close()
except Exception as e:
print('操作失败,失败信息为:', e)
finally:
connection.close()
# 客户健康打卡
def create_dk():
try:
hid = input('请输入卡的编号>>: ')
htemp = input('请输入体温>>: ')
hkey = input('请输入健康码颜色>>: ')
htype = input('请输入健康状态>>: ')
cursor = connection.cursor()
sql = 'INSERT INTO health(hid, htemp, hkey, htype) VALUES(%s,%s,%s,%s)'
result = cursor.execute(sql,(hid, htemp, hkey, htype))
print('受影响行数:', result)
connection.commit()
cursor.close()
except Exception as e:
print('操作失败,失败信息为:', e)
finally:
connection.close()
# 更新退房时间
def update_sj():
try:
uno = input('更新退房时间,请输入客户编号>>: ')
outtime = datetime.datetime.today()
cursor = connection.cursor()
sql = 'UPDATE live SET outtime = %s WHERE uno = %s'
result = cursor.execute(sql,(outtime, uno))
print('受影响行数:', result)
connection.commit()
cursor.close()
except Exception as e :
print('操作失败,失败信息为:', e)
connection.rollback()
finally:
connection.close()
def create_yg():
try:
rno = input('请输入房间编号>>: ')
rtype = input('请输入房间类型>>: ')
rstate = input('请输入房间状态>>: ')
rprice = input('请输入房间价格>>: ')
cursor = connection.cursor()
sql = 'INSERT INTO room(rno, rtype, rstate, rprice) VALUES(%s,%s,%s,%s)'
result = cursor.execute(sql,(rno, rtype, rstate, rprice))
print('受影响行数:', result)
connection.commit()
cursor.close()
except Exception as e:
print('操作失败,失败信息为:', e)
finally:
connection.close()
# 员工删除房间
def delete_fj():
try:
rno = input('请输入房间编号>>:')
cursor = connection.cursor()
sql = 'DELETE FROM room WHERE rno = %s'
sql = sql % rno
print(sql)
result = cursor.execute(sql)
print('删除的数据为:', result)
connection.commit()
cursor.close()
except Exception as e:
print('操作失败,失败信息为:', e)
connection.rollback()
finally:
connection.close()
# 员工删除客户
def delete_kh():
try:
uno = input('请输入客户编号>>:')
cursor = connection.cursor()
sql = 'DELETE FROM user WHERE uno = %s'
sql = sql % uno
print(sql)
result = cursor.execute(sql)
print('删除的数据为:', result)
connection.commit()
cursor.close()
except Exception as e:
print('操作失败,失败信息为:', e)
connection.rollback()
finally:
connection.close()
# 员工查询客户信息
def select_kh():
try:
uno = input('请输入客户编号>>: ')
cursor = connection.cursor()
sql = 'SELECT uno, uname , usex , uid , utel FROM user WHERE uno = %s'
cursor.execute(sql, (uno,))
result = cursor.fetchone()
print('查询到数据为:', result)
except Exception as e:
print('操作失败,失败信息为:', e)
connection.close()
# 员工查询房间信息
def select_room():
try:
cursor = connection.cursor()
sql = "SELECT * FROM room;"
cursor.execute(sql)
results = cursor.fetchall()
print('执行sql成功:', sql)
print('查询结果:')
print("rno\t\t\t", "rtype\t\t\t\t\t\t\t", "rstate\t\t\t\t\t", "rprice\t\t\t")
# 遍历结果
for row in results:
rno = row[0]
rtype = row[1]
rstate = row[2]
rprice = row[3]
print(rno, "\t\t\t", rtype, "\t\t\t", rstate, "\t\t\t", rprice)
except Exception as e:
raise e
connection.close()
# 选择菜单
def Menu():
print('*************************欢迎来到酒店管理系统********************')
print('\t\t\t\t1.客户办理入住')
print('\t\t\t\t2.客户健康打卡')
print('\t\t\t\t3.客户办理退房')
print('\t\t\t\t4.员工增加房间')
print('\t\t\t\t5.员工删除房间')
print('\t\t\t\t6.员工删除客户')
print('\t\t\t\t7.员工查询客户信息')
print('\t\t\t\t8.员工查询房间信息')
print('\t\t\t\t0.退出')
print('************************************************************')
# 主程序
def main():
print('##########################酒店管理系统###########################')
while True:
Menu()
select=eval(input('请选择功能:'))
if select==1:
create_kh()
print('办理入住成功!')
print('\n')
elif select==2:
create_dk()
print('打卡成功!')
print('\n')
elif select==3:
update_sj()
print('办理退房成功!')
print('\n')
elif select==4:
create_yg()
print('添加房间成功!')
print('\n')
elif select==5:
delete_fj()
print('删除房间成功!')
print('\n')
elif select==6:
delete_kh()
print('删除客户成功!')
print('\n')
elif select==7:
select_kh()
print('\n')
elif select==8:
select_room()
print('\n')
else:
print('谢谢使用')
break
if __name__ == '__main__':
main()
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
1 引言 1 1.1 项目背景 1 1.2 编写目的 1 1.3 软件定义 1 1.4 开发环境 1 2 需求分析 3 2.1 系统需求分析 3 2.2 数据字典 4 3 概念结构设计 12 3.1 概念结构 12 3.2 主要任务 12 3.3 基本属性 12 3.4 联系 12 3.5 E-R图 13 4 逻辑结构设计 15 4.1 逻辑结构 15 4.2 关系模式 16 4.3 数据完整性约束 16 5 物理结构设计 17 5.1 物理结构 17 5.2 关系模式的存取方法 17 5.3 实现 17 5.4 表定义 17 6 数据库实施 22 6.1 数据输入 22 6.2 编码过程 23 7 系统调试、测试 26 7.1 系统功能测试 26 8 总结与心得 31 参考文献: 31
资源推荐
资源详情
资源评论
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/DOCX.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 12 条
- 1
![avatar](https://profile-avatar.csdnimg.cn/80330ab4ae7d4abd907165e5b38da0b3_weixin_40228600.jpg!1)
程序员小蛋
- 粉丝: 2699
- 资源: 491
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- 打包和分发Rust工具.pdf
- SQL中的CREATE LOGFILE GROUP 语句.pdf
- C语言-leetcode题解之第172题阶乘后的零.zip
- C语言-leetcode题解之第171题Excel列表序号.zip
- C语言-leetcode题解之第169题多数元素.zip
- ocr-图像识别资源ocr-图像识别资源
- 图像识别:基于Resnet50 + VGG16模型融合的人体细胞癌症分类模型实现-图像识别资源
- C语言-leetcode题解之第168题Excel列表名称.zip
- C语言-leetcode题解之第167题两数之和II-输入有序数组.zip
- C语言-leetcode题解之第166题分数到小数.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)
- 1
- 2
- 3
- 4
- 5
- 6
前往页