酒店管理系報(bào)告冊(cè)_第1頁(yè)
酒店管理系報(bào)告冊(cè)_第2頁(yè)
酒店管理系報(bào)告冊(cè)_第3頁(yè)
酒店管理系報(bào)告冊(cè)_第4頁(yè)
酒店管理系報(bào)告冊(cè)_第5頁(yè)
已閱讀5頁(yè),還剩83頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1/48 1.2項(xiàng)目主要目的 1 2.1C#窗體應(yīng)用程序技術(shù)簡(jiǎn)介 22.2SQL技術(shù) 22.2.1數(shù)據(jù)庫(kù)的基本概念 2 3.1技術(shù)可行性分析 33.2系統(tǒng)邏輯結(jié)構(gòu)圖 43.3程序流程圖 4 4.1數(shù)據(jù)庫(kù)概念結(jié)構(gòu)設(shè)計(jì) 54.2數(shù)據(jù)庫(kù)邏輯結(jié)構(gòu)設(shè)計(jì) 6 5.1登錄 65.2主界面 75.3新增客房類型窗體 75.4客房管理信息 85.5入住登記窗體 85.6房間信息窗體 85.7入住信息窗體 95.8新增房間 95.9客房管理 9 2/48 1.1項(xiàng)目背景:、深入運(yùn)用為特征的信息化社會(huì)。近十黃金周”休息日的增多,人們的消費(fèi)能力依次對(duì)系統(tǒng)、數(shù)據(jù)庫(kù)、及界面進(jìn)行設(shè)計(jì),最后實(shí)現(xiàn)了需。旅游規(guī)模的不斷擴(kuò)大,隨之而來(lái)的賬管理體制已經(jīng)無(wú)法適應(yīng)當(dāng)代酒店的發(fā)天,酒店管理成為留住客人的一個(gè)重要因素。酒店在管理方面邁上一個(gè)新的臺(tái)階,成為提高酒店的要手段之一。目前及將來(lái),酒店競(jìng)爭(zhēng)將主要在智能登陸對(duì)相關(guān)信息的瀏覽、退出,添加、刪除、修改理(1)培養(yǎng)學(xué)生能夠應(yīng)用數(shù)據(jù)庫(kù)系統(tǒng)原理在需求分析的基礎(chǔ)上對(duì)3/48(2)培養(yǎng)學(xué)生能夠應(yīng)用數(shù)據(jù)庫(kù)系統(tǒng)在概念設(shè)計(jì)的基礎(chǔ)上應(yīng)用SQLX化關(guān)系模型進(jìn),存儲(chǔ)過(guò)程,觸發(fā)器以保證一致性,保證數(shù)據(jù)共享和防(4)培養(yǎng)學(xué)生理論與實(shí)際相結(jié)合的能力,使之能夠熟練掌握一種數(shù)據(jù)庫(kù)系統(tǒng)(如SQLSERVER)的使用,培養(yǎng)學(xué)生開發(fā)創(chuàng)新 (5)通過(guò)設(shè)計(jì)實(shí)際的數(shù)據(jù)庫(kù)系統(tǒng)應(yīng)用課題,使學(xué)生進(jìn)一步熟悉數(shù)高學(xué)生獨(dú)立分析問(wèn)題,解決問(wèn)題,查應(yīng)計(jì)算機(jī)產(chǎn)業(yè)日新月異發(fā)展的形勢(shì);提(1)要求在VS2012環(huán)境下調(diào)試完成;(2)要求劃分功能模塊,各個(gè)功能分別使用函數(shù)來(lái)完成;(3)源代碼程序要求必要的注釋。(4)構(gòu)建布局合理美觀的Windows窗體(5)使用ADO.NET操作數(shù)據(jù)(6)在ADO.NET中使用存儲(chǔ)過(guò)程(7).NET中Excel的導(dǎo)入導(dǎo)出(8)DataGridView數(shù)據(jù)的篩選(9)異常處理b功能4/48介紹:應(yīng)用系統(tǒng),三層架構(gòu)的受客戶。DAL(數(shù)據(jù)數(shù)據(jù)訪問(wèn)層)操作數(shù)據(jù)BLL(業(yè)務(wù)邏輯層)調(diào)用DALUI(表示層)調(diào)用BLL庫(kù)的基本概念SQL詢和程序設(shè)計(jì)語(yǔ)言,用于存取數(shù)據(jù)以及存放方式,所有具有完全不同底層結(jié)構(gòu)的不同數(shù)據(jù)庫(kù)系統(tǒng),可以使用相同的SQL5/48輯結(jié)構(gòu)圖:入入住信息查詢房間狀態(tài)查看入住登記退出退出房間信息管理客房信息管理新增房客類型房間類型管理退出酒店管理系統(tǒng)業(yè)務(wù)管理基礎(chǔ)設(shè)置6/48始否是出業(yè)務(wù)管理基礎(chǔ)設(shè)置退出客房信息管理新增房客類型入住信息查詢房間狀態(tài)查看房間類型管理房間信息管理入住登記主界面退出退出成功出7/48在登錄系統(tǒng)的時(shí)候用戶需要輸入正確管理員號(hào)登錄名碼號(hào)房間類別號(hào)類別名稱號(hào)商品名稱8/48號(hào)結(jié)賬信息據(jù)庫(kù)中創(chuàng)建相應(yīng)的數(shù)據(jù)庫(kù)表,本系統(tǒng)的否r否LoginPwdnvarchar(50)否登錄密碼GuestRecord9/48是入住時(shí)間是離開時(shí)間l是l是sideState10/48mtionar11/48omStateme房間狀態(tài)名rl12/4813/485.1登錄:進(jìn)行驗(yàn)證,驗(yàn)證通過(guò)進(jìn)入程序的主界面icFrmLogin}}region消privatevoidbtnCancel_Click(objectsender,EventArgse){}}negionmmaryummaryreturns布爾類型</returns>licboolCheckInputNotEmpty{14/48TextTrimEqualsstringEmpty{MessageBox.Show("請(qǐng)輸入用戶名","輸入提示",MessageBoxButtons.OK,MessageBoxIconInformation);meFocusrnfalse}fthistxtPwdTextTrimEqualsstringEmpty{MessageBox.Show("請(qǐng)輸入密碼","輸入提示",MessageBoxButtons.OK,MessageBoxIcon.Information);usrnfalse}}urntrue}}nregion登錄privatevoidbtnLogin_Click(objectsender,EventArgse){{{}boolbAdmin=AdminManager.CheckAdminLogin(this.txtUserName.Text.Trim(),extTrimnMessageBox.Show("用戶名或密碼不存在","登錄失敗",MessageBoxButtons.OK,MessageBoxIconError}{FrmMainfrmMainnewFrmMain);w}}15/48{{eptionexMessageBoxMessageBox.Show(ex.Message,"登錄失敗",MessageBoxButtons.OK,MessageBoxIcon.Error);}}}n窗體:理窗體16/48egionicvoidBindRoomTypes{stxtTypeNamTextTrimListRoomTypermtListnewListRoomType>();lag{tListRoomTypeManagerGetAllRoomType}{tListRoomTypeManagerGetRoomTypeByNameflag}mTypeDataSourcermtList}}nprivatevoidFrmRoomType_Load(objectsender,EventArgse){pes}privatevoidbtnQuery_Click(objectsender,EventArgse){pes}privatevoidtsbExit_Click(objectsender,EventArgse){}privatevoidtsbAddRoomType_Click(objectsender,EventArgse){FrmAddRoomTyepfrmAddRoomTyepnewFrmAddRoomTyep);mTyepqueryDelegatethisBindRoomTypesTyepShow}egionprivatevoidtsmiDel_Click(objectsender,EventArgse){mTypeSelectedRowsCount17/48}}dConvertToIntthisdgvRoomTypeCurrentRowCellsTypeIDValueToStringagerDelRoomTypetypeId{MessageBox.Show("刪除成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);pes}{MessageBox.Show("刪除失敗","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);}}nprivatevoiddgvRoomType_CellClick(objectsender,DataGridViewCellEventArgse){dConvertToIntthisdgvRoomTypeCurrentRowCellsTypeIDValueToStringoomTyperoomTypeRoomTypeManagerGetRoomTypeByTypeIdtypeIdNameTextroomTypeTypeNameypePriceTextroomTypeTypePriceToString}egionmmaryummaryreturns布爾類型</returns>licboolCheckInputNotEmpty{TextTrimEqualsstringEmpty{MessageBox.Show("請(qǐng)輸入客房類型","輸入提示",MessageBoxButtons.OK,MessageBoxIconInformation);meFocusrnfalse}fthistxtTypePriceTextTrimEqualsstringEmpty{MessageBox.Show("請(qǐng)輸入價(jià)格","輸入提示",MessageBoxButtons.OK,MessageBoxIcon.Information);iceFocusrnfalse18/48}}urntrue}}}nprivatevoidbtnOK_Click(objectsender,EventArgse){{}RoomTyperoomTypenewRoomTyperoomType.TypeID=ConvertToIntthisdgvRoomTypeCurrentRowCellsTypeID"].Value.ToString());roomTypeTypeNamethistxtTypeNameTextTrim;roomTypeTypePriceConvertToDecimalthistxtTypePriceTextTrim());agerUpdateRoomTyperoomType{MessageBox.Show("修改成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);pes}{MessageBox.Show("修改失敗","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);}}}19/485.3新增客房類型窗體:egionmmaryummaryreturns布爾類型</returns>licboolCheckInputNotEmpty{xtTrimEqualsstringEmptyMessageBox.Show("請(qǐng)輸入床位數(shù)","輸入提示",MessageBoxButtons.OK,MessageBoxIconInformation);Focusrnfalse}}fthistxtDescriptionTextTrimEqualsstringEmptyMessageBox.Show("請(qǐng)輸入客房描述","輸入提示",MessageBoxButtons.OK,MessageBoxIconInformation);ptionFocusrnfalse}20/48{urntrue}}licboolCheck{{ConvertToIntthistxtBedNumTextTrim);}ceptionex{rnfalse}}urntrue}}negionlicvoidRoomTypeDataBind{{ListRoomTypermStatesRoomTypeManagerGetAllRoomType;TypeDataSourcermStatesoomTypeDisplayMemberTypeNameRoomTypeValueMemberTypeIDcboRoomTypeSelectedIndex}}ceptionexMessageBox.Show(ex.Message,"操作錯(cuò)誤",MessageBoxButtons.OK,MessageBoxIcon.Error);}}nprivatevoidFrmAddRoom_Load(objectsender,EventArgse){taBind}21/48privatevoidbtnOK_Click(objectsender,EventArgse){{}}MessageBox.Show("添加數(shù)據(jù)類型錯(cuò)誤","提示",MessageBoxButtons.OK,MessageBoxIconInformation);}RoomroomnewRoomroomBedNumConvertToIntthistxtBedNum.Text.Trim());roomRoomTypeIDConvertToIntthis.cboRoomType.SelectedValue);roomDescriptionthistxtDescriptionTextTrim;AddRoomroom{MessageBox.Show("添加成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);gate}}MessageBox.Show("添加失敗","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);}}22/485.4客房管理信息:licvoidBindRoom{stxtRoomIDTextTrimListRoomrmtListnewListRoom>();tListRoomManagerGetRoomListflagmDataSourcermtListateAndRoomType}licvoidSetRoomStateAndRoomType{DataGridViewRowrowinthisdgvRoomRows{lsRoomTypeIDValuerowCellsRoomTypeValueRoomTypeManager.GetRoomTypeByTypeId(id).TypeName;}DataGridViewboBoxColumncboDataGridViewboBoxColumnthis.dgvRoom.Columns["RoomStateID"];StyleDataGridViewboBoxDisplayStyleNothing23/48ourceRoomStateManagerGetRoomStatesayMemberRoomStateNameMemberRoomStateID}nprivatevoidbtnQuery_Click(objectsender,EventArgse){}}privatevoidtsbAddRoom_Click(objectsender,EventArgse){FrmAddRoomfrmAddRoomnewFrmAddRoom);mqueryDelegatethisBindRoomShow}privatevoidtsbExit_Click(objectsender,EventArgse){}}egionmmaryummaryreturns布爾類型</returns>licboolCheckInputNotEmptyxtTrimEqualsstringEmptyMessageBox.Show("請(qǐng)輸入床位數(shù)","輸入提示",MessageBoxButtons.OK,MessageBoxIconInformation);Focusrnfalse}}fthistxtDescriptionTextTrimEqualsstringEmptyMessageBox.Show("請(qǐng)輸入客房描述","輸入提示",MessageBoxButtons.OK,MessageBoxIconInformation);ptionFocusrnfalse24/48}}urntrue}}}negionlicvoidRoomTypeDataBind{{ListRoomTypermStatesRoomTypeManagerGetAllRoomType;TypeDataSourcermStatesoomTypeDisplayMemberTypeNameRoomTypeValueMemberTypeIDcobRoomTypeSelectedIndex}ceptionexMessageBox.Show(ex.Message,"操作錯(cuò)誤",MessageBoxButtons.OK,MessageBoxIcon.Error);}}nprivatevoiddgvRoomCellClickobjectsenderDataGridViewCellEventArgse){dConvertToIntthisdgvRoomCurrentRowCellsRoomIDValueToStringoomroomRoomManagerGetRoomByRoomIdroomIdedNumTextroomBedNumToStringescriptionTextroomDescriptionToStringTypeSelectedValueroomRoomTypeID}privatevoidFrmRoom_Load(objectsender,EventArgse){omAutoGenerateColumnsfalsetaBind}egionprivatevoidbtnOK_Click(objectsender,EventArgse)25/48}}RoomroomnewRoomroomRoomIDConvertToIntthisdgvRoom.CurrentRow.Cells["RoomID"].Value.ToString());roomBedNumConvertToIntthistxtBedNum.Text.Trim());roomRoomTypeIDConvertToIntthis.cobRoomType.SelectedValue);roomDescriptionthistxtDescriptionTextTrim;UpdateRoomroom{MessageBox.Show("修改成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);}}MessageBox.Show("修改失敗","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);}}negionprivatevoidtsmiDel_Click(objectsender,EventArgse){mSelectedRowsCount{}}dConvertToIntthisdgvRoomCurrentRowCellsRoomIDValueToStringDelRoomroomId{MessageBox.Show("刪除成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);}{MessageBox.Show("刪除失敗","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);}}n26/48privatevoidbtnExport_Click(objectsender,EventArgse){{}ExcelHandleexcleHandlenewExcelHandle;GetRoomsthisdgvRoom}eptionex{MessageBox.Show(ex.Message,"操作失敗",MessageBoxButtons.OK,MessageBoxIcon.Error);}}licstringGetUserSelectFilepenFileDialogfileDialognewOpenFileDialogeDialogInitialDirectorydleDialogFilterIndexlogRestoreDirectorytruealogDialogResultOK{nFilenull{fileDialogFileName}}stringEmpty}privatevoidbtnIntroduction_Click(objectsender,EventArgse){{meGetUserSelectFileingEmpty{}27/48{ExcelHandleexcelHandlenewExcelHandle;ListRoomroomListexcelHandleGetRoomsFromExcelstrFileName"Sheet1");nsertByExcelDataroomList{MessageBox.Show("成功導(dǎo)入"+boRet+"條","操作提醒ttonsOKMessageBoxIconWarningateAndRoomType}{MessageBox.Show("導(dǎo)入失敗","操作失敗",MessageBoxButtons.OK,MessageBoxIcon.Warning);}}}eptionexMessageBox.Show(ex.Message,"操作提醒",MessageBoxButtons.OK,MessageBoxIcon.Error);}}28/485.5入住登記窗體:5.6房間信息窗體如下:29/485.7入住信息窗體:30/4831/48量的關(guān)鍵步驟。在系統(tǒng)正式交付運(yùn)行前,一統(tǒng)是否符合預(yù)期開發(fā)的目標(biāo)、產(chǎn)品是否界面否方便、產(chǎn)品的穩(wěn)定性是否良好、產(chǎn)品在運(yùn)ug已基本完成了添加、修改、刪除和查詢現(xiàn)了預(yù)期目標(biāo)。其次測(cè)試程序的設(shè)計(jì)規(guī)。名和密碼時(shí),順利進(jìn)入主菜單。因此,本次試,32/48代碼實(shí)例(注其他功能模塊完成的方法相usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceHotelManage.ModelspublicclassAdmin{{///<summary>///無(wú)參構(gòu)造方法///</summary>publicAdmin(){}}privatestringloginId;publicstringLoginIdget{returnloginId;}set{loginId=value;}}privatestringloginName;publicstringLoginName{get{returnloginName;}set{loginName=value;}}privatestringloginPwd;publicstringLoginPwd{get{returnloginPwd;}33/48setset{loginPwd=value;}}}}DAl(數(shù)據(jù)數(shù)據(jù)訪問(wèn)層)層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+"'";taReaderreaderSqlHelperExecuteReaderSqlHelperconnStringmandTypeTextsql,null))if(reader.Read())admin=newAdmin();admin.LoginId=(string)reader["LoginId"];admin.LoginPwd=(string)reader["LoginName"];admin.LoginPwd=(string)reader["LoginPwd"];}}returnadmin;}#endregion}}BLL(業(yè)務(wù)邏輯層)調(diào)用DALusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingHotelManage.Models;usingHotelManage.DAL;namespaceHotelManage.BLLpublicclassAdminManager{#region驗(yàn)證用戶///<summary>///驗(yàn)證用戶///</summary>///<paramname="loginId"></param>///<paramname="loginPwd"></param>///<returns></returns>publicstaticboolCheckAdminLogin(stringloginName,stringloginPwd){Adminadmin=AdminService.GetAdminByLoginName(loginName);if(admin==null){returnfalse;//用戶不存在}}if(admin.LoginPwd==loginPwd){returntrue;}{returnfalse;//密碼錯(cuò)誤}}#endregion}}34/48UI(表示層)調(diào)用BLLusingSystem;usingSystem.Collections.Generic;usingSystem.ponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingHotelManage.BLL;usingHotelManage.Models;namespaceHotelManagepublicpartialclassFrmLogin:Form{publicFrmLogin(){Initializeponent();}#region取消privatevoidbtnCancel_Click(objectsender,EventArgse){this.Dispose();}}#endregion#region數(shù)據(jù)驗(yàn)證///<summary>///</summary>///<returns>返回布爾類型</returns>publicboolCheckInputNotEmpty()if(this.txtUserName.Text.Trim().Equals(string.Empty)){MessageBox.Show("請(qǐng)輸入用戶名","輸入提示",MessageBoxButtons.OK,MessageBoxIcon.Information);this.txtUserName.Focus();returnfalse;}}elseif(this.txtPwd.Text.Trim().Equals(string.Empty))35/4836/48{MessageBox.Show("請(qǐng)輸入密碼","輸入提示",MessageBoxButtons.OK,MessageBoxIcon.Information);this.txtPwd.Focus();returnfalse;}{returntrue;}}#endregion#region登錄privatevoidbtnLogin_Click(objectsender,EventArgse){{if(!CheckInputNotEmpty()){return;}}boolbAdmin=AdminManager.CheckAdminLogin(this.txtUserName.Text.Trim(),this.txtPwd.Text.Trim());if(!bAdmin)MessageBox.Show("用戶名或密碼不存在","登錄失敗",MessageBoxButtons.OK,MessageBoxIcon.Error);return;}FrmMainfrmMain=newFrmMain();frmMain.Show();this.Hide();}}catch(Exceptionex)MessageBox.Show(ex.Message,"登錄失敗",MessageBoxButtons.OK,MessageBoxIcon.Error);returnreturn;}37/48}}#endregion}}usingusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespacenamespaceHotelManage.Models{publicclassGuestRecord{///<summary>///無(wú)參構(gòu)造方法///</summary>publicGuestRecord(){}privateintguestID;publicintGuestID{get{returnguestID;}set{guestID=value;}}privatestringidentityID;publicstringIdentityID{get{returnidentityID;}set{identityID=value;}}privatestringguestName;38/48publicpublicstringGuestName{get{returnguestName;}set{guestName=value;}}privateintroomID;publicintRoomID{get{returnroomID;}setset{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;publicpublicdecimalTotalMoney{39/48get{returntotalMoney;}set{totalMoney=value;}}}}DAl(數(shù)據(jù)數(shù)據(jù)訪問(wèn)層)層:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Data;usingSystem.Data.SqlClient;usingHotelManage.Models;namespaceHotelManage.DAL{{publicclassGuestRecordService#region入住登記publicstaticintInsertGuestRecord(GuestRecordgRecord){{stringproame="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,mandType.StoredProcedure,proame,parasparas);}}#endregionpublicstaticList<GuestRecord>GetGuestRecordBySQL(stringsql,SqlParameter[]paras){List<GuestRecord>guestRecordList=newList<GuestRecord>();DataSetds=SqlHelper.ExecuteDataset(SqlHelper.connString,mandType.Text,sql,paras);if(ds.Tables.Count>0){DataTabledt=ds.Tables[0];foreach(DataRowrowindt.Rows)40/48{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*fromGuestRecordwhereResideDatebetweenbtimeandetimeandResideID=ResideID";SqlParameter[]paras={newSqlParameter("btime",beginDate),newSqlParameter("etime",endDate),newSqlParameter("ResideID",resideStateId)returnGetGuestRecordBySQL(sql,paras);}}#endregion#region退房publicstaticdecimalRefundRoom(intguestId,decimalrequirePay,DateTimeleaveDate)41/48{stringsql="refund_Room";SqlParameter[]paras={newSqlParameter("GuestID",guestId),newSqlParameter("requirePay",requirePay),newSqlParameter("LeaveDate",leaveDate)returnConvert.ToDecimal(SqlHelper.ExecuteScalar(SqlHelper.connString,mandType.StoredProcedure,sql,paras));}#endregion}}BLLBLL(業(yè)務(wù)邏輯層)調(diào)用DALusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingusingHotelManage.Models;usingHotelManage.DAL;namespaceHotelManage.BLLpublicclassGuestRecordManager#region入住登記publicstaticintInsertGuestRecord(GuestRecordgRecord){returnGuestRecordService.InsertGuestRecord(gRecord);}}#endregion#region查詢publicpublicstaticList<GuestRecord>GetGuestInfo(DateTimebeginDate,DateTimeendDate,intresideStateId)returnGuestRecordService.GetGuestInfo(beginDate,endDate,resideStateId);}#endregion42/48#region結(jié)算publicstaticdecimalGetAmount(introomId,intdays){Roomroom=RoomManager.GetRoomByRoomId(roomId);ifif(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}}UIUI(表示層)調(diào)用BLLusingSystem;usingSystem.Collections.Generic;usingusingusingusingusingusingusingSystem.ponentModel;System.Data;System.Drawing;System.Linq;System.Text;System.Windows.Forms;HotelManage.Models;usingHotelManage.BLL;usingHotelManage.Excel;namespaceHotelManage{43/48publicpublicpartialclassFrmRecordInfo:Form{publicFrmRecordInfo(){Initializeponent();}#region數(shù)據(jù)綁定publicvoidResideStateBind(){{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,"操作錯(cuò)誤",MessageBoxButtons.OK,MessageBoxIcon.Error);ow}}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;thisthis.dgvRoom.DataSource=guestRecordList;this.SetColum();}}publicpublicvoidSetColum(){DataGridViewboBoxColumncbo=(DataGridViewboBoxColumn)this.dgvRoom.Columns["ResideId"];44/48cbo.DisplayStyle=DataGridViewboBoxDisplayStyle.Nothing;cbo.DataSource=ResideStateManager.GetAllResideState();cbo.DisplayMember="ResideName";cbo.ValueMember="ResideId";foreachforeach(DataGridViewRowrowinthis.dgvRoom.Rows){intid=(int)(row.Cells["RoomID"].Value);Roomroom=RoomManager.GetRoomByRoomId(id);=row.Cells["TypeName"].Value=RoomTypeManagerRoomTypeManager.GetRoomTypeByTypeId(room.RoomTypeID).TypeName;row.Cells["RoomStateName"].Value=RoomStateManager.GetRoomStateById(room.RoomStateID).RoomStateName;}}}#endregionprivatevoidFrmRecordInfo_Load(objectsender,EventArgse){this.ResideStateBind();}privatevoidbtnQuery_Click(objectsender,EventArgse){this.dgvRoom.SelectionChanged-=newSystem.EventHandler(this.dgvRoom_SelectionChanged);this.DBind();this.dgvRoom.SelectionChanged+=newSystem.EventHandler(this.dgvRoom_SelectionChanged);}privatevoidInitAmount()introomId=Convert.ToInt32(this.dgvRoom.CurrentRow.Cells["RoomID"].Value.ToString());DateTimeresideDate=Convert.ToDateTime(dgvRoom.CurrentRow.Cells["resideDate"].Value);intnDays=(DateTime.Now.Subtract(resideDate).Hours%24==0?0:1)+DateTime.Now.Subtract(resideDate).Days;decimaldecimalamount=GuestRecordManager.GetAmount(roomId,nDays);txtTotalMoney.Text=amount.ToString();}}privatevoiddgvRoom_SelectionChanged(objectsender,EventArgse){if(Convert.ToInt32(this.dgvRoom.CurrentRow.Cells["ResideId"].Value)==2)45/48{{txtTotalMoney.Text="已經(jīng)結(jié)賬";return;}}InitAmount();}privatevoidbtnOk_Click(objectsender,EventArgse){if(dgvRoom.SelectedRows.Count>0){if(Convert.ToInt32(this.dgvRoom.SelectedRows[0].Cells["ResideId"].Value)==2)MessageBox.Show("已經(jīng)結(jié)賬");return;}}intguestId=Convert.ToInt32(dgvRoom.CurrentRow.Cells["GuestID"].Value);decimalrefundAmount=GuestRecordManager.RefundRoom(guestId,Convert.ToDecimal(txtTotalMoney.Text),DateTime.Now);if(refundAmount>0){{MessageBox.Show(String.Format("退房成功,應(yīng)退還押金{0}元",refundAmount));}{MessageBox.Show(String.Format("退房成功,應(yīng)補(bǔ)交{0}元",Math.Abs(refundAmount)));}}this.DBind();}}privatevoidbtnExport_Click(objectsender,EventArgse){if(this.dgvRoom.Rows.Co

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論