⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainfrm.cpp

📁 用VC&&SQL开发的宾馆管理系统
💻 CPP
字号:
// MainFrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "Hotel_MIS.h"

#include "MainFrm.h"
#include "AppendAccountDLG.h"
#include "ChangePwdDLG.h"
#include "RoomTypeDLG.h"
#include "Hotel_MISView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMainFrame

IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
	//{{AFX_MSG_MAP(CMainFrame)
	ON_WM_CREATE()
	ON_UPDATE_COMMAND_UI(ID_MAINMENU_APPENDACCOUNT, OnUpdateAppendAccount)
	ON_COMMAND(ID_MAINMENU_CHANGEPWD, OnChangePWD)
	ON_COMMAND(ID_MAINMENU_APPENDACCOUNT, OnAppendAccount)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

static UINT indicators[] =
{
	ID_SEPARATOR,           // status line indicator
	ID_INDICATOR_CAPS,
	ID_INDICATOR_NUM,
	ID_INDICATOR_SCRL,
};

/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction

CMainFrame::CMainFrame()
{
	// TODO: add member initialization code here
	
}

CMainFrame::~CMainFrame()
{
}

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}
	return 0;
}

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	if( !CFrameWnd::PreCreateWindow(cs) )
		return FALSE;
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs
    
	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics

#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
	CFrameWnd::AssertValid();
}

void CMainFrame::Dump(CDumpContext& dc) const
{
	CFrameWnd::Dump(dc);
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers


void CMainFrame::OnUpdateAppendAccount(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable( theApp.m_sCurrentUser=="Administrator" ); 
}

void CMainFrame::OnChangePWD() 
{
	// TODO: Add your command handler code here
	CChangePwdDLG dlg;
	if ( IDOK==dlg.DoModal() )
	{
		_variant_t strQuery;
        strQuery = "update user_Info set user_PWD='"+dlg.m_sPWD1+"' where user_ID='"+theApp.m_sCurrentUser+"'";
	    theApp.ADOExecute(theApp.m_pADOSet, strQuery);
	    AfxMessageBox("修改密码成功", MB_ICONINFORMATION);
	}
	
}

void CMainFrame::OnAppendAccount() 
{
	// TODO: Add your command handler code here
	CAppendAccountDLG dlg;
	if ( IDOK==dlg.DoModal() )
	{
		_variant_t strQuery;
        strQuery = "insert user_Info (user_ID, user_PWD) values ('"+dlg.m_sUSER+"', '"+dlg.m_sPWD1+"')";
	    theApp.ADOExecute(theApp.m_pADOSet, strQuery);
	    AfxMessageBox("添加用户成功", MB_ICONINFORMATION);
	}
}

//DEL void CMainFrame::OnAlterRoomType() 
//DEL {
//DEL 	// TODO: Add your command handler code here
//DEL 	CHotel_MISView* p= (CHotel_MISView*)GetActiveView();
//DEL     p->LoadListCtrl();
//DEL }

//DEL void CMainFrame::OnDelRoomType() 
//DEL {
//DEL 	// TODO: Add your command handler code here
//DEL 	CHotel_MISView* p= (CHotel_MISView*)GetActiveView();
//DEL 	p->UnLoadListCtrl();
//DEL }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -