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

📄 zhurui_jk02_人事管理view.cpp

📁 一套人事管理系统
💻 CPP
字号:
// ZHURUI_JK02_人事管理View.cpp : implementation of the CZHURUI_JK02_View class
//

#include "stdafx.h"
#include "ZHURUI_JK02_人事管理.h"
#include "MainFrm.h"
#include "ZHURUI_JK02_人事管理Set.h"
#include "ZHURUI_JK02_人事管理Doc.h"
#include "ZHURUI_JK02_人事管理View.h"

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

/////////////////////////////////////////////////////////////////////////////
// CZHURUI_JK02_View

IMPLEMENT_DYNCREATE(CZHURUI_JK02_View, CRecordView)

BEGIN_MESSAGE_MAP(CZHURUI_JK02_View, CRecordView)
	//{{AFX_MSG_MAP(CZHURUI_JK02_View)
	ON_WM_CTLCOLOR()
	ON_BN_CLICKED(IDC_btnEDIT, OnbtnEDIT)
	ON_WM_TIMER()
	ON_BN_CLICKED(IDC_HTTP, OnHttp)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CRecordView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CRecordView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRecordView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CZHURUI_JK02_View construction/destruction

CZHURUI_JK02_View::CZHURUI_JK02_View()
	: CRecordView(CZHURUI_JK02_View::IDD)
{
	//{{AFX_DATA_INIT(CZHURUI_JK02_View)
	m_pSet = NULL;
	//}}AFX_DATA_INIT
	// TODO: add construction code here

}

CZHURUI_JK02_View::~CZHURUI_JK02_View()
{
}

void CZHURUI_JK02_View::DoDataExchange(CDataExchange* pDX)
{
	CRecordView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CZHURUI_JK02_View)
	DDX_Control(pDX, IDC_HTTP, m_HTTP);
	DDX_Control(pDX, IDC_EDIT_ZHIZHAO, m_ZHIZHAO);
	DDX_Control(pDX, IDC_EDIT_TEL, m_TEL);
	DDX_Control(pDX, IDC_EDIT_NAME, m_NAME);
	DDX_Control(pDX, IDC_EDIT_INDEX, m_INDEX);
	DDX_Control(pDX, IDC_EDIT_FAREN, m_FAREN);
	DDX_Control(pDX, IDC_EDIT_FANWEI, m_FANWEI);
	DDX_Control(pDX, IDC_EDIT_EMAIL, m_EMAIL);
	DDX_Control(pDX, IDC_EDIT_DIZHI, m_DIZHI);
	DDX_Control(pDX, IDC_EDIT_POSTNO, m_POSTNO);
	DDX_FieldText(pDX, IDC_EDIT_DIZHI, m_pSet->m_DIZHI, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_FANWEI, m_pSet->m_FANWEI, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_FAREN, m_pSet->m_FAREN, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_NAME, m_pSet->m_NAME, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_TEL, m_pSet->m_TEL, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_POSTNO, m_pSet->m_POSTNO, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_ZHIZHAO, m_pSet->m_ZHIZHAO, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_INDEX, m_pSet->m_INDEX, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_EMAIL, m_pSet->m_EMAIl, m_pSet);
	//}}AFX_DATA_MAP
}

BOOL CZHURUI_JK02_View::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CRecordView::PreCreateWindow(cs);
}
int iflag=0;
void CZHURUI_JK02_View::OnInitialUpdate()
{
	if(iflag==0)
	{
		m_btnEDIT.AutoLoad(IDC_btnEDIT,this);
		m_btnEDIT.m_pbtn=(CSAMBTN *)this->GetDlgItem(IDC_btnEDIT);	
	//	SetTimer(1,1000,NULL);
	}
	m_pSet = &GetDocument()->m_zHURUI_JK02_Set;
	CRecordView::OnInitialUpdate();
	GetParentFrame()->RecalcLayout();
	ResizeParentToFit();

}

/////////////////////////////////////////////////////////////////////////////
// CZHURUI_JK02_View printing

BOOL CZHURUI_JK02_View::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CZHURUI_JK02_View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CZHURUI_JK02_View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CZHURUI_JK02_View diagnostics

#ifdef _DEBUG
void CZHURUI_JK02_View::AssertValid() const
{
	CRecordView::AssertValid();
}

void CZHURUI_JK02_View::Dump(CDumpContext& dc) const
{
	CRecordView::Dump(dc);
}

