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

📄 querydlg.cpp

📁 C++课程设计 C++开放的高校职工管理软件 附带源代码及报告
💻 CPP
字号:
// QueryDlg.cpp : implementation file
//

#include "stdafx.h"
#include "teachermis.h"
#include "QueryDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CQueryDlg dialog


CQueryDlg::CQueryDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CQueryDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CQueryDlg)
	m_editID = _T("");
	m_editName = _T("");
	m_comboJobtitle = _T("");
	m_comboeducation = _T("");
	m_editAge = _T("");
	//}}AFX_DATA_INIT
}


void CQueryDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CQueryDlg)
	DDX_Control(pDX, IDC_COMBO_SEX, m_comboSex);
	DDX_Control(pDX, IDC_COMBO_EDUCATION, m_comboEducation);
	DDX_Control(pDX, IDC_COMBO_JOBTITLE, m_comboJobTitle);
	DDX_Control(pDX, IDC_COMBO_ORIENTATION, m_comboOrientation);
	DDX_Control(pDX, IDC_COMBO_KIND, m_comboKind);
	DDX_Control(pDX, IDC_COMBO_POST, m_comboPost);
	DDX_Text(pDX, IDC_EDIT_ID, m_editID);
	DDX_Text(pDX, IDC_EDIT_NAME, m_editName);
	DDX_CBString(pDX, IDC_COMBO_JOBTITLE, m_comboJobtitle);
	DDX_CBString(pDX, IDC_COMBO_EDUCATION, m_comboeducation);
	DDX_Text(pDX, IDC_EDIT_AGE, m_editAge);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CQueryDlg, CDialog)
	//{{AFX_MSG_MAP(CQueryDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CQueryDlg message handlers

void CQueryDlg::OnOK() 
{	
	UpdateData(true);

	CString kind,sex,post,jobTitle,orientation,education;

	m_comboSex.GetWindowText(sex);
	m_comboKind.GetWindowText(kind);
	m_comboPost.GetWindowText(post);
	m_comboJobTitle.GetWindowText(jobTitle);
	m_comboOrientation.GetWindowText(orientation);
	m_comboEducation.GetWindowText(education);

	strQuery="";
	if(m_editID!="")
		strQuery+=" and id="+m_editID;
	if(m_editName!="")
	{
		strQuery+=" and name='"+m_editName;
		strQuery+="'";
	}
	if(m_editAge!="")
		strQuery+=" and age="+m_editAge;
	if(sex!="")
	{
		strQuery+=" and sex='"+sex;
		strQuery+="'";
	}
	if(kind!="")
	{
		strQuery+=" and kind='"+kind;
		strQuery+="'";
	}
	if(post!="")
	{
		strQuery+=" and post='"+post;
		strQuery+="'";
	}
	if(jobTitle!="")
	{
		strQuery+=" and job_title='"+jobTitle;
		strQuery+="'";
	}
	if(orientation!="")
	{
		strQuery+=" and orientation='"+orientation;
		strQuery+="'";
	}
	if(education!="")
	{
		strQuery+=" and education='"+education;
		strQuery+="'";
	}

	CDialog::OnOK();
}

BOOL CQueryDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	m_comboSex.AddString("");
	m_comboSex.AddString("男");
	m_comboSex.AddString("女");
	m_comboSex.SetCurSel(0);

	m_comboKind.AddString("");
	m_comboKind.AddString("行政人员");
	m_comboKind.AddString("教师");
	m_comboKind.AddString("一般员工");
	m_comboKind.AddString("退休人员");
	m_comboKind.AddString("返聘人员");
	m_comboKind.AddString("临时工");
	m_comboKind.SetCurSel(0);

	m_comboPost.AddString("");
	m_comboPost.AddString("无");
	m_comboPost.AddString("科级");
	m_comboPost.AddString("处级");
	m_comboPost.AddString("地级");
	m_comboPost.SetCurSel(0);

	m_comboJobTitle.AddString("");
	m_comboJobTitle.AddString("无");
	m_comboJobTitle.AddString("初级");
	m_comboJobTitle.AddString("中级");
	m_comboJobTitle.AddString("高级");
	m_comboJobTitle.SetCurSel(0);

	m_comboOrientation.AddString("");
	m_comboOrientation.AddString("群众");
	m_comboOrientation.AddString("中共党员");
	m_comboOrientation.AddString("民主党派");
	m_comboOrientation.SetCurSel(0);

	m_comboEducation.AddString("");
	m_comboEducation.AddString("中专");
	m_comboEducation.AddString("大专");
	m_comboEducation.AddString("大学");
	m_comboEducation.AddString("硕士");
	m_comboEducation.AddString("博士");
	m_comboEducation.SetCurSel(0);

	return TRUE;
}

void CQueryDlg::setStrQuery(CString query)
{
	strQuery=query;
}

CString CQueryDlg::getStrQuery()
{
	return strQuery;
}

⌨️ 快捷键说明

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