酒店管理系报告册样本_第1页
酒店管理系报告册样本_第2页
酒店管理系报告册样本_第3页
酒店管理系报告册样本_第4页
酒店管理系报告册样本_第5页
已阅读5页,还剩68页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

目录1绪论:................................................1项目背景...................................................1项目重要目...............................................1系统有关技术简介......................................2C#窗体应用程序技术简介.....................................2SQL技术....................................................2数据库基本概念....................................2系统分析..............................................3技术可行性分析.............................................3系统逻辑构造图.............................................4程序流程图.................................................4数据库设计............................................5数据库概念构造设计.........................................5数据库逻辑构造设计.........................................6系统各模块实现......................................6登录.......................................................6主界面.....................................................7新增客房类型窗体...........................................7客房管理信息...............................................8入住登记窗体...............................................8房间信息窗体...............................................8入住信息窗体...............................................9新增房间...................................................9客房管理..................................................9关于......................................................9系统测试.............................................116.1测试目..................................................116.2测试办法..................................................116.3测试实例..................................................117总结................................................128附录................................................12绪论项目背景:21世纪是以网络广泛、全面、进一步运用为特性信息化社会。近十年来随着国内经济迅速发展以及“黄金周”休息日增多,人们消费能力和消费水平有切都给国内酒店业发展带来了无穷契机。当代星级酒店作为一种都市名片和对外窗口,其酒店形象、服务水平和周边旅游都至关重要。能为消费者提供周到、便捷、方向。这就规定酒店管理需要使用更有效信息化手段,广泛拓展经营空间,进一步减少运营成本。针对酒店运营质量和管理效率需求,文章采用C#语言编写、结合.NET三层架构,运用SQLServer数据库存储数据设计并实现酒店管理系统。文章一方面对系统进行分析,然后依次对系统、数据库、及界面进行设计,最后实现了基于.NET三层架构酒店管理系统。随着商品化经济发展,再加上入境旅游人也越来越多,入境从事商务活动外宾也越来越多。老式手工已不适应当代化酒店管理需要。及时、精确、全方位网络化信息管理成为必须。旅游规模不断扩大,随之而来就是酒店管理问题,只依托人工记账管理体制已经无法适应当代酒店发展,这就需要有一种先进管理系统来管理如此繁杂信息。在酒店业竞争日益激烈今天,酒店管理成为留住客人一种重要因素。酒店管理系统应用,将使得酒店在管理方面迈上一种新台阶,成为提高酒店管理效率、改进服务水准重要手段之一。当前及将来,酒店竞争将重要在智能化,信息化方面展开,酒店信息化发展势在必行。整个系统从符合操作简便、界面简洁明了、灵活、实用、安全规定出发。在功能上系统可以完毕管理员登陆对有关信息浏览、退出,添加、删除、修改等功能。账户管理,酒店管理1.2项目重要目1.课程设计目数据库课程设计是数据库系统原理实践环节极为重要某些,其目是:(1)培养学生可以应用数据库系统原理在需求分析基本上对系统进行概念设计。培养学生可以应用数据库系统在概念设计基本上应用关系规范化理论对系统进行逻辑设计。(3)培养学生可以应用SQL语言对所设计规范化关系模型进行物理设计,并且可以应用事务解决,存储过程,触发器以保证数据库系统数据完整性,安全性,一致性,保证数据共享和防止数据冲突;(4)培养学生理论与实际相结合能力,使之可以纯熟掌握一种数据库系统(如SQLSERVER)使用,培养学生开发创新能力。(5)通过设计实际数据库系统应用课题,使学生进一步熟悉数据库管理系统操作技术,提高学生独立分析问题,解决问题,查阅资料以及自学能力,以适应计算机产业日新月异发展形势;提高和加强学生计算机应用与软件开发能力。2.基本规定:(1)规定在VS环境下调试完毕;(2)规定划分功能模块,各个功能分别使用函数来完毕;(3)源代码程序规定必要注释。(4)构建布局合理美观Windows窗体(5)使用ADO.NET操作数据(6)在ADO.NET中使用存储过程(7).NET中Excel导入导出(8)DataGridView数据筛选(9)异常解决3.设计办法与基本原理

1.课题功能描述

