📄 myhoteldlg.cpp
字号:
// MyhotelDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Myhotel.h"
#include "MyhotelDlg.h"
#include "LoginDlg.h"
#include "Checkinregdlg.h"
#include "Setroomdlg.h"
#include "Checkoutdlg.h"
#include "Addmoneydlg.h"
#include "Changeroomdlg.h"
#include "Findroomdlg.h"
#include "Findguazhangdlg.h"
#include "Guesthandmoneydlg.h"
#include "Findcheckindlg.h"
#include "Findcheckoutdlg.h"
#include "Roommoneyalarmdlg.h"
#include "Reghandmoneydlg.h"
#include "Roomsaledlg.h"
#include "Roomsalestaticdlg.h"
#include "Setusernamepwdlg.h"
#include "Repairpwdlg.h"
#include "Resetdatabase.h"
#include "Setuserabilitydlg.h"
#include "Findroomstatedlg.h"
#include "Roomprebookdlg.h"
#include "Findprebookroomdlg.h"
#include <stdlib.h>
#include <stdio.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CString loguserid;
extern CMyhotelApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyhotelDlg dialog
CMyhotelDlg::CMyhotelDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMyhotelDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMyhotelDlg)
m_showuser = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CMyhotelDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyhotelDlg)
DDX_Text(pDX, IDC_showuser, m_showuser);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMyhotelDlg, CDialog)
//{{AFX_MSG_MAP(CMyhotelDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_COMMAND(ID_MENU_checkinreg, OnMENUcheckinreg)
ON_BN_CLICKED(ID_BTN_borrowroom, OnBTNborrowroom)
ON_COMMAND(ID_MENU_roomsetting, OnMENUroomsetting)
ON_COMMAND(ID_MENU_checkout, OnMENUcheckout)
ON_BN_CLICKED(ID_BTN_returnroom, OnBTNreturnroom)
ON_COMMAND(ID_MENU_addmoney, OnMENUaddmoney)
ON_COMMAND(ID_MENU_changeroomreg, OnMENUchangeroomreg)
ON_COMMAND(ID_MENU_findroom, OnMENUfindroom)
ON_COMMAND(ID_MENU_findguazhang, OnMENUfindguazhang)
ON_COMMAND(ID_MENU_guazhangmoney, OnMENUguazhangmoney)
ON_COMMAND(ID_MENU_findcheckinreg, OnMENUfindcheckinreg)
ON_COMMAND(ID_MENU_findcheckoutreg, OnMENUfindcheckoutreg)
ON_COMMAND(ID_MENU_findroomfee, OnMENUfindroomfee)
ON_COMMAND(ID_MENU_regmoneytable, OnMENUregmoneytable)
ON_COMMAND(ID_MENU_saleroomtable, OnMENUsaleroomtable)
ON_COMMAND(ID_MENU_saleroomsummary, OnMENUsaleroomsummary)
ON_BN_CLICKED(ID_BTN_mainfind, OnBTNmainfind)
ON_BN_CLICKED(ID_BTN_daysummery, OnBTNdaysummery)
ON_BN_CLICKED(ID_BTN_alert, OnBTNalert)
ON_COMMAND(ID_CLOSE, OnClose)
ON_COMMAND(ID_MENU_adm_setting, OnMENUadmsetting)
ON_COMMAND(ID_MENU_pwd_setting, OnMENUpwdsetting)
ON_COMMAND(ID_MENU_setting_begin, OnMENUsettingbegin)
ON_COMMAND(ID_MENU_setting_ability, OnMENUsettingability)
ON_COMMAND(ID_MENU_findroomstate, OnMENUfindroomstate)
ON_COMMAND(ID_MENU_roomprebook, OnMENUroomprebook)
ON_COMMAND(ID_MENU_findprebookroom, OnMENUfindprebookroom)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyhotelDlg message handlers
BOOL CMyhotelDlg::OnInitDialog()
{
CLoginDlg dlg;
if(IDOK==dlg.DoModal())
{
CDialog::OnInitDialog();
// OnButton1();
//setuserability();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
/////////////////////////////////////////////////////////////
// OnButton1();
setuserability();
m_showuser =loguserid;
UpdateData(false);
/////////////////////////////////////////////////////////////
return TRUE; // return TRUE unless you set the focus to a control
}
else
exit(0);
///////////////////////////load the user's ability and update the menu
// setuserability();
}
void CMyhotelDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CMyhotelDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CMyhotelDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CMyhotelDlg::OnMENUcheckinreg()
{
// TODO: Add your command handler code here
CCheckinregdlg mycheckindlg;
mycheckindlg.DoModal();
}
void CMyhotelDlg::OnBTNborrowroom()
{
// TODO: Add your control notification handler code here
OnMENUcheckinreg();
}
void CMyhotelDlg::OnMENUroomsetting()
{
// TODO: Add your command handler code here
CSetroomdlg mysetroomdlg;
mysetroomdlg.DoModal();
}
void CMyhotelDlg::OnMENUcheckout()
{
// TODO: Add your command handler code here
CCheckoutdlg mycheckoutdlg;
mycheckoutdlg.DoModal();
}
void CMyhotelDlg::OnBTNreturnroom()
{
// TODO: Add your control notification handler code here
OnMENUcheckout();
}
void CMyhotelDlg::OnMENUaddmoney()
{
// TODO: Add your command handler code here
CAddmoneydlg myaddmoneydlg;
myaddmoneydlg.DoModal();
}
void CMyhotelDlg::OnMENUchangeroomreg()
{
// TODO: Add your command handler code here
CChangeroomdlg mychangeroomdlg;
mychangeroomdlg.DoModal();
}
void CMyhotelDlg::OnMENUfindroom()
{
// TODO: Add your command handler code here
CFindroomdlg myfindroomdlg;
myfindroomdlg.DoModal();
}
void CMyhotelDlg::OnMENUfindguazhang()
{
// TODO: Add your command handler code here
CFindguazhangdlg myfindguazhangdlg;
myfindguazhangdlg.DoModal();
}
void CMyhotelDlg::OnMENUguazhangmoney()
{
// TODO: Add your command handler code here
CGuesthandmoneydlg mygusethandmoneydlg;
mygusethandmoneydlg.DoModal();
}
void CMyhotelDlg::OnMENUfindcheckinreg()
{
// TODO: Add your command handler code here
CFindcheckindlg myfindcheckindlg;
myfindcheckindlg.DoModal();
}
void CMyhotelDlg::OnMENUfindcheckoutreg()
{
// TODO: Add your command handler code here
CFindcheckoutdlg myfindcheckoutdlg;
myfindcheckoutdlg.DoModal();
}
void CMyhotelDlg::OnMENUfindroomfee()
{
// TODO: Add your command handler code here
CRoommoneyalarmdlg myroommoneyalarmdlg;
myroommoneyalarmdlg.DoModal();
}
void CMyhotelDlg::OnMENUregmoneytable()
{
// TODO: Add your command handler code here
CReghandmoneydlg myreghandmoneydlg;
myreghandmoneydlg.DoModal();
}
void CMyhotelDlg::OnMENUsaleroomtable()
{
// TODO: Add your command handler code here
CRoomsaledlg myroomsaledlg;
myroomsaledlg.DoModal();
}
void CMyhotelDlg::OnMENUsaleroomsummary()
{
// TODO: Add your command handler code here
CRoomsalestaticdlg myroomsalestaticdlg;
myroomsalestaticdlg.DoModal();
}
void CMyhotelDlg::OnBTNmainfind()
{
// TODO: Add your control notification handler code here
OnMENUfindcheckinreg();
}
void CMyhotelDlg::OnBTNdaysummery()
{
// TODO: Add your control notification handler code here
OnMENUsaleroomtable();
}
void CMyhotelDlg::OnBTNalert()
{
// TODO: Add your control notification handler code here
OnMENUfindroomfee();
}
void CMyhotelDlg::OnClose()
{
// TODO: Add your command handler code here
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -