MFC-賓館管理系統(tǒng)_第1頁(yè)
MFC-賓館管理系統(tǒng)_第2頁(yè)
MFC-賓館管理系統(tǒng)_第3頁(yè)
MFC-賓館管理系統(tǒng)_第4頁(yè)
MFC-賓館管理系統(tǒng)_第5頁(yè)
已閱讀5頁(yè),還剩13頁(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)介

賓館管理系統(tǒng)

一程序界面

1主界面

2入住與訂房界面

3結(jié)帳界面

二程序源代碼

主界面源代碼

//hotelDIg.cpp:implementationfile

//

include"stdafx.h"

ttinclude"hotel.h"

#include"hotelDIg.h"

//include"fstream.h"

ttinclude"rzdj.h"

#include"gkjz.h"

tfifdef_DEBUG

ttdefinenewDEBUG_NEW

#undefTHIS_FILE

staticcharTHIS_FILE[]=__FILE;

ttendif

lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll

11CAboutDIgdialogusedforAppAbout

classCAboutDIg:publicCDalog

(

public:

CAboutDIgO;

//DialogData

//{{AFX_DATA(CAboutDlg)

enum{IDD=IDD_ABOUTBOX};

//}}AFX_DATA

//ClassWizardgeneratedvirtualfunctionoverrides

//{{AFX_VIRTUAL(CAboutDlg)

protected:

virtualvoidDoDataExchange(CDataExchange*pDX);//DDX/DDVsupport

//}}AFX_VIRTUAL

//Implementation

protected:

//{{AFX_MSG(CAboutDlg)

//}}AFX_MSG

DECLARE_MESSAGE_MAP()

CAboutDlg::CAboutDlg():CDialog(CAboutDlg::IDD)

(

//{{AFX_DATA_INIT(CAboutDlg)

//}}AFX_DATA_INIT

)

voidCAboutDlg::DoDataExchange(CDataExchange*pDX)

(

CDialog::DoDataExchange(pDX);

//{{AFX_DATA_MAP(CAboutDlg)

//}}AFX_DATA_MAP

)

BEGIN_MESSAGE_MAP(CAboutDlg,CDialog)

//{{AFX_MSG_MAP(CAboutDlg)

〃Nomessagehandlers

//}}AFX_MSG_MAP

END_MESSAGE_MAP()

lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll

11CHotelDIgdialog

CHotelDlg::CHotelDlg(CWnd*pParent/*=NULL*/)

:CDialog(CHotelDlg::IDD,pParent)

(

//{{AFX_DATA_INIT(CHotelDig)

m_name=_T("");

m_password=_T("");

//}}AFX_DATA_INIT

//NotethatLoadicondoesnotrequireasubsequentDestroylconinWin32

m_hlcon=AfxGetApp()->Loadlcon(IDR_MAINFKAME);

)

CHotelDlg::-CHotelDlg()

(

fstreamq;

q.open("guest.txt",ios::out|ios::binary);

guest

p=Head.next;

while(p)

(

q.write((char*)p,sizeof(guest));

p=p->next;

)

q.close();

p=&Head;

t=p->next;

while(!t)

deletetemp;

P-closeO;

TCHARrgtsz[4][10]={_T("房號(hào),_T("姓名)_T(“身份證號(hào)。,_T("入住日期

")};

LV_COLUMNIvcolumn;

CRectrect;

m_list.GetWindowRect(&rect);

m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP/*|LVS_EX_G

RIDLINES*/);

for(inti=1;i<5;i++)

(

Ivcolumn.mask=LVCF_FMT|LVCF_SUBITEM|LVCF_TEXT|

LVCF_WIDTH|LVCF_ORDER;

Ivcolumn.fmt=LVCFMT_CENTER;

Ivcolumn.pszText=rgtsz[i-l];

Ivcolumn.iSubltem=i;

Ivcolumn.iOrder=i;

Ivcolumn.cx=(rect.Width())/4;

m_list.lnsertColumn(i,&lvcolumn);

)

inputCtrIListO;

)

BEGIN_MESSAGE_MAP(CHotelDlg,CDialog)

//{{AFX_MSG_MAP(CHOtelDlg)

ON_WM_SYSCOMMAND()

ON_WM_PAINT()

ON_WM_QUERYDRAGICON()

ON_BN_CLICKED(IDC_BUTTON14,OnButtonl4)

ON_BN_CUCKED(IDC_BUTTON13ZOnButtonl3)

ON_BN_CLICKED(IDC_BUTTON1,OnButtonl)

ON_BN_CUCKED(IDC_BUTTON7,OnButton7)

ON_BN_CLICKED(IDC_BUTTON8,OnButton8)

ON_BN_CUCKED(IDC_BUTTON9,OnButton9)

ON_BN_CLICKED(IDC_BUTTON10ZOnButtonlO)

ON_CBN_SELCHANGE(IDC_COMBO1,OnSelchangeCombol)

//}}AFX_MSG_MAP

END_MESSAGE_MAP()

lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll

11CHotelDIgmessagehandlers

BOOLCHotelDlg::OnlnitDialog()

(

CDialog::OnlnitDialog(j;

//Add"About..."menuitemtosystemmenu.

11IDM_ABOUTBOXmustbeinthesystemcommandrange.

ASSERT((IDM_ABOUTBOX&OxFFFO)==IDM_ABOUTBOX);

ASSERT(IDM_ABOUTBOX<OxFOOO);

CMenu*pSysMenu=GetSystemMenu(FALSE);

if(pSysMenu!=NULL)

(

CStringstrAboutMenu;

strAboutMenu.LoadString(IDS_ABOUTBOX);

if(!strAboutMenu.lsEmpty())

(

pSysMenu->AppendMenu(MF_SCPARATOR);

pSysMenu->AppendMenu(MF_STRING,IDM_ABOUTBOX,strAboutMenu);

)

)

//Settheiconforthisdialog.Theframeworkdoesthisautomatically

//whentheapplication'smainwindowisnotadialog

Setlcon(m_hlcon,TRUE);//Setbigicon

Setlcon(m_hlcon,FALSE);//Setsmallicon

//TODO:Addextrainitializationhere

returnTRUE;//returnTRUEunlessyousetthefocustoacontrol

)

voidCHotelDlg::OnSysCommand(UINTnID,LPARAMIParam)

(

if((nID&OxFFFO)==IDM_ABOUTBOX)

(

CAboutDIgdlgAbout;

dlgAbout.DoModal();

)

else

CDialog::OnSysCommand(nlD,IParam);

)

//Ifyouaddaminimizebuttontoyourdialog,youwillneedthecodebelow

//todrawtheicon.ForMFCapplicationsusingthedocument/viewmodel,

//thisisautomaticallydoneforyoubytheframework.

voidCHotelDlg::OnPaint()

(

if(lslconic())

(

CPaintDCdc(this);//devicecontextforpainting

SendMessage(WM_ICONERASEBKGNDz(WPARAM)dc.GetSafeHdc(),0);

//Centericoninclientrectangle

intcxlcon=GetSystemMetrics(SM_CXICON);

intcylcon=GetSystemMetrics(SM_CYICON);

CRectrect;

GetClientRect(&rect);

intx=(rect.Width()-cxlcon+1)/2;

inty=(rect.Heightf)-cylcon+1)/2;

//Drawtheicon

dc.Drawlcon(x,y,m_hlcon);

)

else

(

CDialog::OnPaint();

)

)

//Thesystemcallsthistoobtainthecursortodisplaywhiletheuserdrags

//theminimizedwindow.

HCURSORCHotelDlg::OnQueryDraglcon()

(

return(HCURSOR)m_hlcon;

)

voidCHotelDlg::OnButtonl4()

(

//TODO:Addyourcontrolnotificationhandlercodehere

m_user.SetWindowText("");

m_pwd.SetWindowText("");

)

voidCHotelDlg::OnButtonl3()

(

//TODO:Addyourcontrolnotificationhandlercodehere

intc=l;

m_user.GetWindowText(m_name);

m_pwd.GetWindowText(m_password);

fstreamfile;

,,

file.open(master.txt"/ios::in);

charname[81];

charpassword[81];

file.getline(namez80/\n');

file.getline(password,80/\n');

while(!file.eof())

(

if(strcmp(m_name/name)==0&&strcmp(m_password/password)==0)

(

c=l;

break;

)

file.getlinelname3O/'Xn');

file.getline(password,80,'\n');

)

if(c==O)

(

MessageBox(”用戶名或密碼錯(cuò)誤","wrong”,MBJCONWARNING);

)

else

(

m_gly.ShowWindow(FALSE);

m_mm.ShowWindowfFALSE);

m_user.ShowWindow(FALSE);

m_pwd.ShowWindow(FALSE);

m_qd.ShowWindDW(FALSE);

m_zt.ShowWindcw(FALSE);

m_dj.EndModalState();

mJz.EndModalState();

m_yd.EndModalState();

m_nh.ShowWindow(TRUE);

m_zx.ShowWindow(TRUE);

)

)

voidCHotelDlg::OnButtonl()

//TODO:Addyourcontrolnotificationhandlercodehere

m_gly.ShowWindow(TRUE);

m_mm.ShowWindow(TRUE);

m_user.ShowWindow(TRUE);

m_pwd.ShowWindowiTRUE);

m_qd.ShowWindow(TRUE);

m_zt.ShowWindow(TRUE);

m_dj.BeginModalState();

m_Jz.BeginModalState();

m_yd.BeginModalState();

m_nh.ShowWindow(FALSE);

m_zx.ShowWindow(FALSE);

m_pwd.SetWindowText("");

m_user.SetWindowText("");

)

voidCHotelDlg::OnButton7l)

(

//TODO:Addyourcontrolnotificationhandlercodehere

if(totle>0)

(

rzdjf;

f.DoModal();

if(f.m_name!=""&&f.m_sfzh!=""&&f.m_fh!=""&&f.m_rq!="")

(

chara[ll],b[19],c⑸,

strcpy(aJ.m_name.GetBuffer(O));

strcpy(b,f.m_sfzh.GetBuffer(O));

strcpy(c,f.m_fh.GetBuffer(O));

strcpy(d,f.m_rq.GetBuf能r(0));

guest*x;

x=newguest(a,b,c,d);

x->next=Head.next;

Head.next=x;

totle-;

)

)

else

(

MessageBox(“無(wú)空客房","wrong”,MB」CONWARNING);

)

inputCtrlList();

)

voidCHotelDlg::OnButton8i)