设计一种酒店管理系统,规定实现功能涉及:a.顾客需在登陆页输入顾客名、密码,通过身份验证后才可对酒店客房进行管理操作。b.基本信息维护功能房间房间编号房间类型……c.房间类型退房功能入住信息查询记录房款将订房状态改为结账状态d.入住登记窗体可录入身份证号、姓名、押金、房间和入住时间入住时间可使用日历输入下拉方式选取空闲房间4.问题解决方案:

依照问题描述,可以按照程序规定功能采用构造化设计思想。5.系统概述:实现酒店房间入住登记和退房实现酒店房间基本信息维护房间类型房间维护实现房间状态查看系统角色:管理员2系统有关技术简介:2.1.Net三层架构应用程序技术简介.NET是MicroSoft公司为适应Internet高速发展需要,而隆重推出新开发平台,是当前最流行Windows平台应用程序开发环境。可以用来创立Windows平台下Windows应用程序和网络应用程序,也可以用来创立网络服务、智能设备应用程序和Office插件等。B/S架构应用由于客户端免安装而广受欢迎,而对于业务解决繁琐、客户交互复杂应用系统,三层架构受客户端模式则是更为合用方式。三层是指:数据数据访问层,业务逻辑层,表达层。DAL(数据数据访问层)操作数据BLL(业务逻辑层)调用DALUI(表达层)调用BLLModel层贯穿三层。2.2SQL技术:2.2.1

数据库基本概念

SQL构造化增删改查,是一种数据库查询和程序设计语言,用于存取数据以及查询、更新和管理关系数据库系统。

SQL语言涉及:数据定义语言、数据操作语言、数据查询语言、数据控制语言四某些。它不规定顾客指定对数据存储办法,也不需要顾客理解详细数据存储方式,所有具备完全不同底层构造不同数据库系统,可以使用相似SQL语言作为数据输入与管理接口。它以记录集合伙为操作对象,所有SQL语句接受集合伙为输入,返回集合伙为输出,这种集合特性容许一条SQL语句输出作为另一条SQL语句输入,因此SQL语句可以嵌套,这使它具备极大灵活性和强大功能。3系统分析3.1技术可行性分析:本系统采用当前被广泛使用C#开发技术、SQL

Server

数据库技术。同步使用Visul

Studio

作为开发平台运用.NET三层架构做得一种酒店管理系统,采用SQL

Server

数据库。到当前为止,SQL数据库依然是使用最广泛一种数据库语言,因而本系统采用SQL

Server

,在系统安全性、可用性和高稳定性上又有了很大提高。3.2系统逻辑构造图:酒店管理系统酒店管理系统基本设立基本设立协助业务管理协助业务管理房间类型管理退出房间信息管理房间状态查看关于入住登记入住信息查询房间类型管理退出房间信息管理房间状态查看关于入住登记入住信息查询退出新增房客类型退出客房信息管理退出新增房客类型退出客房信息管理图3-2:系统逻辑构造图3.3程序流程图:如图:开始开始退出否是与否退出?失败顾客登录退出否是与否退出?失败顾客登录成功 成功业务管理退出主界面业务管理退出主界面基本设立 基本设立入住信息查询入住登记房间状态查看入住信息查询入住登记房间状态查看退出房间类型管理房间信息管理退出房间类型管理房间信息管理 退出客房信息管理新增房客类型退出退出客房信息管理新增房客类型退出图3-3:程序流程图

