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

📄 gongzi.cpp

📁 这是采用mfc编写的工资管理系统
💻 CPP
字号:
// Gongzi.cpp : implementation file
//

#include "stdafx.h"
#include "salarymanagement.h"
#include "Gongzi.h"


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

/////////////////////////////////////////////////////////////////////////////
// Gongzi dialog


Gongzi::Gongzi(BOOL bEnable,CWnd* pParent /*=NULL*/)
	: CDialog(Gongzi::IDD, pParent)
{
	EnableAutomation();

	//{{AFX_DATA_INIT(Gongzi)
	m_ID = _T("");
	m_position = _T("");
	m_year = _T("");
	m_buTie = _T("");
	m_faKuan = _T("");
	m_fuLi = _T("");
	m_kaoQin = _T("");
	m_name = _T("");
	m_reward = _T("");
	m_shiFa = _T("");
	m_tax = _T("");
	m_timeWage = _T("");
	m_yingFa = _T("");
	m_pieceWage = _T("");
	m_kaoQin = _T("");
	m_faKuan = _T("");
	m_tax = _T("");
	m_shiFa = _T("");
	m_timeWage = _T("");
	m_pieceWage = _T("");
	m_buTie = _T("");
	//}}AFX_DATA_INIT
	m_monthString="1";
	m_departString="";
	this->bEnable=bEnable;
}


void Gongzi::OnFinalRelease()
{
	// When the last reference for an automation object is released
	// OnFinalRelease is called.  The base class will automatically
	// deletes the object.  Add additional cleanup required for your
	// object before calling the base class.

	CDialog::OnFinalRelease();
}

void Gongzi::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(Gongzi)
	DDX_Control(pDX, IDC_CBODEPARTMENT, m_depart);
	DDX_Control(pDX, IDC_CBOMONTH, m_month);
	DDX_Text(pDX, IDC_ID, m_ID);
	DDX_Text(pDX, IDC_POSITION, m_position);
	DDX_Text(pDX, IDC_YEAR, m_year);
	DDX_Text(pDX, IDC_BUTIE, m_buTie);
	DDX_Text(pDX, IDC_FAKUAN, m_faKuan);
	DDX_Text(pDX, IDC_FULI, m_fuLi);
	DDX_Text(pDX, IDC_KAOQIN, m_kaoQin);
	DDX_Text(pDX, IDC_NAME, m_name);
	DDX_Text(pDX, IDC_REWARD, m_reward);
	DDX_Text(pDX, IDC_SHIFA, m_shiFa);
	DDX_Text(pDX, IDC_TAX, m_tax);
	DDX_Text(pDX, IDC_TIMEWAGE, m_timeWage);
	DDX_Text(pDX, IDC_YINGFA, m_yingFa);
	DDX_Text(pDX, IDC_PIECEWAGE, m_pieceWage);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(Gongzi, CDialog)
	//{{AFX_MSG_MAP(Gongzi)
	ON_BN_CLICKED(IDOK, OnOk)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BEGIN_DISPATCH_MAP(Gongzi, CDialog)
	//{{AFX_DISPATCH_MAP(Gongzi)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()

// Note: we add support for IID_IGongzi to support typesafe binding
//  from VBA.  This IID must match the GUID that is attached to the 
//  dispinterface in the .ODL file.

// {68A46313-8E9B-416C-A6B2-985D8D0FF40B}
static const IID IID_IGongzi =
{ 0x68a46313, 0x8e9b, 0x416c, { 0xa6, 0xb2, 0x98, 0x5d, 0x8d, 0xf, 0xf4, 0xb } };

BEGIN_INTERFACE_MAP(Gongzi, CDialog)
	INTERFACE_PART(Gongzi, IID_IGongzi, Dispatch)
END_INTERFACE_MAP()

/////////////////////////////////////////////////////////////////////////////
void Gongzi::OnOk() 
{
	UpdateData();

	int index=m_month.GetCurSel();
	if(index!=-1)
		m_month.GetLBText(index,m_monthString);
	index=m_depart.GetCurSel();
	if(index!=-1)
		m_depart.GetLBText(index,m_departString);

	m_ado.ExitConnect();

	CDialog::OnOK();
}

BOOL Gongzi::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_ado.OnInitADOConn();

	//在月份的组合框中加入12个数字
	CString str;
	int i=1;
	while(i<=12)
	{
		str.Format("%d",i++);
		m_month.AddString(str);
	}
	//使两位数和一位数对应的字符串相同,如9和09
	str.Format("%d",atoi(m_monthString));
	int index=m_month.FindString(0,str);
	if(CB_ERR==index)
		m_month.SetCurSel(0);
	else m_month.SetCurSel(index);

	//在数据库中查找所有哦的部门名称并加入到部门组合框中
	_RecordsetPtr recordset=m_ado.GetRecordSet("Select 部门名称  From DepartmentSet");
	while(!recordset->adoEOF)
	{
		_variant_t depart=recordset->GetCollect("部门名称");
		if(depart.vt!=VT_NULL)
			m_depart.AddString(_bstr_t(depart));
		recordset->MoveNext();
	}
	index=m_depart.FindString(0,m_departString);
	if(CB_ERR==index)
		m_depart.SetCurSel(0);
	else m_depart.SetCurSel(index);

	//让所有控件处于禁用状态
	CWnd* pWnd=GetDlgItem(IDC_YEAR);
	
	while(pWnd!=GetDlgItem(IDOK))
	{
		pWnd->EnableWindow(bEnable);
		pWnd=GetNextDlgTabItem(pWnd,FALSE);
	}
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

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