//TODO:Addyourcontrolnotificationhandlercodehere

gkjzg;

g.setList(Head);

g.DoModal();

totle++;

)

voidCHotelDlg::OnButton9i)

(

//TODO:Addyourcontrolnotificationhandlercodehere

if(totle>0)

(

rzdjf;

f.DoModal();

(

chara[ll]zb[19],c[5],d[ll];

strcpy(a,f.m_name.GetBuffer(O));

strcpy(b/f.m_sfzh.GetBuffer(O));

strcpy(c,f.m_fh.GetBuffer(O));

strcpy(d,f.m_rq.GetBuffer(O));

guest*x;

x=newguest(a,b,c,d);

x->next=Head.next;

Head.next=x;

totle-;

)

)

else

(

MessageBox("無(wú)空客房"「wrong",MB」CONWARNING);

)

)

voidCHotelDlg::OnButtonlO()

//TODO:Addyourcontrolnotificationhandlercodehere

ShellExecute(NULL,"open","hotel.doc",NULL,NULL,SW_SHOWNORMAL);

)

voidCHotelDlg::OnSelchangeCombol()

(

//TODO:Addyourcontrolnotificationhandlercodehere

intnlndex=m_com.GetCurSel();

reput(nlndex);

)

voidCHotelDlg::inputCtrlList(){

guest*p;

intk=0;

m_list.DeleteAllltems(i;

for(inti=0;i<100;i++)

(

m_list.lnsertltem|k,LPSTR_TEXTCALLBACK);

chartemp[20];

itoa(i+l,temp,10):

m_list.SetltemText(k,O,temp);

p=Uead.next;

while(p)

(

if(atoi(p->getNum())==i+l)

{

break;

)

p=p->next;

)

if(P)

(

m_list.SetltemText(k/l/p->getName());

m_list.SetltemText(kz2zp->getld());

m_list.SetltemText(kz3/P->getDateO);

}

k++;

)

)