4数据库设计4.1数据库概念构造设计本系统中,为了保证系统安全性,在登录系统时候顾客需要输入对的顾客名和密码。因而,需要一种数据库表用来记录顾客顾客名和密码。登录表图如图所示:编号编号登录名名管理员登录名名管理员密码密码图4-1-1:管理员登录表编号编号编号房间类别编号房间类别类别名称类别名称图4-1-2:房间类别表编号编号商品商品名称商品商品名称图4-1-3:房间状况信息表编号编号结账信息结账信息名称名称图4-1-3:结账状况信息表4.2数据库逻辑构造设计:依照上面设计图表,便可以在数据库中创立相应数据库表,本系统各数据表构造如下:管理员:编号,登录名,密码,其构造如下图所示。列名数据类型可否为空阐明LoginIdint否Id号LoginNamenvarchar(50)否登录名LoginPwdnvarchar(50)否登录密码如:GuestRecord顾客登记表构造列名数据类型可否为空阐明GuestIDint否入住号IdentityIDvarchar(50)否身份证号GuestNamenchar(20)否入住人姓名RoomIDint是房间号ResideIDint是入住状态IDResideDatedatatime是入住时间LeaveDatadatatime是离开时间Depositdecimal(18,2)是押金TotalMoneydecimal(18,2)是金额如:ResideState入住状态表构造列名数据类型可否为空阐明ResideIdint否入住状态idResideNamenchar(50)是入住状态名称Room房间信息表列名数据类型可否为空阐明RoomIDint否房间idBedNumint是床位数Descriptionnvarchar(200)否房间描述RoomStateIDint否房间状态idGuestNumint是房客数目RoomTypeIDInt否房客类型id如:RoomState房间状态表构造列名数据类型可否为空阐明RoomStateIDint否房间状态idRoomStateNamenchar(20)是房间状态名如:RoomType房间类型表构造列名数据类型可否为空阐明TypeIDint否客服类型idTypeNamenvarchar(50)是客房类型名称TypePricedecimal(18,2)是客房类型价格如:数据库关系图如下:5系统各模块实现5.1登录:顾客登录模块在本系统首页。顾客输入顾客名和密码后,系统进行验证,验证通过进入程序主界面注释:当未输入顾客名时提示请输入顾客名,输入顾客名但没有输入密码时提示请输入密码,验证顾客名和密码非空时,连接数据库验证顾客名和密码与否对的,如果对的进入主菜单,反之提示顾客名或密码有误。重要实当代码如下:publicFrmLogin(){InitializeComponent();}#region取消privatevoidbtnCancel_Click(objectsender,EventArgse){this.Dispose();}#endregion#region数据验证///<summary>//////</summary>///<returns>返回布尔类型</returns>publicboolCheckInputNotEmpty(){if(this.txtUserName.Text.Trim().Equals(string.Empty)){MessageBox.Show("请输入顾客名","输入提示",MessageBoxButtons.OK,MessageBoxIcon.Information);this.txtUserName.Focus();returnfalse;}elseif(this.txtPwd.Text.Trim().Equals(string.Empty)){MessageBox.Show("请输入密码","输入提示",MessageBoxButtons.OK,MessageBoxIcon.Information);this.txtPwd.Focus();returnfalse;}else{returntrue;}}#endregion#region登录privatevoidbtnLogin_Click(objectsender,EventArgse){try{if(!CheckInputNotEmpty()){return;}boolbAdmin=AdminManager.CheckAdminLogin(this.txtUserName.Text.Trim(),this.txtPwd.Text.Trim());if(!bAdmin){MessageBox.Show("顾客名或密码不存在","登录失败",MessageBoxButtons.OK,MessageBoxIcon.Error);return;}else{FrmMainfrmMain=newFrmMain();frmMain.Show();this.Hide();}}catch(Exceptionex){MessageBox.Show(ex.Message,"登录失败",MessageBoxButtons.OK,MessageBoxIcon.Error);return;}}#endregion主窗体:酒店管理界面客房管理窗体某些代码如下:#region数据绑定publicvoidBindRoomTypes(){stringflag=this.txtTypeNam.Text.Trim();List<RoomType>rmtList=newList<RoomType>();if(String.IsNullOrEmpty(flag)){rmtList=RoomTypeManager.GetAllRoomType();}else{rmtList=RoomTypeManager.GetRoomTypeByName(flag);}this.dgvRoomType.DataSource=rmtList;}#endregionprivatevoidFrmRoomType_Load(objectsender,EventArgse){this.BindRoomTypes();}privatevoidbtnQuery_Click(objectsender,EventArgse){this.BindRoomTypes();}privatevoidtsbExit_Click(objectsender,EventArgse){this.Close();}privatevoidtsbAddRoomType_Click(objectsender,EventArgse){FrmAddRoomTyepfrmAddRoomTyep=newFrmAddRoomTyep();frmAddRoomTyep.queryDelegate=this.BindRoomTypes;frmAddRoomTyep.Show();}#region删除客房类型privatevoidtsmiDel_Click(objectsender,EventArgse){if(this.dgvRoomType.SelectedRows.Count==0){return;}inttypeId=Convert.ToInt32(this.dgvRoomType.CurrentRow.Cells["TypeID"].Value.ToString());if(RoomTypeManager.DelRoomType(typeId)>0){MessageBox.Show("删除成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);this.BindRoomTypes();}else{MessageBox.Show("删除失败","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);}}#endregionprivatevoiddgvRoomType_CellClick(objectsender,DataGridViewCellEventArgse){inttypeId=Convert.ToInt32(this.dgvRoomType.CurrentRow.Cells["TypeID"].Value.ToString());RoomTyperoomType=RoomTypeManager.GetRoomTypeByTypeId(typeId);this.txtTypeName.Text=roomType.TypeName;this.txtTypePrice.Text=roomType.TypePrice.ToString();}#region数据验证///<summary>//////</summary>///<returns>返回布尔类型</returns>publicboolCheckInputNotEmpty(){if(this.txtTypeName.Text.Trim().Equals(string.Empty)){MessageBox.Show("请输入客房类型","输入提示",MessageBoxButtons.OK,MessageBoxIcon.Information);this.txtTypeName.Focus();returnfalse;}elseif(this.txtTypePrice.Text.Trim().Equals(string.Empty)){MessageBox.Show("请输入价格","输入提示",MessageBoxButtons.OK,MessageBoxIcon.Information);this.txtTypePrice.Focus();returnfalse;}else{returntrue;}}#endregionprivatevoidbtnOK_Click(objectsender,EventArgse){if(!CheckInputNotEmpty()){return;}RoomTyperoomType=newRoomType();roomType.TypeID=Convert.ToInt32(this.dgvRoomType.CurrentRow.Cells["TypeID"].Value.ToString());roomType.TypeName=this.txtTypeName.Text.Trim();roomType.TypePrice=Convert.ToDecimal(this.txtTypePrice.Text.Trim());if(RoomTypeManager.UpdateRoomType(roomType)>0){MessageBox.Show("修改成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);this.BindRoomTypes();}else{MessageBox.Show("修改失败","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);}}}

