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

📄 cxndiaodong.cpp

📁 用数据库ACCESS和VISUAL C++编程
💻 CPP
字号:
// Cxndiaodong.cpp : implementation file
//

#include "stdafx.h"
#include "new3.h"
#include "Cxndiaodong.h"
#include "Cgongziset.h"
#include "Czgtable.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCxndiaodong dialog


CCxndiaodong::CCxndiaodong(CWnd* pParent /*=NULL*/)
	: CDialog(CCxndiaodong::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCxndiaodong)
	m_xnddid = _T("");
	m_xndto = _T("");
	m_xnwhen = 0;
	m_xnwhenm = 0;
	m_xnwheny = 0;
	m_xndtoname = _T("");
	m_xngonglinggz = 0.0f;
	m_xnjibengz = 0.0f;
	//}}AFX_DATA_INIT
}


void CCxndiaodong::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCxndiaodong)
	DDX_Control(pDX, IDCANCEL, m_cancel1);
	DDX_Control(pDX, IDC_QUEDING1, m_queding1);
	DDX_Text(pDX, IDC_XNDDID, m_xnddid);
	DDX_Text(pDX, IDC_XNDTO, m_xndto);
	DDX_Text(pDX, IDC_XNWHENM, m_xnwhenm);
	DDX_Text(pDX, IDC_XNWHENY, m_xnwheny);
	DDX_Text(pDX, IDC_XNDTONAME, m_xndtoname);
	DDX_Text(pDX, IDC_XNGONGLINGGZ, m_xngonglinggz);
	DDX_Text(pDX, IDC_XNJIBENGZ, m_xnjibengz);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCxndiaodong, CDialog)
	//{{AFX_MSG_MAP(CCxndiaodong)
	ON_BN_CLICKED(IDC_QUEDING1, OnQueding1)
	ON_EN_CHANGE(IDC_XNDDID, OnChangeXnddid)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCxndiaodong message handlers

void CCxndiaodong::OnQueding1() 
{
	// TODO: Add your control notification handler code here
	int q=0;
	CCgongziset gz;
	CCzgtable tb;
	UpdateData(true);
	if(m_xnddid.IsEmpty() )
	{
		MessageBox("请正确填写!");
		return;
	}
	if((m_xnjibengz<0)||(m_xngonglinggz<0))
	{
		MessageBox("不可以有负数");
		return;
	}
	if((m_xnwhenm>12)||(m_xnwhenm<1))
	{
		MessageBox("月份输入有错!");
		return;
	}
	gz.Open();
	gz.MoveFirst(); 
	tb.Open();
	tb.MoveFirst();
	while(!tb.IsEOF())
	{
		if(tb.m_zhigongID==m_xnddid)
		{
			tb.Edit();
			tb.m_bumenID=m_xndto;
			tb.m_bumenname=m_xndtoname;
			tb.m_gonglinggongzi=m_xngonglinggz;
			tb.m_jibengongzi=m_xnjibengz;
			tb.Update(); 
			q=q+1;
		}
		tb.MoveNext(); 
	}
	if(q==0)
	{
		MessageBox("不存在该职工!");
		return;
	}
	while(!gz.IsEOF())
	{
		if(gz.m_zhigongID==m_xnddid)
			if(gz.m_flag==0)
			{
                 gz.Edit();
				 gz.m_bumenID=m_xndto;
				 gz.m_bumenname=m_xndtoname;
				 gz.m_gonglinggongzi=m_xngonglinggz;
				 gz.m_jibengongzi=m_xnjibengz;
				 gz.m_fatimey=m_xnwheny; 
				 gz.m_fatimem=m_xnwhenm;
				 gz.Update(); 
			}
			gz.MoveNext(); 
	}
	MessageBox("资料已经成功更改!!");
	return;

}

BOOL CCxndiaodong::OnInitDialog() 
{
	CDialog::OnInitDialog();
	xndd_bitmap1.LoadBitmap(IDB_BITMAP1);
	m_queding1.SetBitmap((HBITMAP)xndd_bitmap1.m_hObject);

	xndd_bitmap2.LoadBitmap(IDB_BITMAP10);
	m_cancel1.SetBitmap((HBITMAP)xndd_bitmap2.m_hObject); 
	// TODO: Add extra initialization here
	//GetDlgItem(IDC_QUEDING1)->EnableWindow(false);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CCxndiaodong::OnChangeXnddid() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	GetDlgItem(IDC_QUEDING1)->EnableWindow(true);
	// TODO: Add your control notification handler code here
	
}

BOOL CCxndiaodong::DestroyWindow() 
{
	// TODO: Add your specialized code here and/or call the base class
	xndd_bitmap1.DeleteObject();
	xndd_bitmap2.DeleteObject(); 
	return CDialog::DestroyWindow();
}

⌨️ 快捷键说明

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