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

📄 mainfrm.cpp

📁 小型超市管理系统是方便超市管理员管理超市的一个小软件
💻 CPP
字号:
// MainFrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "SuperMarket.h"
#include "SaleDlg.h"
#include "MainFrm.h"
#include "SecretChangeDlg.h"
#include "StoreSearchDlg.h"
#include "AddStoreDlg.h"
#include "ChangeStoreDlg.h"
#include "DeleteStoreDlg.h"
#include "SearchMemberDlg.h"
#include "AddMemberDlg.h"
#include "ChangeMemberDlg.h"
#include "DelMemberDlg.h"
#include "EnterDlg.h"
#include "CreatPlanDlg.h"
#include "QuehuoSearchDlg.h"
#include "UserSearchDlg.h"
#include "AddUserDlg.h"
#include "DelUserDlg.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_COMMAND(ID_xsjz, Onxsjz)
	ON_COMMAND(ID_HT_KCCX, OnHtKccx)
	ON_COMMAND(ID_HT_KCTJ, OnHtKctj)
	ON_COMMAND(ID_HT_KCXG, OnHtKcxg)
	ON_COMMAND(ID_HT_KCSC, OnHtKcsc)
	ON_COMMAND(ID_HT_HYCX, OnHtHycx)
	ON_COMMAND(ID_HT_HYTJ, OnHtHytj)
	ON_COMMAND(ID_HT_HYXG, OnHtHyxg)
	ON_COMMAND(ID_HT_HYSC, OnHtHysc)
	ON_UPDATE_COMMAND_UI(ID_xsjz, OnUpdatexsjz)
	ON_UPDATE_COMMAND_UI(ID_HT_KCCX, OnUpdateHtKccx)
	ON_UPDATE_COMMAND_UI(ID_HT_KCTJ, OnUpdateHtKctj)
	ON_UPDATE_COMMAND_UI(ID_HT_KCXG, OnUpdateHtKcxg)
	ON_UPDATE_COMMAND_UI(ID_HT_KCSC, OnUpdateHtKcsc)
	ON_UPDATE_COMMAND_UI(ID_HT_HYCX, OnUpdateHtHycx)
	ON_UPDATE_COMMAND_UI(ID_HT_HYTJ, OnUpdateHtHytj)
	ON_UPDATE_COMMAND_UI(ID_HT_HYXG, OnUpdateHtHyxg)
	ON_UPDATE_COMMAND_UI(ID_HT_HYSC, OnUpdateHtHysc)
	ON_UPDATE_COMMAND_UI(ID_HT_JHQHCX, OnUpdateHtJhqhcx)
	ON_UPDATE_COMMAND_UI(ID_HT_JHZD, OnUpdateHtJhzd)
	ON_UPDATE_COMMAND_UI(ID_XTDL, OnUpdateXtdl)
	ON_COMMAND(ID_XTDL, OnXtdl)
	ON_COMMAND(ID_xttc, Onxttc)
	ON_UPDATE_COMMAND_UI(ID_xttc, OnUpdatexttc)
	ON_COMMAND(ID_HT_JHZD, OnHtJhzd)
	ON_COMMAND(ID_HT_JHQHCX, OnHtJhqhcx)
	ON_COMMAND(ID_HT_YHCX, OnHtYhcx)
	ON_COMMAND(ID_HT_YHTJ, OnHtYhtj)
	ON_COMMAND(ID_HT_YHSC, OnHtYhsc)
	ON_UPDATE_COMMAND_UI(ID_HT_YHCX, OnUpdateHtYhcx)
	ON_UPDATE_COMMAND_UI(ID_HT_YHTJ, OnUpdateHtYhtj)
	ON_UPDATE_COMMAND_UI(ID_HT_YHSC, OnUpdateHtYhsc)
	//}}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
 xtdl=true;
 xttc=false;
 xsjz=false;
 htkccx=false;
 htkctj=false;
 htkcxg=false;
 htkcsc=false;
 hthycx=false;
hthytj=false;
 hthyxg=false;
 hthysc=false;
htdhjh=false;
htdycx=false;
 htyhcx=false;
 htyhtj=false;
 htyhsc=false;

xthygl=false;
}

CMainFrame::~CMainFrame()
{
}

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) )
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

	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
	}

	// TODO: Delete these three lines if you don't want the toolbar to
	//  be dockable
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar(&m_wndToolBar);

	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::Onxsjz() 
{
	// TODO: Add your command handler code here
	 CSaleDlg dlg;
	 dlg.DoModal();
}

void CMainFrame::OnHtKccx() 
{
	// TODO: Add your command handler code here
	CStoreSearchDlg dlg;
	dlg.DoModal();
}

void CMainFrame::OnHtKctj() 
{
	// TODO: Add your command handler code here
	CAddStoreDlg dlg;
	dlg.DoModal();
}