新增客房类型窗体:某些代码如下:#region数据验证///<summary>//////</summary>///<returns>返回布尔类型</returns>publicboolCheckInputNotEmpty(){if(this.txtBedNum.Text.Trim().Equals(string.Empty)){MessageBox.Show("请输入床位数","输入提示",MessageBoxButtons.OK,MessageBoxIcon.Information);this.txtBedNum.Focus();returnfalse;}elseif(this.txtDescription.Text.Trim().Equals(string.Empty)){MessageBox.Show("请输入客房描述","输入提示",MessageBoxButtons.OK,MessageBoxIcon.Information);this.txtDescription.Focus();returnfalse;}else{returntrue;}}publicboolCheck(){try{Convert.ToInt32(this.txtBedNum.Text.Trim());}catch(Exceptionex){returnfalse;}returntrue;}#endregion#region数据绑定publicvoidRoomTypeDataBind(){try{List<RoomType>rmStates=RoomTypeManager.GetAllRoomType();this.cboRoomType.DataSource=rmStates;this.cboRoomType.DisplayMember="TypeName";this.cboRoomType.ValueMember="TypeID";this.cboRoomType.SelectedIndex=0;}catch(Exceptionex){MessageBox.Show(ex.Message,"操作错误",MessageBoxButtons.OK,MessageBoxIcon.Error);throw;}}#endregionprivatevoidFrmAddRoom_Load(objectsender,EventArgse){this.RoomTypeDataBind();}privatevoidbtnOK_Click(objectsender,EventArgse){if(!CheckInputNotEmpty()){return;}if(!Check()){MessageBox.Show("添加数据类型错误","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);return;}Roomroom=newRoom();room.BedNum=Convert.ToInt32(this.txtBedNum.Text.Trim());room.RoomTypeID=Convert.ToInt32(this.cboRoomType.SelectedValue);room.Description=this.txtDescription.Text.Trim();if(RoomManager.AddRoom(room)>0){MessageBox.Show("添加成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);this.queryDelegate();this.Close();}else{MessageBox.Show("添加失败","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);this.Close();}}客房管理信息:某些代码如下:publicvoidBindRoom(){stringflag=this.txtRoomID.Text.Trim();List<Room>rmtList=newList<Room>();rmtList=RoomManager.GetRoomList(flag);this.dgvRoom.DataSource=rmtList;this.SetRoomStateAndRoomType();}publicvoidSetRoomStateAndRoomType(){foreach(DataGridViewRowrowinthis.dgvRoom.Rows){intid=(int)(row.Cells["RoomTypeID"].Value);row.Cells["RoomType"].Value=RoomTypeManager.GetRoomTypeByTypeId(id).TypeName;}DataGridViewComboBoxColumncbo=(DataGridViewComboBoxColumn)this.dgvRoom.Columns["RoomStateID"];cbo.DisplayStyle=DataGridViewComboBoxDisplayStyle.Nothing;cbo.DataSource=RoomStateManager.GetRoomStates();cbo.DisplayMember="RoomStateName";cbo.ValueMember="RoomStateID";}#endregionprivatevoidbtnQuery_Click(objectsender,EventArgse){this.BindRoom();}privatevoidtsbAddRoom_Click(objectsender,EventArgse){FrmAddRoomfrmAddRoom=newFrmAddRoom();frmAddRoom.queryDelegate=this.BindRoom;frmAddRoom.Show();}privatevoidtsbExit_Click(objectsender,EventArgse){this.Close();}#region数据验证///<summary>//////</summary>///<returns>返回布尔类型</returns>publicboolCheckInputNotEmpty(){if(this.txtBedNum.Text.Trim().Equals(string.Empty)){MessageBox.Show("请输入床位数","输入提示",MessageBoxButtons.OK,MessageBoxIcon.Information);this.txtBedNum.Focus();returnfalse;}elseif(this.txtDescription.Text.Trim().Equals(string.Empty)){MessageBox.Show("请输入客房描述","输入提示",MessageBoxButtons.OK,MessageBoxIcon.Information);this.txtDescription.Focus();returnfalse;}else{returntrue;}}#endregion#region数据绑定publicvoidRoomTypeDataBind(){try{List<RoomType>rmStates=RoomTypeManager.GetAllRoomType();this.cobRoomType.DataSource=rmStates;this.cobRoomType.DisplayMember="TypeName";this.cobRoomType.ValueMember="TypeID";this.cobRoomType.SelectedIndex=0;}catch(Exceptionex){MessageBox.Show(ex.Message,"操作错误",MessageBoxButtons.OK,MessageBoxIcon.Error);throw;}}#endregionprivatevoiddgvRoom_CellClick(objectsender,DataGridViewCellEventArgse){introomId=Convert.ToInt32(this.dgvRoom.CurrentRow.Cells["RoomID"].Value.ToString());Roomroom=RoomManager.GetRoomByRoomId(roomId);this.txtBedNum.Text=room.BedNum.ToString();this.txtDescription.Text=room.Description.ToString();this.cobRoomType.SelectedValue=room.RoomTypeID;}privatevoidFrmRoom_Load(objectsender,EventArgse){this.dgvRoom.AutoGenerateColumns=false;this.RoomTypeDataBind();}#region修改privatevoidbtnOK_Click(objectsender,EventArgse){if(!CheckInputNotEmpty()){return;}Roomroom=newRoom();room.RoomID=Convert.ToInt32(this.dgvRoom.CurrentRow.Cells["RoomID"].Value.ToString());room.BedNum=Convert.ToInt32(this.txtBedNum.Text.Trim());room.RoomTypeID=Convert.ToInt32(this.cobRoomType.SelectedValue);room.Description=this.txtDescription.Text.Trim();if(RoomManager.UpdateRoom(room)>0){MessageBox.Show("修改成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);this.BindRoom();}else{MessageBox.Show("修改失败","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);}}#endregion#region删除privatevoidtsmiDel_Click(objectsender,EventArgse){if(this.dgvRoom.SelectedRows.Count==0){return;}introomId=Convert.ToInt32(this.dgvRoom.CurrentRow.Cells["RoomID"].Value.ToString());if(RoomManager.DelRoom(roomId)>0){MessageBox.Show("删除成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);this.BindRoom();}else{MessageBox.Show("删除失败","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);}}#endregionprivatevoidbtnExport_Click(objectsender,EventArgse){try{if(this.dgvRoom.RowCount<=0){MessageBox.Show("无数据导出!","操作失败",MessageBoxButtons.OK,MessageBoxIcon.Error);return;}ExcelHandleexcleHandle=newExcelHandle();excleHandle.GetRooms(this.dgvRoom);}catch(Exceptionex){MessageBox.Show(ex.Message,"操作失败",MessageBoxButtons.OK,MessageBoxIcon.Error);return;}}publicstringGetUserSelectFile(){OpenFileDialogfileDialog=newOpenFileDialog();fileDialog.InitialDirectory="d:\\";fileDialog.Filter="MicrosoftExcelfiles(*.xlsx)|*.xlsx";fileDialog.FilterIndex=2;fileDialog.RestoreDirectory=true;if(fileDialog.ShowDialog()==DialogResult.OK){if((fileDialog.OpenFile())!=null){returnfileDialog.FileName;}}returnstring.Empty;}privatevoidbtnIntroduction_Click(objectsender,EventArgse){try{stringstrFileName=GetUserSelectFile();if(strFileName.Equals(string.Empty)){return;}else{ExcelHandleexcelHandle=newExcelHandle();List<Room>roomList=excelHandle.GetRoomsFromExcel(strFileName,"Sheet1");intboRet=RoomManager.InsertByExcelData(roomList);if(boRet>0){MessageBox.Show("成功导入"+boRet+"条","操作提示",MessageBoxButtons.OK,MessageBoxIcon.Warning);this.BindRoom();this.SetRoomStateAndRoomType();}else{MessageBox.Show("导入失败","操作失败",MessageBoxButtons.OK,MessageBoxIcon.Warning);}}}catch(Exceptionex){MessageBox.Show(ex.Message,"操作提示",MessageBoxButtons.OK,MessageBoxIcon.Error);return;}}