CZHURUI_JK02_Doc* CZHURUI_JK02_View::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CZHURUI_JK02_Doc)));
	return (CZHURUI_JK02_Doc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CZHURUI_JK02_View database support
CRecordset* CZHURUI_JK02_View::OnGetRecordset()
{
	return m_pSet;
}


/////////////////////////////////////////////////////////////////////////////
// CZHURUI_JK02_View message handlers

HBRUSH CZHURUI_JK02_View::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CRecordView::OnCtlColor(pDC, pWnd, nCtlColor);

	if(nCtlColor   ==   CTLCOLOR_DLG)   
	{   
        //返回对话框的颜色   
		hbr=(HBRUSH)::CreateSolidBrush(RGB(0,255,255));     
	}  

	if(nCtlColor==CTLCOLOR_STATIC)   
	{   
		//让静态文本框透明   
		pDC->SetBkMode(TRANSPARENT);   
		pDC->SetTextColor(RGB(0,255,255));   //设置字体颜色白色   
		HBRUSH hbr0=(HBRUSH)::GetStockObject(NULL_BRUSH);  
		return hbr0;
	}
	if(nCtlColor==CTLCOLOR_EDIT)   
	{   
		//让静态文本框不透明   
		pDC->SetBkMode(2);   
		pDC->SetBkColor(RGB(0,0,0));
		pDC->SetTextColor(RGB(0,255,255));   //设置字体颜色天蓝色   
		HBRUSH hbr0=(HBRUSH)::GetStockObject(NULL_BRUSH);  
		return hbr0 ;
	}   
		return hbr;
}

void CZHURUI_JK02_View::OnbtnEDIT() 
{
	// TODO: Add your control notification handler code here
	
	CDatabase db;
	CRecordset rs(&db);
	db.Open("sam人事管理");
	CString strUser,strSQL;
	rs.Open(CRecordset::forwardOnly,"select ID from 当前用户 where POS=1");
	rs.GetFieldValue("ID",strUser);
	if(strUser=="人事部    ")
	{
		CString strtmp;
		this->GetDlgItemText(IDC_btnEDIT,strtmp);
		if(strtmp=="修改")
		{
			m_btnEDIT.SetWindowText("确定");
			m_NAME.EnableWindow(TRUE);
			m_FAREN.EnableWindow(TRUE);
			m_TEL.EnableWindow(TRUE);
			m_DIZHI.EnableWindow(TRUE);
			m_FANWEI.EnableWindow(TRUE);
			m_ZHIZHAO.EnableWindow(TRUE);
			m_POSTNO.EnableWindow(TRUE);
			m_EMAIL.EnableWindow(TRUE);
			m_INDEX.EnableWindow(TRUE);
		}
		else
			if(strtmp=="确定")
			{
				m_btnEDIT.SetWindowText("修改");
				m_NAME.EnableWindow(FALSE);
				m_FAREN.EnableWindow(FALSE);
				m_TEL.EnableWindow(FALSE);
				m_DIZHI.EnableWindow(FALSE);
				m_FANWEI.EnableWindow(FALSE);
				m_ZHIZHAO.EnableWindow(FALSE);
				m_POSTNO.EnableWindow(FALSE);
				m_EMAIL.EnableWindow(FALSE);
				m_INDEX.EnableWindow(FALSE);
				m_pSet->Edit();
				UpdateData();
				m_pSet->Update();
				m_pSet->Requery();
				AfxMessageBox("修改成功!");
				Invalidate();
			}
	}
	else
	{
		AfxMessageBox("您没有相关权限!");
	}
	rs.Close();
	db.Close();
}



void CZHURUI_JK02_View::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
/*	CRect rc;
	this->GetWindowRect(&rc);
	ScreenToClient(&rc);
	m_HTTP.SetWindowPos(NULL,100+rand()%(rc.Width()-300),rc.bottom-48,0,0,SWP_NOSIZE);
*/	CRecordView::OnTimer(nIDEvent);
}

void CZHURUI_JK02_View::OnHttp() 
{
	// TODO: Add your control notification handler code here
	CString strtmp;
	strtmp=m_pSet->m_INDEX;
	strtmp.TrimRight();
	ShellExecute(NULL,"open",strtmp,NULL,NULL,SW_SHOWNORMAL);
	
}

⌨️ 快捷键说明

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