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

📄 showdialog.cpp

📁 用C++语言编写得职工信息管理系统
💻 CPP
字号:
// ShowDialog.cpp : implementation file
//

#include "stdafx.h"
#include "Worker.h"
#include "ShowDialog.h"

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

/////////////////////////////////////////////////////////////////////////////
// CShowDialog dialog


CShowDialog::CShowDialog(CWnd* pParent /*=NULL*/)
	: CDialog(CShowDialog::IDD, pParent)
{
	//{{AFX_DATA_INIT(CShowDialog)
	//}}AFX_DATA_INIT
}


void CShowDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CShowDialog)
	DDX_Control(pDX, IDC_ADDRECORD, m_AddBtn);
	DDX_Control(pDX, IDC_SHOWALL, m_ShowBtn);
	DDX_Control(pDX, IDC_DELETERECORD, m_DeleteBtn);
	DDX_Control(pDX, IDC_CHANGRECORD, m_ChangBtn);
	DDX_Control(pDX, IDC_LIST1, m_ShowCtrl);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CShowDialog, CDialog)
	//{{AFX_MSG_MAP(CShowDialog)
	ON_BN_CLICKED(IDC_SHOWALL, OnShowall)
	ON_BN_CLICKED(IDC_ADDRECORD, OnAddRecord)
	ON_BN_CLICKED(IDC_CHANGRECORD, OnChangRecord)
	ON_BN_CLICKED(IDC_DELETERECORD, OnDeleteRecord)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CShowDialog message handlers

BOOL CShowDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_ShowCtrl.Init();
	GetDlgItem(IDC_SHOWALL)->SetFocus();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CShowDialog::OnShowall() 
{
	// TODO: Add your control notification handler code here
	CPerson *person;
	CMyDataBase database;
	if(!database.Open())
	{
		if(MessageBox("数据库无法打开!\n\n是否现在新建?","询问",MB_ICONQUESTION|MB_YESNO)==IDYES)
		{
			database.Build();
		}
		return;
	}
	m_ShowCtrl.DelAllPerson();

	while((person=database.GetPerson())!=NULL)
	{	
		m_ShowCtrl.AddPerson(person);
		delete person;
	}
	database.Close();
	CString str;
	str.Format("共%d条记录。",m_ShowCtrl.GetItemCount());
	GetDlgItem(IDC_NUMSTATIC)->SetWindowText(str);
}

void CShowDialog::OnAddRecord() 
{
	// TODO: Add your control notification handler code here
	CAddDialog dlg;
	if(dlg.DoModal()==IDOK)
		OnShowall();
}

void CShowDialog::OnChangRecord() 
{
	// TODO: Add your control notification handler code here
	CChangNumDlg dlg;
	if(dlg.DoModal()==IDOK)
		OnShowall();
}

void CShowDialog::OnDeleteRecord() 
{
	// TODO: Add your control notification handler code here
	CDelNumDlg dlg;
	if(dlg.DoModal()==IDOK)
		OnShowall();
}

⌨️ 快捷键说明

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