voidCHotelDlg::reput(intx)

{

guest*p;

intk=0;

inti;

m_list.DeleteAllltems();

switch(x)

case0:

for(i=0;i<50;i+=2)

(

mJist.lnsertltemfKLPSTR-TEXTCALLBACK);

chartemp[20];

itoa(i+l,temp,10);

m_list.SetltemText(k/O/temp);

p=Head.next;

while(p)

(

if(atoi(p->getNum())==i+l)

(

break;

)

p=p->next;

)

if(P)

(

m_list.SetltemText(k,lzp->getName());

m_list.SetltemText(kz2,p->getld());

m」ist.SetltemText(k,3,p->getDate());

)

k++;

)

break;

case1:

for(i=50;i<100;i++)

(

m_list.lnsertltem(k,LPSTR_TEXTCALLBACK);

chartemp[20];

itoa(i+l,temp,10);

mJist.SetltemTextfKO.temp);

p=Head.next;

while(p)

(

if(atoi(p->getNum())==i+l)

(

break;

)

p=p->next;

)

if(P)

m_list.SetltemText(k,lzp->getName());

m_list.SetltemText(k,2,p->getld());

m_list.SetltemText(k,3/p->getDate());

)

k++;

)

break;

case2:

for(i=l;i<50;i+=2)

(

m_list.lnsertltem(k,LPSTR_TEXTCALLBACK);

chartemp[20];

itoa(i+l/temp,10);

mJist.SetltemTextfk^O^emp);

p=Head.next;

while(p)

(

if(atoi(p->getNum())==i+l)

(

break;

)

p=p->next;

)

if(P)

{

m」ist.SetltemText(k,l,p->getName());

m_list.SetltemText(k,2,p->getld());

m」ist.SetltemText(k,3,p->getDate());

)

k++;

)

break;

)

}

2入住與訂房界面代碼

