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

📄 mobilizeinfo.cpp

📁 一个有关人事系统的所有代码和有关文件包括里面小量数据库。
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// MobilizeInfo.cpp : implementation file
//

#include "stdafx.h"
#include "Rsglxt.h"
#include "MobilizeInfo.h"
#include "DBaseQuery.h"
#include "ExternDllHeader.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CString Hman;
/////////////////////////////////////////////////////////////////////////////
// CMobilizeInfo dialog


CMobilizeInfo::CMobilizeInfo(CWnd* pParent /*=NULL*/)
	: CDialog(CMobilizeInfo::IDD, pParent)
{
	//{{AFX_DATA_INIT(CMobilizeInfo)
	//}}AFX_DATA_INIT
}


void CMobilizeInfo::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMobilizeInfo)
	DDX_Control(pDX, IDC_LIST_GRID, m_Sql_Grid);
	DDX_Control(pDX, IDC_EDTSTAFFNAME, m_Edtstaffname);
	DDX_Control(pDX, IDC_EDTSTAFFID, m_EdtstaffID);
	DDX_Control(pDX, IDC_COMSTAFFDEP, m_Comstaffdep);
	DDX_Control(pDX, IDC_COOLDDEPT, m_Comfdept);
	DDX_Control(pDX, IDC_COMNEWDEPT, m_Comnewdept);
	DDX_Control(pDX, IDC_EDIT_SID, m_EdtSID);
	DDX_Control(pDX, IDC_DAT_REMOVE, m_DatRemovetime);
	DDX_Control(pDX, IDC_EDIT_SNAME, m_EdtSname);
	DDX_Control(pDX, IDC_EDIT_REMOVEID, m_EdtRemoveID);
	DDX_Control(pDX, IDC_EDIT_REMARK, m_EdtRemark);
	DDX_Control(pDX, IDC_EDIT_PASSNAME, m_EdtPassname);
	DDX_Control(pDX, IDC_EDIT_NEWDUTY, m_EdtNewDuty);
	DDX_Control(pDX, IDC_EDIT_FDUTY, m_EdtFduty);
	DDX_Control(pDX, IDC_EDIT_DONAME, m_Edtdoname);
	DDX_Control(pDX, IDC_COMBO_TYPE, m_ComType);
	DDX_Control(pDX, IDC_BUTUNDO, m_Butundo);
	DDX_Control(pDX, IDC_BUTTSAVE, m_Butsave);
	DDX_Control(pDX, IDC_BUTEXIT, m_Butexit);
	DDX_Control(pDX, IDC_BUTDELE, m_Butdelete);
	DDX_Control(pDX, IDC_BUTCHANGE, m_Butchange);
	DDX_Control(pDX, IDC_BUTADD, m_Butadd);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CMobilizeInfo, CDialog)
	//{{AFX_MSG_MAP(CMobilizeInfo)
	ON_BN_CLICKED(IDC_BUTADD, OnButadd)
	ON_BN_CLICKED(IDC_BUTCHANGE, OnButchange)
	ON_BN_CLICKED(IDC_BUTDELE, OnButdele)
	ON_BN_CLICKED(IDC_BUTTSAVE, OnButtsave)
	ON_BN_CLICKED(IDC_BUTUNDO, OnButundo)
	ON_BN_CLICKED(IDC_BUTEXIT, OnButexit)
	ON_WM_PAINT()
	ON_WM_CTLCOLOR()
	ON_BN_CLICKED(IDC_BTNSEL, OnBtnsel)
	ON_NOTIFY(NM_DBLCLK, IDC_LIST_GRID, OnDblclkListGrid)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMobilizeInfo message handlers

