📄 hrdbdlg.cpp
字号:
// HRDBDlg.cpp : implementation file
//
#include "stdafx.h"
#include "HRDB.h"
#include "HRDBDlg.h"
#include "InputCountriesDlg.h"
#include "InputDepDlg.h"
#include "InputEmployeesDlg.h"
#include "InputJHDlg.h"
#include "InputJobsDlg.h"
#include "InputLocationsDlg.h"
#include "InputRegionsDlg.h"
#include "QueryRegionDlg.h"
#include "QueryCountryDlg.h"
#include "QueryLocationDlg.h"
#include "QueryDepartmentDlg.h"
#include "LoginDlg.h"
#include "AboutDlg.h"
#include "RegionsEmpViewDlg.h"
#include "CountriesEmpViewDlg.h"
#include "JobsEmpViewDlg.h"
#include "EmpDetailsViewDlg.h"
#include "DepartDetailsViewDlg.h"
#include "DeptCurrentJobsViewDlg.h"
#include "DeptHistoryJobsViewDlg.h"
#include "CurrentJobsViewDlg.h"
#include "CountriesJobsViewDlg.h"
#include "RegionsEmpNumbersViewDlg.h"
#include "CountriesSalaryViewDlg.h"
#include "DeptSalaryViewDlg.h"
#include "desexec.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//定义全局SQL环境变量
extern SQLHENV henv;
extern SQLHDBC hdbc;
extern SQLHSTMT hstmt;
extern SQLRETURN retcode;
extern BOOL findResult;
/////////////////////////////////////////////////////////////////////////////
// CHRDBDlg dialog
CHRDBDlg::CHRDBDlg(CWnd* pParent /*=NULL*/)
: CDialog(CHRDBDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CHRDBDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CHRDBDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CHRDBDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CHRDBDlg, CDialog)
//{{AFX_MSG_MAP(CHRDBDlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_COMMAND(ID_INPUT_COUNTRIES, OnInputCountries)
ON_COMMAND(ID_INPUT_DEPARTMENTS, OnInputDepartments)
ON_COMMAND(ID_INPUT_EMPLOYEES, OnInputEmployees)
ON_COMMAND(ID_INPUT_JOB_HISTORY, OnInputJobHistory)
ON_COMMAND(ID_INPUT_JOBS, OnInputJobs)
ON_COMMAND(ID_INPUT_LOCATIONS, OnInputLocations)
ON_COMMAND(ID_INPUT_REGIONS, OnInputRegions)
ON_COMMAND(ID_EXIT, OnExit)
ON_COMMAND(ID_QUERY_REGIONS, OnQueryRegions)
ON_COMMAND(ID_ABOUT, OnAbout)
ON_COMMAND(ID_REGIONS_VIEW, OnRegionsView)
ON_COMMAND(ID_COUNTRIES_VIEW, OnCountriesView)
ON_COMMAND(ID_JOBS_VIEW, OnJobsView)
ON_COMMAND(ID_EMPLOYEES_VIEW, OnEmployeesView)
ON_COMMAND(ID_EMPLOYEE_DEPARTMENT_VIEW, OnEmployeeDepartmentView)
ON_COMMAND(ID_DEPARTMENT_JOBS_VIEW, OnDepartmentJobsView)
ON_COMMAND(ID_DEPARTMENT_HISTORY_JOBS_VIEW, OnDepartmentHistoryJobsView)
ON_COMMAND(ID_JOBS_EMPLOYEES_VIEW, OnJobsEmployeesView)
ON_COMMAND(ID_COUNTRIES_JOBS_VIEW, OnCountriesJobsView)
ON_COMMAND(ID_REGION_EMPLOYEES_VIEW, OnRegionEmployeesView)
ON_COMMAND(ID_COUNTRY_SALARY, OnCountrySalary)
ON_COMMAND(ID_DEPARTMENT_SALARY_VIEW, OnDepartmentSalaryView)
ON_COMMAND(ID_QUERY_COUNTRIES, OnQueryCountries)
ON_COMMAND(ID_QUERY_LOCATIONS, OnQueryLocations)
ON_COMMAND(ID_QUERY_DEPARTMENTS, OnQueryDepartments)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CHRDBDlg message handlers
BOOL CHRDBDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// 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
CLoginDlg login;
int nResponse = login.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
if (findResult == FALSE)
{
// 登录失败,则退出
CHRDBDlg::OnExit();
}
return TRUE; // return TRUE unless you set the focus to a control
}
// 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 CHRDBDlg::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 CHRDBDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CHRDBDlg::OnInputCountries()
{
//显示国家表输入对话框
CInputCountriesDlg InputCountriesDlg;
int nResponse = InputCountriesDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnInputDepartments()
{
//显示部门表输入对话框
CInputDepDlg InputDepDlg;
int nResponse = InputDepDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnInputEmployees()
{
//显示员工表输入对话框
CInputEmployeesDlg InputEmployeesDlg;
int nResponse = InputEmployeesDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnInputJobHistory()
{
//显示历史工种表输入对话框
CInputJHDlg InputJHDlg;
int nResponse = InputJHDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnInputJobs()
{
//显示当前工种表输入对话框
CInputJobsDlg InputJobsDlg;
int nResponse = InputJobsDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnInputLocations()
{
//显示地区表输入对话框
CInputLocationsDlg InputLocationsDlg;
int nResponse = InputLocationsDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnInputRegions()
{
//显示大区表输入对话框
CInputRegionsDlg InputRegionsDlg;
int nResponse = InputRegionsDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnExit()
{
// 释放语句句柄
TODBCc( hdbc, SQLFreeHandle( SQL_HANDLE_STMT, hstmt ) );
// 断开连接
TODBCc( hdbc, SQLDisconnect( hdbc ) );
// 释放连接句柄
TODBCe( henv, SQLFreeHandle( SQL_HANDLE_DBC, hdbc ) );
// 释放环境句柄
TODBC0( SQLFreeHandle( SQL_HANDLE_ENV, henv ) );
CDialog::OnCancel();
}
void CHRDBDlg::OnQueryRegions()
{
//显示大区表查询对话框
CQueryRegionDlg QueryRegionsDlg;
int nResponse = QueryRegionsDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnAbout()
{
// 显示关于对话框
CAboutDlg AboutDlg;
int nResponse = AboutDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnRegionsView()
{
// 显示大区员工列表
CRegionsEmpViewDlg RegionsEmpViewDlg;
int nResponse = RegionsEmpViewDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnCountriesView()
{
// 显示国家员工列表
CCountriesEmpViewDlg CountriesEmpViewDlg;
int nResponse = CountriesEmpViewDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnJobsView()
{
// 显示工种员工列表
CJobsEmpViewDlg JobsEmpViewDlg;
int nResponse = JobsEmpViewDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnEmployeesView()
{
// 显示员工明细列表
CEmpDetailsViewDlg EmpDetailsViewDlg;
int nResponse = EmpDetailsViewDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnEmployeeDepartmentView()
{
// 显示员工工作部门列表
CDepartDetailsViewDlg DepartDetailsViewDlg;
int nResponse = DepartDetailsViewDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnDepartmentJobsView()
{
// 显示部门当前工种列表
CDeptCurrentJobsViewDlg DeptCurrentJobsViewDlg;
int nResponse = DeptCurrentJobsViewDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnDepartmentHistoryJobsView()
{
// 显示部门历史工种列表
CDeptHistoryJobsViewDlg DeptHistoryJobsViewDlg;
int nResponse = DeptHistoryJobsViewDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnJobsEmployeesView()
{
// 显示当前工种员工列表
CCurrentJobsViewDlg CurrentJobsViewDlg;
int nResponse = CurrentJobsViewDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnCountriesJobsView()
{
// 显示国家员工工种列表
CCountriesJobsViewDlg CountriesJobsViewDlg;
int nResponse = CountriesJobsViewDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnRegionEmployeesView()
{
// 显示大区员工数列表
CRegionsEmpNumbersViewDlg RegionsEmpNumbersViewDlg;
int nResponse = RegionsEmpNumbersViewDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnCountrySalary()
{
// 显示国家员工平均工资
CCountriesSalaryViewDlg CountriesSalaryViewDlg;
int nResponse = CountriesSalaryViewDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnDepartmentSalaryView()
{
// 显示部门员工的平均工资、最低工资和最高工资
CDeptSalaryViewDlg DeptSalaryViewDlg;
int nResponse = DeptSalaryViewDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnQueryCountries()
{
// 显示国家表查询对话框
CQueryCountryDlg QueryCountryDlg;
int nResponse = QueryCountryDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnQueryLocations()
{
// 显示地区表查询对话框
CQueryLocationDlg QueryLocationDlg;
int nResponse = QueryLocationDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CHRDBDlg::OnQueryDepartments()
{
// 显示部门表查询对话框
CQueryDepartmentDlg QueryDepartmentDlg;
int nResponse = QueryDepartmentDlg.DoModal();
if (nResponse ==IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -