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

📄 mobilizeinfo.cpp

📁 一个有关人事系统的所有代码和有关文件包括里面小量数据库。
💻 CPP
📖 第 1 页 / 共 2 页
字号:
	}
	dep1=namest.GetFieldValue("Dep");
	if(dep1!=oldDept)
	{
		MessageBox("您输入的原部门与用户的原部门不相同!请重新输入!","系统提示",MB_OK|MB_ICONSTOP);
	    m_Comfdept.SetFocus();
		return;
	}
	if(depst.GetRecordCount()<1)
	{
		MessageBox("您输入的新部门不存在!请重新输入!","系统提示",MB_OK|MB_ICONSTOP);
	    m_Comnewdept.SetFocus();
		return;
	}

	if(manst.GetRecordCount()<1)
	{
	    MessageBox("您输入的批准人不存在或者不是部门主管以上职务!请重新输入!","系统提示",MB_OK|MB_ICONSTOP);
	    m_EdtPassname.SetWindowText("");
	    m_EdtPassname.SetFocus();
		return;
	}

	CString sSQL,tSQL;
	if(AddOrChange==1)//添加操作
	{
		sSQL.Format("Insert Into MobilizeInfo Values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')",removeID,SID,Ctype,oldDept,oldDuty,newDept,newDuty,timeRemove,DoName,passName,remark);
		tSQL.Format("Update StaffInfo set Dep='%s',Duty='%s' where Staff_ID='%s'",newDept,newDuty,SID);
	}
	else
	{
		sSQL.Format("Update MobilizeInfo set Staff_ID='%s',Mobilize_type='%s',\
			Former_dep='%s',Former_duty='%s',Mobilize_dep='%s',Mobilize_duty='%s',\
			Mobilize_time='%s',Approval_man='%s',Handle_man='%s',\
			Remarks='%s' WHERE Mobilize_ID='%s'",SID,Ctype,oldDept,oldDuty,newDept,\
			newDuty,timeRemove,DoName,passName,remark,removeID);
		tSQL.Format("Update StaffInfo set Dep='%s',Duty='%s' where Staff_ID='%s'",newDept,newDuty,SID);
	}
	RxRecordset arst,brst;
	arst.Open(sSQL,adCmdText);
	brst.Open(tSQL,adCmdText);
	this->ButtonEnabled(false);
	m_EdtSID.SetFocus();
}

void CMobilizeInfo::OnButundo() 
{
	// TODO: Add your control notification handler code here
	if(MessageBox("确定要撤消操作吗?","系统提示",MB_OKCANCEL|MB_ICONQUESTION)!=1)
		return;
    this->ButtonEnabled(false);
	this->ClearEdit();
	this->DisPlayInfo(m_sID);
	this->m_Butadd.SetFocus();
}

void CMobilizeInfo::OnButexit() 
{
	// TODO: Add your control notification handler code here
	this->OnCancel();
}

void CMobilizeInfo::ButtonEnabled(bool bEnabled)
{
	m_EdtSID.EnableWindow(bEnabled);
	m_Edtdoname.EnableWindow(bEnabled);
	m_Comnewdept.EnableWindow(bEnabled);
	m_EdtNewDuty.EnableWindow(bEnabled);
	m_Comfdept.EnableWindow(bEnabled);
	m_EdtFduty.EnableWindow(bEnabled);
	m_Edtstaffname.EnableWindow(bEnabled);
	m_EdtstaffID.EnableWindow(bEnabled);
	m_Comstaffdep.EnableWindow(bEnabled);
	m_Sql_Grid.EnableWindow(bEnabled);
	m_EdtRemark.EnableWindow(bEnabled);
	m_EdtSname.EnableWindow(bEnabled);
	m_ComType.EnableWindow(bEnabled);
	m_DatRemovetime.EnableWindow(bEnabled);

	m_Butadd.EnableWindow(!bEnabled);
	m_Butchange.EnableWindow(!bEnabled);
	m_Butdelete.EnableWindow(!bEnabled);
	m_Butexit.EnableWindow(!bEnabled);
	m_Butsave.EnableWindow(bEnabled);
	m_Butundo.EnableWindow(bEnabled);

}

void CMobilizeInfo::ClearEdit()
{
	
	m_EdtRemoveID.SetWindowText("");
	m_EdtSID.SetWindowText("");
	m_Edtdoname.SetWindowText("");
//	m_EdtNewdept.SetWindowText("");
	m_EdtNewDuty.SetWindowText("");
//	m_EdtFdept.SetWindowText("");
	m_EdtFduty.SetWindowText("");
	m_EdtPassname.SetWindowText("");
	m_EdtRemark.SetWindowText("");
	m_EdtSname.SetWindowText("");

}