BOOL CMobilizeInfo::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CDBaseQuery* ParentWnd=(CDBaseQuery*)FindWindow(NULL,"员工调动基本信息");
	m_sID=ParentWnd->m_Grid.GetItemText(ParentWnd->m_Grid.GetRow(),0);
	RxRecordset rs,ts;
	rs.Open("部门视图");
    m_Comfdept.SetRecordset(rs,"部门名称");
	m_Comnewdept.SetRecordset(rs,"部门名称");
	m_Comstaffdep.SetRecordset(rs,"部门名称");
	ts.Open("select 部门名称 from 部门视图");
	m_Comfdept.SetFieldset(ts);
	m_Comnewdept.SetFieldset(ts);
	m_Comstaffdep.SetFieldset(ts);
	m_Comstaffdep.SelectString(0,"所有部门");

	this->m_Comfdept.m_CurrentFieldType="字符型";
	this->m_Comnewdept.m_CurrentFieldType="字符型";
	this->m_Comstaffdep.m_CurrentFieldType="字符型";

	m_Sql_Grid.ReadOnly(true);
	m_Sql_Grid.SetDataBase("员工查询视图",adCmdTable);
	this->DisPlayInfo(m_sID);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CMobilizeInfo::OnButadd() 
{
	// TODO: Add your control notification handler code here
	AddOrChange=1;
    this->ButtonEnabled(true);
	this->ClearEdit();
	CString NewID=ado.AutoNumber("MobilizeInfo","Mobilize_ID","MB",3);//MB是英文字母头两个单词
	m_EdtRemoveID.SetWindowText(NewID);
	m_EdtSID.SetFocus();
}

void CMobilizeInfo::OnButchange() 
{
	// TODO: Add your control notification handler code here
	AddOrChange=2;
    this->ButtonEnabled(true);
	m_EdtSID.SetFocus();
}

void CMobilizeInfo::OnButdele() 
{
	// TODO: Add your control notification handler code here
	if(MessageBox("确定要删除此条记录吗?","系统提示",MB_OKCANCEL|MB_ICONQUESTION)!=1)
		return;
	CString sSQL;
	sSQL.Format("DELETE FROM MobilizeInfo WHERE Mobilize_ID='%s'",m_sID);
	RxRecordset Drst;
	Drst.Open(sSQL,adCmdText);
	this->OnCancel();
}

