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

📄 find.cpp

📁 it s a Menagement System of salary,the codes contain the instruction for the design,and it is rutini
💻 CPP
字号:
// Find.cpp : implementation file
//

#include "stdafx.h"
#include "Laborage.h"
#include "Find.h"

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

/////////////////////////////////////////////////////////////////////////////
// CFind dialog


CFind::CFind(CWnd* pParent /*=NULL*/)
	: CDialog(CFind::IDD, pParent)
{
	//{{AFX_DATA_INIT(CFind)
	m_number = -1;
	m_age = -1;
	m_treat = -1;
	m_sex = 2;
	m_name = _T("");
	m_fcage = -1;
	m_fcnumber = -1;
	m_fctreat = -1;
	//}}AFX_DATA_INIT
	m_parent=NULL;
}


void CFind::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CFind)
	DDX_Text(pDX, IDC_FNUMBER, m_number);
	DDV_MinMaxLong(pDX, m_number, -1, 1000000);
	DDX_Text(pDX, IDC_FAGE, m_age);
	DDV_MinMaxInt(pDX, m_age, -1, 999);
	DDX_Text(pDX, IDC_FTREAT, m_treat);
	DDX_CBIndex(pDX, IDC_FSEX, m_sex);
	DDX_Text(pDX, IDC_FNAME, m_name);
	DDV_MaxChars(pDX, m_name, 64);
	DDX_CBIndex(pDX, IDC_FCAGE, m_fcage);
	DDX_CBIndex(pDX, IDC_FCNUMBER, m_fcnumber);
	DDX_CBIndex(pDX, IDC_FCTREAT, m_fctreat);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CFind, CDialog)
	//{{AFX_MSG_MAP(CFind)
	ON_BN_CLICKED(IDCACTION, OnCaction)
	ON_BN_CLICKED(IDCRESET, OnCreset)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFind message handlers

void CFind::OnCreset() 
{
	// TODO: Add your control notification handler code here
	m_number = -1;
	m_age = -1;
	m_treat = -1;
	m_sex = 2;
	m_name = _T("");
	m_fcage = -1;
	m_fcnumber = -1;
	m_fctreat = -1;
	UpdateData(FALSE);
}


void CFind::OnCaction() 
{
	// TODO: Add your control notification handler code here
	UpdateData();
  
	m_title.Empty();

	if(m_age!=-1 && m_fcage==-1)
	{
		MessageBox("年龄条件未填!");
		return;
	}
    if(m_number!=-1 && m_fcnumber==-1)
	{
		MessageBox("编号条件未填!");
		return;
	}
    if(m_treat!=-1 && m_fctreat==-1)
	{
		MessageBox("待遇条件未填!");
		return;
	}

	BOOL head=FALSE;
	if(m_name!="") 
	{
		m_title.Format("[%s] like '%s'","姓名",m_name);
		head=TRUE;
	}
     
	if(m_number!=-1)
	{
		if(head) m_title.Insert(m_title.GetLength()," AND ");
        else head=TRUE;
        CString str;
        if(m_fcnumber==0)
		str.Format("[%s]>=%d","职员编号",m_number);
		else
        if(m_fcnumber==1)
		str.Format("[%s]<=%d","职员编号",m_number);
     	else
		str.Format("[%s]=%d","职员编号",m_number);
		
		m_title.Insert(m_title.GetLength(),str);
	}
    if(m_age!=-1)
	{
		if(head) m_title.Insert(m_title.GetLength()," AND ");
        else head=TRUE;
        CString str;
        if(m_fcage==0)
			str.Format("[%s]>=%d","年龄",CTime::GetCurrentTime().GetYear()-m_age);
		else
        if(m_fcage==1)
		str.Format("[%s]<=%d","年龄",CTime::GetCurrentTime().GetYear()-m_age);
     	else
		str.Format("[%s]=%d","年龄",CTime::GetCurrentTime().GetYear()-m_age);
		
		m_title.Insert(m_title.GetLength(),str);
	}
    if(m_treat!=-1)
	{
		if(head) m_title.Insert(m_title.GetLength()," AND ");
        else head=TRUE;
        CString str;
        if(m_fctreat==0)
		str.Format("[%s]>=%d","待遇",m_treat);
		else
        if(m_fctreat==1)
		str.Format("[%s]<=%d","待遇",m_treat);
     	else
		str.Format("[%s]=%d","待遇",m_treat);
		
		m_title.Insert(m_title.GetLength(),str);
	}
	if(m_sex!=2)
	{
       	if(head) m_title.Insert(m_title.GetLength()," AND ");
        else head=TRUE;
        CString str;
		str.Format("[%s]=%d","性别",m_sex);
		
		m_title.Insert(m_title.GetLength(),str);
	}
    
	m_parent->SendMessage(WM_BEGINFIND);
}

⌨️ 快捷键说明

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