void CMobilizeInfo::DisPlayInfo(CString sID)
{
	RxRecordset drxt;
	CString sSQL;
 	if(sID.IsEmpty())
 		return;
 	sSQL.Format("SELECT * FROM 员工调动视图 WHERE 调动编号 ='%s'",sID);
 	drxt.Open(sSQL,adCmdText);
	if(drxt.GetRecordCount()<1)
		return;
	/////////////////////////
	CString removeID,SID,Ctype,DoName,newDept,newDuty,oldDept,oldDuty,passName,remark,Sname,timeRemove;
	removeID=drxt.GetFieldValue("调动编号");//
	SID=drxt.GetFieldValue("员工编号");
	Ctype=drxt.GetFieldValue("调动类型");//
	DoName=drxt.GetFieldValue("经办人");//
	newDept=drxt.GetFieldValue("新部门");//
	newDuty=drxt.GetFieldValue("新职务");//
	oldDept=drxt.GetFieldValue("原部门");//
	oldDuty=drxt.GetFieldValue("原职务");//
	passName=drxt.GetFieldValue("批准人");//
	remark=drxt.GetFieldValue("备注");//
	Sname=drxt.GetFieldValue("员工姓名");//
	timeRemove=drxt.GetFieldValue("调动时间");//
	/////////////////////////////
	CTime time;
	time=CStringTOCTime(timeRemove);
	this->m_DatRemovetime.SetTime(&time);
	/////////////////////
	m_ComType.SetWindowText(Ctype);
	//////////////////
	m_EdtRemoveID.SetWindowText(removeID);
	m_EdtSID.SetWindowText(SID);
	m_Edtdoname.SetWindowText(DoName);
	m_Comnewdept.SetWindowText(newDept);
	m_EdtNewDuty.SetWindowText(newDuty);
	m_Comfdept.SetWindowText(oldDept);
	m_EdtFduty.SetWindowText(oldDuty);
	m_EdtPassname.SetWindowText(passName);
	m_EdtRemark.SetWindowText(remark);
	m_EdtSname.SetWindowText(Sname);

	m_EdtRemoveID.SetColour(RGB(0,0,0));//设置编辑框边框颜色
	m_EdtSID.SetColour(RGB(0,0,0));
	m_Edtdoname.SetColour(RGB(0,0,0));
//	m_EdtNewdept.SetColour(RGB(0,0,0));
	m_EdtNewDuty.SetColour(RGB(0,0,0));
//	m_EdtFdept.SetColour(RGB(0,0,0));
	m_EdtFduty.SetColour(RGB(0,0,0));
	m_EdtPassname.SetColour(RGB(0,0,0));
	m_EdtRemark.SetColour(RGB(0,0,0));
	m_EdtSname.SetColour(RGB(0,0,0));

}

void CMobilizeInfo::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	CRect rect;
		CBitmap bit;
		CDC memDC;
		this->GetClientRect(&rect);
		bit.LoadBitmap(IDB_BIT_BJ);
		memDC.CreateCompatibleDC(&dc);
		memDC.SelectObject(&bit);
		dc.BitBlt(0,0,rect.Width(),rect.Height(),&memDC,0,0,SRCCOPY);
		memDC.DeleteDC();
		::DeleteObject(&bit);	
		CDialog::OnPaint();
	// Do not call CDialog::OnPaint() for painting messages
}

HBRUSH CMobilizeInfo::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here
			if(nCtlColor==CTLCOLOR_STATIC)
	{
		pDC->SetBkColor(RGB(255,255,255));
		pDC->SetTextColor(RGB(0,0,0));

	}
	// TODO: Return a different brush if the default is not desired
	return hbr;
}

void CMobilizeInfo::OnBtnsel() 
{
	// TODO: Add your control notification handler code here
	CString sSQL,sName,sSID,sSdep;
	this->m_Edtstaffname.GetWindowText(sName);
	this->m_EdtstaffID.GetWindowText(sSID);
	this->m_Comstaffdep.GetWindowText(sSdep);
	if(sSdep=="所有部门")
	{
	if(sName.IsEmpty() && sSID.IsEmpty())
			sSQL.Format("SELECT * FROM 员工查询视图");

	    if(!sName.IsEmpty())
		{
			if(sSID.IsEmpty())
			sSQL.Format("SELECT * FROM 员工查询视图 where 姓名 LIKE '%%%s%%'",sName);
			else
				sSQL.Format("SELECT * FROM 员工查询视图 where 编号 LIKE '%%%s%%' OR 姓名 LIKE '%%%s%%'",sSID,sName);
		}
		else
		{
			if(!sSID.IsEmpty())
				sSQL.Format("SELECT * FROM 员工查询视图 where 编号 LIKE '%%%s%%'",sSID);
		}
	}
	
	if(sSdep!="所有部门")
	{
		if(sName.IsEmpty() && sSID.IsEmpty())
			sSQL.Format("SELECT * FROM 员工查询视图 where 部门='%s'",sSdep);
		if(!sName.IsEmpty())
		{
			if(sSID.IsEmpty())
			sSQL.Format("SELECT * FROM 员工查询视图 where 姓名 LIKE '%%%s%%' AND 部门='%s'",sName,sSdep);
			else
				sSQL.Format("SELECT * FROM 员工查询视图 where 编号 LIKE '%%%s%%' OR 姓名 LIKE '%%%s%%' AND 部门='%s'",sSID,sName,sSdep);
		}
		else
		{
			if(!sSID.IsEmpty())
				sSQL.Format("SELECT * FROM 员工查询视图 where 编号 LIKE '%%%s%%' AND 部门='%s'",sSID,sSdep);
		}
	}
	RxRecordset rRst;
	rRst.Open(sSQL,adCmdText);
	m_Sql_Grid.AddCellValue(rRst);
}

void CMobilizeInfo::OnDblclkListGrid(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	RxRecordset rRst;
	CString sSql,sname,sID,sdep,sduty;
	if(m_Sql_Grid.GetHotItem()<0)
		return;
	m_tID=this->m_Sql_Grid.GetItemText(m_Sql_Grid.GetHotItem(),0);
	sSql.Format("SELECT * FROM 员工查询视图 WHERE 编号='%s'",m_tID);
	rRst.Open(sSql,adCmdText);
	sID=rRst.GetFieldValue("编号");
	sname=rRst.GetFieldValue("姓名");
	sdep=rRst.GetFieldValue("部门");
	sduty=rRst.GetFieldValue("职务");
	
	m_EdtSID.SetWindowText(sID);
	m_EdtSname.SetWindowText(sname);
	m_Comfdept.SetWindowText(sdep);
	m_EdtFduty.SetWindowText(sduty);
	*pResult = 0;
}


⌨️ 快捷键说明

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