📄 personelmanageview.cpp
字号:
// PersonelManageView.cpp : implementation of the CPersonelManageView class
//
#include "stdafx.h"
#include "PersonelManage.h"
#include "PersonelManageDoc.h"
#include "PersonelManageView.h"
#include "EmployeeList.h"
#include "LogonDlg.h"
#include "PageVocationSet.h"
#include "PageAddEmployee.h"
#include "PageDeptManage.h"
#include "PageSysEvent.h"
#include "PageSalaryManage.h"
#include "PageVocationManage.h"
#include "PageOTManage.h"
#include "PageAtnManage.h"
#include "PageDeptInfo.h"
#include "ModifyPwdDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CPersonelManageApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CPersonelManageView
IMPLEMENT_DYNCREATE(CPersonelManageView, CView)
BEGIN_MESSAGE_MAP(CPersonelManageView, CView)
//{{AFX_MSG_MAP(CPersonelManageView)
ON_COMMAND(ID_SYS_LOGOUT, OnSysLogout)
ON_COMMAND(ID_SYS_LOGON, OnSysLogon)
ON_UPDATE_COMMAND_UI(ID_SYS_LOGON, OnUpdateSysLogon)
ON_UPDATE_COMMAND_UI(ID_SYS_LOGOUT, OnUpdateSysLogout)
ON_COMMAND(ID_SYS_MODPWD, OnSysModpwd)
ON_UPDATE_COMMAND_UI(ID_SYS_MODPWD, OnUpdateSysModpwd)
ON_COMMAND(ID_EMP_LIST, OnEmpList)
ON_COMMAND(ID_ATN_MAN, OnAtnMan)
ON_COMMAND(ID_DEPT_LIST, OnDeptList)
ON_COMMAND(ID_DEPT_MAN, OnDeptMan)
ON_COMMAND(ID_OT_MAN, OnOtMan)
ON_COMMAND(ID_SALARY_MAN, OnSalaryMan)
ON_COMMAND(ID_HOLIDAY_MAN, OnHolidayMan)
ON_COMMAND(ID_HOLIDAY_SET, OnHolidaySet)
ON_COMMAND(ID_EMP_ADD, OnEmpAdd)
ON_COMMAND(ID_SYS_EVENT, OnSysEvent)
ON_UPDATE_COMMAND_UI(ID_SYS_EVENT, OnUpdateSysEvent)
ON_UPDATE_COMMAND_UI(ID_DEPT_LIST, OnUpdateDeptList)
ON_UPDATE_COMMAND_UI(ID_DEPT_MAN, OnUpdateDeptMan)
ON_UPDATE_COMMAND_UI(ID_EMP_ADD, OnUpdateEmpAdd)
ON_UPDATE_COMMAND_UI(ID_EMP_LIST, OnUpdateEmpList)
ON_UPDATE_COMMAND_UI(ID_OT_MAN, OnUpdateOtMan)
ON_UPDATE_COMMAND_UI(ID_SALARY_MAN, OnUpdateSalaryMan)
ON_UPDATE_COMMAND_UI(ID_HOLIDAY_MAN, OnUpdateHolidayMan)
ON_UPDATE_COMMAND_UI(ID_HOLIDAY_SET, OnUpdateHolidaySet)
ON_UPDATE_COMMAND_UI(ID_ATN_MAN, OnUpdateAtnMan)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPersonelManageView construction/destruction
CPersonelManageView::CPersonelManageView()
{
// TODO: add construction code here
}
CPersonelManageView::~CPersonelManageView()
{
int nCount = m_pSheet->GetPageCount();
for(int nCurrent = 0; nCurrent < nCount; nCurrent++)
{
CPropertyPage *pPage = m_pSheet->GetPage(0);
m_pSheet->RemovePage(0);
delete pPage;
}
if(::IsWindow(m_pSheet->GetSafeHwnd()))
::DestroyWindow(m_pSheet->GetSafeHwnd());
delete m_pSheet;
}
BOOL CPersonelManageView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CPersonelManageView drawing
void CPersonelManageView::OnDraw(CDC* pDC)
{
CPersonelManageDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
RECT rect;
GetClientRect(&rect);
//m_pSheet->SendMessage(WM_SIZE, rect.right, rect.bottom);
m_pSheet->MoveWindow(&rect);
//m_pSheet->SendMessage(WM_SIZE, rect.right, rect.bottom);
m_pSheet->Invalidate( TRUE );
//m_pSheet->ShowWindow(SW_SHOW);
//m_pSheet->UpdateWindow();
}
/////////////////////////////////////////////////////////////////////////////
// CPersonelManageView printing
BOOL CPersonelManageView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CPersonelManageView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CPersonelManageView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CPersonelManageView diagnostics
#ifdef _DEBUG
void CPersonelManageView::AssertValid() const
{
CView::AssertValid();
}
void CPersonelManageView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CPersonelManageDoc* CPersonelManageView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CPersonelManageDoc)));
return (CPersonelManageDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CPersonelManageView message handlers
void CPersonelManageView::OnInitialUpdate()
{
CView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
m_pSheet = new TreePropSheet::CTreePropSheetEx("人事管理系统", this);
m_pSheet->SetTreeViewMode( TRUE, TRUE, TRUE);
m_pSheet->SetEmptyPageText( "请选择一个子项" );
m_pSheet->AddPage( new CPageAtnManage() );
m_pSheet->AddPage( new CPageOTManage() );
m_pSheet->AddPage(new CPageVocationSet());
m_pSheet->AddPage( new CPageVocationManage() );
m_pSheet->AddPage( new CEmployeeList() );
m_pSheet->AddPage( new CPageAddEmployee() );
m_pSheet->AddPage( new CPageDeptManage() );
m_pSheet->AddPage( new CPageDeptInfo() );
m_pSheet->AddPage( new CPageSysEvent() );
m_pSheet->AddPage( new CPageSalaryManage() );
m_pSheet->SetIsResizable( true );
m_pSheet->SetTreeWidth( 200 );
m_pSheet->SetMinSize( CSize( 460, 350 ) );
//m_pSheet->Create( this, WS_CHILD, 0 );
//m_pSheet->ShowWindow(SW_HIDE);
m_pSheet->Create( this, WS_CHILD | WS_VISIBLE, 0 );
}
void CPersonelManageView::OnSysLogout()
{
// TODO: Add your command handler code here
AfxGetMainWnd()->SetWindowText("未登录--人事管理系统");
m_pSheet->ShowWindow(SW_HIDE);
theApp.CurrentUser.isLogin = false;
OnSysLogon();
}
void CPersonelManageView::OnSysLogon()
{
// TODO: Add your command handler code here
CLogonDlg login;
if(login.DoModal() == IDOK)
{
AfxGetMainWnd()->SetWindowText(theApp.CurrentUser.name + " 已登录--人事管理系统");
m_pSheet->ShowWindow(SW_SHOW);
}
}
void CPersonelManageView::OnUpdateSysLogon(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(theApp.CurrentUser.isLogin);
pCmdUI->Enable(!theApp.CurrentUser.isLogin);
}
void CPersonelManageView::OnUpdateSysLogout(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(!theApp.CurrentUser.isLogin);
pCmdUI->Enable(theApp.CurrentUser.isLogin);
}
void CPersonelManageView::OnSysModpwd()
{
// TODO: Add your command handler code here
CModifyPwdDlg modPwd;
modPwd.m_nDBEmpID = theApp.CurrentUser.id;
modPwd.m_strDBPwd = theApp.CurrentUser.pwd;
modPwd.DoModal();
}
void CPersonelManageView::OnUpdateSysModpwd(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(theApp.CurrentUser.isLogin);
}
void CPersonelManageView::OnEmpList()
{
// TODO: Add your command handler code here
m_pSheet->SetActivePage(4);
}
void CPersonelManageView::OnAtnMan()
{
// TODO: Add your command handler code here
m_pSheet->SetActivePage(0);
}
void CPersonelManageView::OnDeptList()
{
// TODO: Add your command handler code here
m_pSheet->SetActivePage(7);
}
void CPersonelManageView::OnDeptMan()
{
// TODO: Add your command handler code here
m_pSheet->SetActivePage(6);
}
void CPersonelManageView::OnOtMan()
{
// TODO: Add your command handler code here
m_pSheet->SetActivePage(1);
}
void CPersonelManageView::OnSalaryMan()
{
// TODO: Add your command handler code here
m_pSheet->SetActivePage(9);
}
void CPersonelManageView::OnHolidayMan()
{
// TODO: Add your command handler code here
m_pSheet->SetActivePage(3);
}
void CPersonelManageView::OnHolidaySet()
{
// TODO: Add your command handler code here
m_pSheet->SetActivePage(2);
}
void CPersonelManageView::OnEmpAdd()
{
// TODO: Add your command handler code here
m_pSheet->SetActivePage(5);
}
void CPersonelManageView::OnSysEvent()
{
// TODO: Add your command handler code here
m_pSheet->SetActivePage(8);
}
void CPersonelManageView::OnUpdateSysEvent(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(theApp.CurrentUser.isLogin);
}
void CPersonelManageView::OnUpdateDeptList(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(theApp.CurrentUser.isLogin);
}
void CPersonelManageView::OnUpdateDeptMan(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(theApp.CurrentUser.isLogin);
}
void CPersonelManageView::OnUpdateEmpAdd(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(theApp.CurrentUser.isLogin);
}
void CPersonelManageView::OnUpdateEmpList(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(theApp.CurrentUser.isLogin);
}
void CPersonelManageView::OnUpdateOtMan(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(theApp.CurrentUser.isLogin);
}
void CPersonelManageView::OnUpdateSalaryMan(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(theApp.CurrentUser.isLogin);
}
void CPersonelManageView::OnUpdateHolidayMan(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(theApp.CurrentUser.isLogin);
}
void CPersonelManageView::OnUpdateHolidaySet(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(theApp.CurrentUser.isLogin);
}
void CPersonelManageView::OnUpdateAtnMan(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(theApp.CurrentUser.isLogin);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -