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

📄 expmandlg1.cpp

📁 软件外包人事综合管理系统,对员工的管理,部门管理,以及考勤管理和薪资管理.总得来说功能完全.
💻 CPP
字号:
// ExpManDlg1.cpp : implementation file
//

#include "stdafx.h"
#include "HrSys.h"
#include "ExpManDlg1.h"
#include "COMDEF.H"
#include "Columns.h"
#include "Column.h"
#include "ExpEditDlg1.h"
#include "_recordset.h"
#include "Experience.h"

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

/////////////////////////////////////////////////////////////////////////////
// CExpManDlg dialog


CExpManDlg::CExpManDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CExpManDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CExpManDlg)
	m_EmpName = _T("");
	//}}AFX_DATA_INIT
}


void CExpManDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CExpManDlg)
	DDX_Control(pDX, IDC_ADODC1, m_adodc);
	DDX_Control(pDX, IDC_DATAGRID1, m_datagrid);
	DDX_Text(pDX, IDC_EMPNAME_STATIC, m_EmpName);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CExpManDlg, CDialog)
	//{{AFX_MSG_MAP(CExpManDlg)
	ON_BN_CLICKED(IDC_ADD_BUTTON, OnAddButton)
	ON_BN_CLICKED(IDC_MODI_BUTTON, OnModiButton)
	ON_BN_CLICKED(IDC_DEL_BUTTON, OnDelButton)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CExpManDlg message handlers
void CExpManDlg::Refresh_Data()
{
	CString cEmpId;
	cEmpId.Format("%d", iEmpId);
	//设置记录源
	CString cSource;
	cSource = "SELECT Id, Start_Date AS 开始日期, End_Date AS 结束日期, School_Org AS 学校或单位名称,";
	cSource	+= " Title AS 职务 FROM Experience WHERE EmpId=" + cEmpId;
	m_adodc.SetRecordSource(cSource);
	m_adodc.Refresh();
	//设置表格列宽度
	_variant_t vIndex;
	vIndex = long(0);
	m_datagrid.GetColumns().GetItem(vIndex).SetWidth(0);
	vIndex = long(1);
	m_datagrid.GetColumns().GetItem(vIndex).SetWidth(100);
	vIndex = long(2);
	m_datagrid.GetColumns().GetItem(vIndex).SetWidth(100);
	vIndex = long(3);
	m_datagrid.GetColumns().GetItem(vIndex).SetWidth(150);
	vIndex = long(4);
	m_datagrid.GetColumns().GetItem(vIndex).SetWidth(100);
}

void CExpManDlg::OnAddButton() 
{
	// TODO: Add your control notification handler code here
	CExpEditDlg dlg;
	dlg.cId = "";
	dlg.iEmpId = iEmpId;
	if (dlg.DoModal() == IDOK)
		Refresh_Data();	
}

BOOL CExpManDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	Refresh_Data();
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CExpManDlg::OnModiButton() 
{
	// TODO: Add your control notification handler code here
	if (m_adodc.GetRecordset().GetEof()) 
	{
		MessageBox("请选择要修改的记录");
		return;
	}

	CExpEditDlg dlg;
	dlg.cId = m_datagrid.GetItem(0); //记录编号
	dlg.iEmpId = iEmpId;  //员工编号

	dlg.m_Sdate = m_datagrid.GetItem(1); //开始日期
	dlg.m_Edate = m_datagrid.GetItem(2); //结束日期
	dlg.m_Org = m_datagrid.GetItem(3); //单位/学校
	dlg.m_Title = m_datagrid.GetItem(4); //职务

	if (dlg.DoModal() == IDOK)
		Refresh_Data();	
}

void CExpManDlg::OnDelButton() 
{
	// TODO: Add your control notification handler code here
	if (m_adodc.GetRecordset().GetEof()) 
	{
		MessageBox("请选择要删除的记录");
		return;
	}
	if (MessageBox("是否删除当前记录","请确定", MB_YESNO) == IDYES)
	{
		CExperience exp;
		exp.sql_delete(m_datagrid.GetItem(0));
		Refresh_Data();
	}	
}

⌨️ 快捷键说明

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