//rzdj.cpp:implementationfile

//

#include"stdafx.h"

^include"hotel.h"

^include"rzdj.h"

#ifdef.DEBUG

#definenewDEBUG_NEW

#undefTHIS_FILE

staticcharTHIS_FILE[]=_FILEj

ttendif

lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll

11rzdjdialog

rzdj::rzdj(CWnd*pParent/*=NULL*/)

:CDialog(rzdj::IDD,pParent)

(

//{{AFX_DATA_INIT(rzdj)

m_name=_T("");

m-sfzh=

m_fh=_T("");

m_rq=_T("");

//}}AFX_DATA_INIT

)

voidrzdj::DoDataExchange(CDataExchange*pDX)

CDialog::DoDataExchange(pDX);

//{{AFX_DATA_MAP(rzdj)

DDX_Text(pDX,IDC_EDIT1,m_name);

DDV_MaxChars(pDX,m_name,10);

DDX_Text(pDX,IDC_EDIT2,m_sfzh);

DDV_MaxChars(pDX,m_sfzhz18);

DDX_Text(pDX,IDC_EDIT3,m_fh);

DDV_MaxChars(pDX,m_fh,4);

DDX_Text(pDXzIDC_EDIT4Zm_rq);

DDV_MaxChars(pDX/m_rq,10);

//}}AFX_DATA_MAP

)

BEGIN_MESSAGE_MAP(rzdj,CDialog)

//{{AFX_MSG_MAP(rzdj)

//}}AFX_MSG_MAP

END_MESSAGE_MAP()

lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll

〃rzdjmessagehandlers

voidrzdj::OnOK()

(

//TODO:Addextravalidationhere

UpdateData(TRUE);

CDialog::OnOK();

}

3結(jié)賬界面代碼

//gkjz.cpp:implementationfile

//

include"stdafx.h"

#include"hotel.h"

include"gkjz.h"

#ifdef_DEBUG

#definenewDEBUG_NEW

#undefTHIS_FILE

staticcharTHIS_FILE[]=_FILE_;

#endif

/////////////////////////////////////////////////////////////////////////////

//gkjzdialog

gkjz::gkjz(CWnd*pParent/*=NULL*/)

:CDialogfgkjzizIDD,pParent)

(

//{{AFX_DATA_INIT(gkjz)

m_fh=_T("");

m_ts=0;

mjg=O.Of;

//}}AFX_DATA_INIT

voidgkjz::DoDataExchange(CDataExchange*pDX)

(

CDialog::DoDataExchange(pDX);

//{{AFX_DATA_MAP(gkjz)

DDX.ControKpDX,IDC_EDIT3fm_p);

DDX_Control(pDX,IDC_EDIT2,m_d);

DDX_Text(pDX,IDC_EDIT1,m_fh);

DDV_MaxChars(pDX/m_fh,4);

DDX_Text(pDXzIDC_EDIT2,m_ts);

DDX_Text(pDX,IDJEDIT3,mjg);

//}}AFX_DATA_MAP

BEGIN_MESSAGE_MAP(gkjz,CDialog)

//{{AFX_MSG_MAP(gkjz)

ON_EN_KILLFOCUS(IDC_EDrri,OnKillfocusEditl)

//}}AFX_MSG_MAP

END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////

11gkjzmessagehandlers

voidgkjz::setList(guest&x)

(

List=&x;

voidgkjz::OnOK()

(

〃TODO:Addextravalidationhere

guest+t;

t=List;

if(P)

(

while(t->next!=p)

(

t=t->next;

}

t->next=p->next;

deletep;

)

CDialog::OnOK();

voidgkjz::OnKillfocusEditl()

//TODO:Addyourcontrolnotificationhandlercodehere

p=List->next;

UpdateData(TRUE);

while(p)

{

if(strcmp(p->getNum()/this->m_fh)==O)

(

break;

)

p=p->next;

)

if(p==NULL)

(

MessageBox("該客房未被預(yù)訂"Jwrong^MB'CONWARNING);

}

else

(

chartemp[3];

intd;

forfinti=0;i<2;i++)

(

temp[i]=*(p->getDate()+8+i);

)

SYSTEMTIMEst={0};

GetLocalTime(&st);

d=st.wDay-atoi(temp);

m_ts=d;

mjg=(float)(d*50);

UpdateData(FALSE);

)

三程序運(yùn)行結(jié)果

登陸界面

上客房管理系統(tǒng)x

查詢面板

關(guān)鍵字

入住與懵訂X:

確定I

取消

你好管理員

注楷

土客房管理系統(tǒng)X

查詢面板

關(guān)鍵字HI

層號(hào)姓名身份證號(hào)入住日斯

1

2林12345678901234514-05-1C

3

4

5

6

7

8

9

1O

溫馨提示

  • 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ù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 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)論