
// ZGKJ.cpp: 定义应用程序的类行为。
//

#include "pch.h"
#include "framework.h"
#include "ZGKJ.h"
#include "ZGKJDlg.h"
#include "Personnel.h"
#include "SupportStaff.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CZGKJApp

BEGIN_MESSAGE_MAP(CZGKJApp, CWinApp)
	ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()
// CZGKJApp 构造

CZGKJApp::CZGKJApp()
{
	// 支持重新启动管理器
	m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
	//sql = HtlMysql::GetInstance() ;
	// TODO: 在此处添加构造代码，
	// 将所有重要的初始化放置在 InitInstance 中
}


// 唯一的 CZGKJApp 对象

CZGKJApp theApp;


// CZGKJApp 初始化

BOOL CZGKJApp::InitInstance()
{
	
	CZGKJDlg startdlg;
	//m_pMainWnd = &startdlg;
	INT_PTR nResponse = startdlg.DoModal();
	//startdlg.ShowWindow(1);
	switch (Department_ID)
	{
		case 1: 
		{
			Personnel personnel;
			personnel.DoModal();
		}break;
		case 3:
		{
			SupportStaff supportstaff;
			supportstaff.DoModal();
		}
	}
	


#if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS)
	ControlBarCleanUp();
#endif

	// 由于对话框已关闭，所以将返回 FALSE 以便退出应用程序，
	//  而不是启动应用程序的消息泵。
	return FALSE;
}





char* CZGKJApp::MyTtoA(CString str)
{
	int length = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
	char* pTemp = new char[length];
	WideCharToMultiByte(CP_ACP, 0, str, -1, pTemp, length, NULL, NULL);
	return pTemp;
}



CString CZGKJApp::MyAtoT(const char* c_str)
{
	int len = MultiByteToWideChar(CP_ACP, 0,c_str, -1, NULL, 0);
	wchar_t* wideStr = new wchar_t[len];
	MultiByteToWideChar(CP_ACP, 0, c_str, -1, wideStr, len);
	CString Tstr(wideStr);
	delete[] wideStr;
	return CString(Tstr);
}

int CZGKJApp::MyTtoI(CString str)
{
	int num = _ttoi(str);
	return num;
}

CString CZGKJApp::MyItoT(int num)
{
	CString str;
	str.Format(_T("%d"), num);
	return CString(str);
}