入住登记窗体:房间信息窗体如下:

入住信息窗体:5.8新增房间功能:5.9客房管理:5.10关于:6系统测试测试目:程序测试是指在程序运营前,对程序需求分析、设计规格阐明和编码最后复审,是保证程序质量核心环节。在系统正式交付运营前,普通需要做系统测试,来检测系统与否符合预期开发目的、产品与否界面与否美观大方、产品使用与否以便、产品稳定性与否良好、产品在运营过程中与否会浮现Bug。测试目也正是为理解决以上几方面问题。测试办法:一方面测试系统完毕功能与否满足初期需求分析。在各功能中来回不断操作各功能属性,发现系统已基本完毕了添加、修改、删除和查询等有关功能,在详细模块中均实现了预期目的。另一方面测试程序设计规格,本系统开发完毕一共应用了6个表,属于较小程序,符合预期规定。综上所述:本系统测试符合预期目的。测试实例:顾客登录测试测试内容:在数据库顾客表中添加顾客名和密码。一方面输入错误顾客名、密码,验证与否提示错误并且不能登录,然后输入对的顾客名和密码,验证与否成功登录。成果显示输入错误顾客名和密码时提示“顾客名或密码有误”。当输入对的登录名和密码时,顺利进入主菜单。因而,本次测试测试成果为成功。测试成果成功后来完毕本系统所有功能测试,所有功能该实现功能实现后来,本系统测试成功。

