{CDialog::OnOK(); CSysDialog sdlg; sdlg.DoModal(); }
else {
i++;
AfxMessageBox(\帐户名或密码错误\\n请重新输入!\ GetDlgItem(IDC_ACCOUT)->SetFocus(); if(i==3) {
AfxMessageBox(\输入错误次数太多!\ CDialog::OnOK(); } } }
登录成功后显示宾馆客房管理信息系统操作界面如下图,窗口由四个按钮和一个下拉菜单组成,主窗口为main_win,操作界面上所链接菜单为menu_menu。
主操作界面
6.2.2.宾客入住
点击操作界面的宾客入登记,进入宾客入住登记窗口,主要实现客人个人资料录入及住房信息录入等功能
21
宾客入住登记窗口
本窗口主要由多个单行编辑框、两个单选框、三个按钮、两个下拉单选框组成,其中入住时间可自动提取系统时间。点击“空房查询”按钮,可房态,输入客户个人资料和住宿信息点确定按钮提示登记成功,并返回主操作窗口。此操作的代码如下: void CInroomDialog::OnOK() { // TODO: Add extra validation here CDatabase m_database; if(!m_database.Open(_T(\ AfxMessageBox(\数据库打开出错\ m_set.Open(); CFangSet m_fset; m_fset.Open(); CString msg,tmsg; char string[10]; int tag=0; int sel; CTime m_current; UpdateData(true); if(m_lname.IsEmpty()) {AfxMessageBox(\请输入用户名\ else if(m_lpersonid.IsEmpty()) {AfxMessageBox(\请输入身份证\ else if(m_lroomid==0) { MessageBox(\房间号不对\客人登记失败\ARNING);
22
GetDlgItem(IDC_ROOM)->SetFocus(); }
else if(m_ldays==0) { MessageBox(\住宿天数不对\客人登记失败\ GetDlgItem(IDC_DAYS)->SetFocus(); }
else { while(!m_fset.IsEOF())
{ if(m_fset.m_roomID==m_lroomid) { if(m_fset.m_state==\空\ tag=1; else tag=0; break; }
else {m_fset.MoveNext();} } } /* if(tmp[0]>306||tmp[0]<100)
{AfxMessageBox(\请先查询\ }*/ /* else{ for(int i=1;i<=K;i++) {if(tmp[i-1]==m_lroomid) {tag=0;break;} }*/ if(tag==0) { AfxMessageBox(\此房有人住客人登记失败\ GetDlgItem(IDC_ROOM)->SetFocus(); } if(tag==1) { //2 try{//3 m_set.AddNew(); UpdateData(true); sel=m_num.GetCurSel(); m_set.m_people=sel+1; if(sel+1 m_set.m_personID=m_lpersonid; m_set.m_information=m_inf; if(m_lsex==0) 23 m_set.m_sex=\男\ else m_set.m_sex=\女\ m_set.m_day=m_ldays; m_set.m_logtime=m_current.GetCurrentTime(); msg+=\客人登记成功\ // m_bLogin=TRUE; UpdateData(true); // if(m_lclass==0) { m_set.m_class=\一级\ msg+=\ msg+=\费用为:\ _gcvt(m_ldays*100,10,string); msg+=string; m_set.m_cost=m_ldays*100; } else if(m_lclass==1) { m_set.m_class=\二级\ msg+=\ msg+=\费用为:\ _gcvt(m_ldays*70,10,string); msg+=string; m_set.m_cost=m_ldays*70; } else { m_set.m_class=\三级\ msg+=\ msg+=\费用为:\ _gcvt(m_ldays*40,10,string); msg+=string; m_set.m_cost=m_ldays*40; } m_set.Update(); AfxMessageBox(msg); CDialog::OnOK();} else { AfxMessageBox(\人数太多!\ 24 }//3 catch(CDBException*pe) {AfxMessageBox(pe->m_strError); pe->Delete(); } }//2 m_set.Close(); }//1 点击登记窗口中的空房查询代码可以查询房间的基本信息 双击房间号,可以查询该房间的房间状态(是否有人住)、房价及可容纳人数,实现此操作的代码如下: BOOL CFangDialog::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CString mmsg; mmsg+=\请双击一个房间号!!\ m_list.AddString(\ m_list.AddString(\ m_list.AddString(\ m_list.AddString(\ 25