void CMobilizeInfo::OnButtsave() 
{
	// TODO: Add your control notification handler code here
	if(MessageBox("确定要保存记录吗?","系统提示",MB_OKCANCEL|MB_ICONQUESTION)!=1)
		return;
   CString removeID,SID,Ctype,DoName,newDept,newDuty,oldDept,oldDuty,passName,remark,Sname,timeRemove;
    m_EdtRemoveID.GetWindowText(removeID);
	m_EdtSID.GetWindowText(SID);
	m_Edtdoname.GetWindowText(DoName);
	m_Comnewdept.GetWindowText(newDept);
	m_EdtNewDuty.GetWindowText(newDuty);
	m_Comfdept.GetWindowText(oldDept);
	m_EdtFduty.GetWindowText(oldDuty);
//	m_EdtPassname.GetWindowText(passName);
	passName=Hman;
	m_EdtRemark.GetWindowText(remark);
	m_EdtSname.GetWindowText(Sname);
	m_ComType.GetWindowText(Ctype);
	CTime time;
	m_DatRemovetime.GetTime(time);
	timeRemove=CTimeToCString(time);
	
	if(SID.IsEmpty())
	{
		MessageBox("员工编号不能为空,请输入员工编号。","系统提示",MB_OKCANCEL|MB_ICONQUESTION!=1);
		m_EdtSID.SetFocus();
		return;
	}
	if(Sname.IsEmpty())
	{
		MessageBox("员工姓名不能为空,请输入员工姓名。","系统提示",MB_OKCANCEL|MB_ICONQUESTION!=1);
		m_EdtSname.SetFocus();
		return;
	}
	if(Ctype.IsEmpty())
	{
		MessageBox("调动类型不能为空,请输入调动类型。","系统提示",MB_OKCANCEL|MB_ICONQUESTION!=1);
		m_ComType.SetFocus();
		return;
	}
	else if((Ctype!="部门调动")&&(Ctype!="职务调动")&&(Ctype!="综合调动"))//((Ctype.Compare("部门调动")!=0)&&(Ctype.Compare("职务调动")!=0)&&(Ctype.Compare("综合调动")!=0))
	{
		MessageBox("调动类型输入无效,请重新输入调动类型。","系统提示",MB_OKCANCEL|MB_ICONQUESTION!=1);
		m_ComType.SetFocus();
		return;
	}
	if(passName.IsEmpty())
	{
		MessageBox("批准人不能为空,请输入批准人姓名。","系统提示",MB_OKCANCEL|MB_ICONQUESTION!=1);
		m_EdtPassname.SetFocus();
		return;
	}
	if(newDept.IsEmpty())
	{
		MessageBox("新部门不能为空,请输入新部门。","系统提示",MB_OKCANCEL|MB_ICONQUESTION!=1);
		m_Comnewdept.SetFocus();
		return;
	}
	if(newDuty.IsEmpty())
	{
		MessageBox("新职务不能为空,请输入新职务。","系统提示",MB_OKCANCEL|MB_ICONQUESTION!=1);
		m_EdtNewDuty.SetFocus();
		return;
	}	
	if(oldDept.IsEmpty())
	{
		MessageBox("原部门不能为空,请输入原部门。","系统提示",MB_OKCANCEL|MB_ICONQUESTION!=1);
		m_EdtSID.SetFocus();
		return;
	}
	if(oldDuty.IsEmpty())
	{
		MessageBox("原职务不能为空,请输入原职务。","系统提示",MB_OKCANCEL|MB_ICONQUESTION!=1);
		m_EdtSID.SetFocus();
		return;
	}
	if(DoName.IsEmpty())
	{
		MessageBox("经手人不能为空,请输入经手人姓名。","系统提示",MB_OKCANCEL|MB_ICONQUESTION!=1);
		m_Edtdoname.SetFocus();
		return;
	}

	if(remark.GetLength()>50)
	{
		MessageBox("输入备注的不能过长,请重新输入。","系统提示",MB_OKCANCEL|MB_ICONQUESTION!=1);
		m_EdtRemark.SetFocus();
		return;
	}
	RxRecordset namest,IDst,manst,depst;
	CString namesql,IDsql,text1,text2,mansql,duty1,dep1,dep2;
	namesql.Format("SELECT * FROM StaffInfo WHERE Staff_name='%s'",Sname);
	IDsql.Format("SELECT * FROM StaffInfo WHERE Staff_ID='%s'",SID);
	mansql.Format("SELECT * FROM StaffInfo WHERE Staff_name='%s' and Duty!='职员'",passName);
	dep2.Format("SELECT * FROM DepInfo WHERE Dep_name='%s'",newDept);
	namest.Open(namesql,adCmdText);
	IDst.Open(IDsql,adCmdText);
	manst.Open(mansql,adCmdText);
	depst.Open(dep2,adCmdText);

	if(IDst.GetRecordCount()<1)
	{
		MessageBox("您输入的用户编号不存在!请重新输入!","系统提示",MB_OK|MB_ICONSTOP);
		m_EdtSID.SetWindowText("");
		m_EdtSID.SetFocus();
		return;
	}
	if(namest.GetRecordCount()<1)
	{
		MessageBox("您输入的用户名不存在!请重新输入!","系统提示",MB_OK|MB_ICONSTOP);
		m_EdtSname.SetWindowText("");
		m_EdtSname.SetFocus();
		return;
	}

	text1=namest.GetFieldValue("Staff_ID");
	if(text1!=SID)
	{
		MessageBox("您输入的用户名与用户编号不匹配!请重新输入!","系统提示",MB_OK|MB_ICONSTOP);
		m_EdtSID.SetWindowText("");
		m_EdtSID.SetFocus();
		return;
	}

	duty1=namest.GetFieldValue("Duty");
	if(duty1!=oldDuty)
	{
		MessageBox("您输入的原职务与用户的原职务不相同!请重新输入!","系统提示",MB_OK|MB_ICONSTOP);
	    m_EdtFduty.SetWindowText("");
	    m_EdtFduty.SetFocus();
		return;

⌨️ 快捷键说明

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