如下是两个窗体功能完毕代码实例(注其她功能模块完毕办法相似):Admin管理员登陆窗体Model层usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceHotelManage.Models{[Serializable]publicclassAdmin{///<summary>///无参构造办法///</summary>publicAdmin(){}privatestringloginId;publicstringLoginId{get{returnloginId;}set{loginId=value;}}privatestringloginName;publicstringLoginName{get{returnloginName;}set{loginName=value;}}privatestringloginPwd;publicstringLoginPwd{get{returnloginPwd;}set{loginPwd=value;}}}}DAl(数据数据访问层)层usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Data;usingSystem.Data.SqlClient;usingHotelManage.Models;namespaceHotelManage.DAL{publicclassAdminService{#region查询管理员///<summary>///查询管理员///</summary>///<paramname="loginId">顾客名</param>///<returns></returns>publicstaticAdminGetAdminByLoginName(stringloginName){Adminadmin=null;stringsql="select*fromAdminwhereLoginName='"+loginName+"'";using(SqlDataReaderreader=SqlHelper.ExecuteReader(SqlHelper.connString,CommandType.Text,sql,null)){if(reader.Read()){admin=newAdmin();admin.LoginId=(string)reader["LoginId"];admin.LoginPwd=(string)reader["LoginName"];admin.LoginPwd=(string)reader["LoginPwd"];}}returnadmin;}#endregion}}BLL(业务逻辑层)调用DALusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingHotelManage.Models;usingHotelManage.DAL;namespaceHotelManage.BLL{publicclassAdminManager{#region验证顾客 ///<summary>///验证顾客///</summary>///<paramname="loginId"></param>///<paramname="loginPwd"></param>///<returns></returns>publicstaticboolCheckAdminLogin(stringloginName,stringloginPwd){//调用数据访问层执行管理员登录检查sql语句Adminadmin=AdminService.GetAdminByLoginName(loginName);if(admin==null){returnfalse;//顾客不存在}if(admin.LoginPwd==loginPwd){returntrue;}else{returnfalse;//密码错误}}#endregion}}UI(表达层)调用BLLusingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingHotelManage.BLL;usingHotelManage.Models;namespaceHotelManage{publicpartialclassFrmLogin:Form{publicFrmLogin(){InitializeComponent();}#region取消privatevoidbtnCancel_Click(objectsender,EventArgse){this.Dispose();}#endregion#region数据验证///<summary>//////</summary>///<returns>返回布尔类型</returns>publicboolCheckInputNotEmpty(){if(this.txtUserName.Text.Trim().Equals(string.Empty)){MessageBox.Show("请输入顾客名","输入提示",MessageBoxButtons.OK,MessageBoxIcon.Information);this.txtUserName.Focus();returnfalse;}elseif(this.txtPwd.Text.Trim().Equals(string.Empty)){MessageBox.Show("请输入密码","输入提示",MessageBoxButtons.OK,MessageBoxIcon.Information);this.txtPwd.Focus();returnfalse;}else{returntrue;}}#endregion#region登录privatevoidbtnLogin_Click(objectsender,EventArgse){try{if(!CheckInputNotEmpty()){return;}boolbAdmin=AdminManager.CheckAdminLogin(this.txtUserName.Text.Trim(),this.txtPwd.Text.Trim());if(!bAdmin){MessageBox.Show("顾客名或密码不存在","登录失败",MessageBoxButtons.OK,MessageBoxIcon.Error);return;}else{FrmMainfrmMain=newFrmMain();frmMain.Show();this.Hide();}}catch(Exceptionex){MessageBox.Show(ex.Message,"登录失败",MessageBoxButtons.OK,MessageBoxIcon.Error);return;}}#endregion}}顾客信息GuestRecordModel层usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceHotelManage.Models{[Serializable]publicclassGuestRecord{///<summary>///无参构造办法///</summary>publicGuestRecord(){}privateintguestID;publicintGuestID{get{returnguestID;}set{guestID=value;}}privatestringidentityID;publicstringIdentityID{get{returnidentityID;}set{identityID=value;}}privatestringguestName;publicstringGuestName{get{returnguestName;}set{guestName=value;}}privateintroomID;publicintRoomID{get{returnroomID;}set{roomID=value;}}privateintresideID;publicintResideID{get{returnresideID;}set{resideID=value;}}privateDateTimeresideDate;publicDateTimeResideDate{get{returnresideDate;}set{resideDate=value;}}privateDateTimeleaveDate;publicDateTimeLeaveDate{get{returnleaveDate;}set{leaveDate=value;}}privatedecimaldeposit;publicdecimalDeposit{get{returndeposit;}set{deposit=value;}}privatedecimaltotalMoney;publicdecimalTotalMoney{get{returntotalMoney;}set{totalMoney=value;}}}}DAl(数据数据访问层)层:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Data;usingSystem.Data.SqlClient;usingHotelManage.Models;namespaceHotelManage.DAL{publicclassGuestRecordService{#region入住登记publicstaticintInsertGuestRecord(GuestRecordgRecord){stringprocName="usp_insertGuestRecord";SqlParameter[]paras={newSqlParameter("@identityID",gRecord.IdentityID),newSqlParameter("@guestName",gRecord.GuestName),newSqlParameter("@roomID",gRecord.RoomID),newSqlParameter("@deposit",gRecord.Deposit),newSqlParameter("@ResideDate",gRecord.ResideDate)};returnSqlHelper.ExecuteNonQuery(SqlHelper.connString,CommandType.StoredProcedure,procName,paras);}#endregion#region依照SQL语句查询客房类型publicstaticList<GuestRecord>GetGuestRecordBySQL(stringsql,SqlParameter[]paras){List<GuestRecord>guestRecordList=newList<GuestRecord>();DataSetds=SqlHelper.ExecuteDataset(SqlHelper.connString,CommandType.Text,sql,paras);if(ds.Tables.Count>0){DataTabledt=ds.Tables[0];foreach(DataRowrowindt.Rows){GuestRecordguestRecord=newGuestRecord();guestRecord.GuestID=Convert.ToInt32(row["GuestID"]);guestRecord.IdentityID=row["IdentityID"].ToString();guestRecord.GuestName=row["GuestName"].ToString();guestRecord.RoomID=Convert.ToInt32(row["RoomID"]);guestRecord.ResideID=Convert.ToInt32(row["ResideID"]);guestRecord.ResideDate=Convert.ToDateTime(row["ResideDate"]);if(!Convert.IsDBNull(row["LeaveDate"])){guestRecord.LeaveDate=Convert.ToDateTime(row["LeaveDate"]);}guestRecord.Deposit=Convert.ToDecimal(row["Deposit"]);if(!Convert.IsDBNull(row["TotalMoney"])){guestRecord.TotalMoney=Convert.ToDecimal(row["TotalMoney"]);}guestRecordList.Add(guestRecord);}}returnguestRecordList;}#endregion#region查询publicstaticList<GuestRecord>GetGuestInfo(DateTimebeginDate,DateTimeendDate,intresideStateId){stringsql="select*fromGuestRecordwhereResideDatebetween@btimeand@etimeandResideID=@ResideID";SqlParameter[]paras={newSqlParameter("@btime",beginDate),newSqlParameter("@etime",endDate),newSqlParameter("@ResideID",resideStateId)};returnGetGuestRecordBySQL(sql,paras);}#endregion#region退房publicstaticdecimalRefundRoom(intguestId,decimalrequirePay,DateTimeleaveDate){stringsql=@"refund_Room";SqlParameter[]paras={newSqlParameter("@GuestID",guestId),newSqlParameter("@requirePay",requirePay),newSqlParameter("@LeaveDate",leaveDate)};returnConvert.ToDecimal(SqlHelper.ExecuteScalar(SqlHelper.connString,CommandType.StoredProcedure,sql,paras));}#endregion}}BLL(业务逻辑层)调用DALusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingHotelManage.Models;usingHotelManage.DAL;namespaceHotelManage.BLL{publicclassGuestRecordManager{#region入住登记publicstaticintInsertGuestRecord(GuestRecordgRecord){returnGuestRecordService.InsertGuestRecord(gRecord);}#endregion#region查询publicstaticList<GuestRecord>GetGuestInfo(DateTimebeginDate,DateTimeendDate,intresideStateId){returnGuestRecordService.GetGuestInfo(beginDate,endDate,resideStateId);}#endregion#region结算publicstaticdecimalGetAmount(introomId,intdays){Roomroom=RoomManager.GetRoomByRoomId(roomId);if(room!=null){RoomTyperType=RoomTypeService.GetRoomTypeByTypeId(room.RoomTypeID);if(rType!=null){returnrType.TypePrice*days;}}return0;}#endregion#region退房publicstaticdecimalRefundRoom(intguestId,decimalrequirePay,DateTimeleaveDate){returnGuestRecordService.RefundRoom(guestId,requirePay,leaveDate);}#endregion}}UI(表达层)调用BLLusingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingHotelManage.Models;usingHotelManage.BLL;usingHotelManage.Excel;namespaceHotelManage{publicpartialclassFrmRecordInfo:Form{publicFrmRecordInfo(){InitializeComponent();}#region数据绑定publicvoidResideStateBind(){try{List<ResideState>rmStates=ResideStateManager.GetAllResideState();foreach(ResideStateresideStateinrmStates){resideState.ResideName=resideState.ResideName.Trim();}this.cmbResideState.DataSource=rmStates;this.cmbResideState.DisplayMember="ResideName";this.cmbResideState.ValueMember="ResideId";}catch(Exceptionex){MessageBox.Show(ex.Message,"操作错误",MessageBoxButtons.OK,MessageBoxIcon.Error);throw;}}publicvoidDBind(){intresideStateId=Convert.ToInt32(this.cmbResideState.SelectedValue);DateTimebeginDate=Convert.ToDateTime(this.dtpResideDate.Text);DateTimeendDate=Convert.ToDateTime(this.dtpLeaveDate.Text);List<GuestRecord>guestRecordList=GuestRecordManager.GetGuestInfo(beginDate,endDate,resideStateId);this.dgvRoom.AutoGenerateColumns=false;this.

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论