void CMainFrame::OnHtKcxg() 
{
	// TODO: Add your command handler code here
	CChangeStoreDlg dlg;
	dlg.DoModal();
}

void CMainFrame::OnHtKcsc() 
{
	// TODO: Add your command handler code here
	CDeleteStoreDlg dlg;
	dlg.DoModal();
}

void CMainFrame::OnHtHycx() 
{
	// TODO: Add your command handler code here
	CSearchMemberDlg dlg;
	dlg.DoModal();
}

void CMainFrame::OnHtHytj() 
{
	// TODO: Add your command handler code here
	CAddMemberDlg dlg;
	dlg.DoModal();
}

void CMainFrame::OnHtHyxg() 
{
	// TODO: Add your command handler code here
	CChangeMemberDlg dlg;
	dlg.DoModal();
}

void CMainFrame::OnHtHysc() 
{
	// TODO: Add your command handler code here
	CDelMemberDlg dlg;
	dlg.DoModal();
}

void CMainFrame::OnUpdatexsjz(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(xsjz);
}

void CMainFrame::OnUpdateHtKccx(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
		pCmdUI->Enable(htkccx);
}

void CMainFrame::OnUpdateHtKctj(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
		pCmdUI->Enable(htkctj);
}

void CMainFrame::OnUpdateHtKcxg(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
		pCmdUI->Enable(htkcxg);
}

void CMainFrame::OnUpdateHtKcsc(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(htkcsc);
}

void CMainFrame::OnUpdateHtHycx(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(hthycx);
}

void CMainFrame::OnUpdateHtHytj(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
		pCmdUI->Enable(hthytj);
}

void CMainFrame::OnUpdateHtHyxg(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
		pCmdUI->Enable(hthyxg);
}

void CMainFrame::OnUpdateHtHysc(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
		pCmdUI->Enable(hthysc);
}

void CMainFrame::OnUpdateHtJhqhcx(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
		pCmdUI->Enable(htdycx);
}

void CMainFrame::OnUpdateHtJhzd(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
		pCmdUI->Enable(htdhjh);
}



void CMainFrame::OnUpdateXtdl(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(xtdl);
}

void CMainFrame::OnXtdl() 
{
	// TODO: Add your command handler code here
		CEnterDlg dlg;
	dlg.DoModal();
	if(dlg.a==true)
	{
		xtdl=false;
		xttc=true;
	if(dlg.employee ==true)
	{
 xsjz=true;
 htkccx=false;
 htkctj=false;
 htkcxg=false;
 htkcsc=false;
 hthycx=false;
hthytj=false;
 hthyxg=false;
 hthysc=false;
htdhjh=false;
htdycx=false;
 htyhcx=false;
 htyhtj=false;
 htyhsc=false;

xthygl=false;
	}
	else if(dlg.manager==true)
	{
 xsjz=true;
 
 htkccx=true;
 htkctj=true;
 htkcxg=true;
 htkcsc=true;
 hthycx=true;
hthytj=true;
 hthyxg=true;
 hthysc=true;
htdhjh=true;
htdycx=true;
 htyhcx=true;
 htyhtj=true;
 htyhsc=true;

xthygl=true;
	}
	}
}

void CMainFrame::Onxttc() 
{
	// TODO: Add your command handler code here
xtdl=true;
 xttc=false;
 xsjz=false;
 htkccx=false;
 htkctj=false;
 htkcxg=false;
 htkcsc=false;
 hthycx=false;
hthytj=false;
 hthyxg=false;
 hthysc=false;
htdhjh=false;
htdycx=false;
xthygl=false;
 htyhcx=false;
 htyhtj=false;
 htyhsc=false;

}

void CMainFrame::OnUpdatexttc(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(xttc);
}

void CMainFrame::OnHtJhzd() 
{
	// TODO: Add your command handler code here
	CCreatPlanDlg dlg;
	dlg.DoModal();
}

void CMainFrame::OnHtJhqhcx() 
{
	// TODO: Add your command handler code here
	CQuehuoSearchDlg dlg;
	dlg.DoModal();
}

void CMainFrame::OnHtYhcx() 
{
	// TODO: Add your command handler code here
	CUserSearchDlg dlg;
	dlg.DoModal();
}

void CMainFrame::OnHtYhtj() 
{
	// TODO: Add your command handler code here
	CAddUserDlg dlg;
	dlg.DoModal();
}

void CMainFrame::OnHtYhsc() 
{
	// TODO: Add your command handler code here
	CDelUserDlg dlg;
	dlg.DoModal();
}

void CMainFrame::OnUpdateHtYhcx(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(htyhcx);
}

void CMainFrame::OnUpdateHtYhtj(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
		pCmdUI->Enable(htyhtj);
}

void CMainFrame::OnUpdateHtYhsc(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
		pCmdUI->Enable(htyhsc);
}

⌨️ 快捷键说明

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