湖南农业大学 课程设计论文
{ //{{AFX_DATA_INIT(COffdutyDlg) m_strDayName = _T(\ m_nTotalAcount = 0; m_timeDay = 0; //}}AFX_DATA_INIT }
BOOL COffdutyDlg::OnInitDialog() //对话框初始化 { CDialog::OnInitDialog(); m_timeDay=CTime::GetCurrentTime(); m_strDayName=theApp.m_name; UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void COffdutyDlg::OnCalDayBtn() //统计按钮,负责当班统计 { CString sql,str; int temp=1; str.Format(\ sql=\* FROM DeskInfo WHERE DeskCheck=\DeskName='\ m_pRecordset_Desk.CreateInstance(\ m_pRecordset_Desk->Open((_variant_t)sql,_variant_t((IDispatch
*)theApp.m_pConnection,true),adOpenDynamic,adLockPessimistic,adCmdText); int renminbi_jine=0,qita_jine=0,total_jine=0,acount=0; if(m_pRecordset_Desk->GetRecordCount!=0) { while(!m_pRecordset_Desk->adoEOF) { str=m_pRecordset_Desk->GetCollect(\ if(str.CompareNoCase(\人民币\ { renminbi_jine+=m_pRecordset_Desk->GetCollect(\ } else {
- 26 -
AND
湖南农业大学 课程设计论文
qita_jine+=m_pRecordset_Desk->GetCollect(\ } acount++; m_pRecordset_Desk->MoveNext(); } } m_pRecordset_Desk->Close(); total_jine=renminbi_jine+qita_jine; m_pRecordset_Off.CreateInstance(\ m_pRecordset_Off->Open(\* FROM CalDayInfo\*)theApp.m_pConnection,true),adOpenDynamic,adLockPessimistic,adCmdText); if(m_pRecordset_Off->GetRecordCount!=0) { while(!m_pRecordset_Off->adoEOF) { m_pRecordset_Off->Delete(adAffectCurrent); m_pRecordset_Off->Update(); m_pRecordset_Off->MoveNext(); } } m_pRecordset_Off->AddNew(); m_pRecordset_Off->PutCollect(\人民币\ str.Format(\ m_pRecordset_Off->PutCollect(\ m_pRecordset_Off->AddNew(); m_pRecordset_Off->PutCollect(\其他\ str.Format(\ m_pRecordset_Off->PutCollect(\ m_pRecordset_Off->AddNew(); m_pRecordset_Off->PutCollect(\合计\ str.Format(\ m_pRecordset_Off->PutCollect(\ m_dbTotalDay.SetRefDataSource(NULL); m_dbTotalDay.SetRefDataSource((LPUNKNOWN)m_pRecordset_Off); m_dbTotalDay.SetColumnHeaders(2); m_dbTotalDay.Refresh();
- 27 -
湖南农业大学 课程设计论文
m_pRecordset_Off->Update(); m_nTotalAcount=acount; UpdateData(FALSE); }
3.4用户权限管理模块设计
用户权限模块的功能是方便管理人员查询员工的基本资料,设置员工的操作权限。用户权限设置模块的设计如图9:
图9 权限设置模块
对话框类的各成员函数的代码如下:
CLevelDlg::CLevelDlg(CWnd* pParent /*=NULL*/) : CDialog(CLevelDlg::IDD, pParent) { //{{AFX_DATA_INIT(CLevelDlg) m_strUserName = _T(\ m_strUserNum = _T(\ m_strLevelSelect = _T(\ //}}AFX_DATA_INIT }
BOOL CLevelDlg::OnInitDialog() { CDialog::OnInitDialog(); m_coLevelSelect.AddString(\管理员\ m_coLevelSelect.AddString(\用户\ GetDlgItem(IDC_LEVEL_SELECT)->EnableWindow(FALSE);
- 28 -
湖南农业大学 课程设计论文
GetDlgItem(IDC_CONFIRM)->EnableWindow(FALSE); UpdateData(FALSE); CString sql; sql=\ m_pRecordset.CreateInstance(\ m_pRecordset->Open((_variant_t)sql,_variant_t((IDispatch
*)theApp.m_pConnection,true),adOpenDynamic,adLockPessimistic,adCmdText); m_dbUserInfo.SetRefDataSource(NULL); m_dbUserInfo.SetRefDataSource((LPUNKNOWN)m_pRecordset); m_dbUserInfo.SetColumnHeaders(2); m_dbUserInfo.Refresh(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CLevelDlg::OnChange() { GetDlgItem(IDC_LEVEL_SELECT)->EnableWindow(TRUE); GetDlgItem(IDC_CONFIRM)->EnableWindow(TRUE); UpdateData(TRUE); CString sql; sql=\UserName,UserNum,UserLevel,UserPwd FROM UserInfo UserName='\ m_pRecordset.CreateInstance(\ m_pRecordset->Open((_variant_t)sql,_variant_t((IDispatch
*)theApp.m_pConnection,true),adOpenDynamic,adLockPessimistic,adCmdText); m_dbUserInfo.SetRefDataSource(NULL); m_dbUserInfo.SetRefDataSource((LPUNKNOWN)m_pRecordset); m_dbUserInfo.SetColumnHeaders(2); m_dbUserInfo.Refresh(); }
void CLevelDlg::OnConfirm() { UpdateData(TRUE); if(!m_strLevelSelect.IsEmpty()) { if(m_strLevelSelect.CompareNoCase(\管理员\ {
- 29 -
WHERE
湖南农业大学 课程设计论文
CString str,sql; int temp=1; str.Format(\ sql=\UserName='\ m_pRecordset.CreateInstance(\ m_pRecordset->Open((_variant_t)sql,_variant_t((IDispatch
*)theApp.m_pConnection,true),adOpenDynamic,adLockPessimistic,adCmdText); m_pRecordset->PutCollect(\ m_pRecordset->Update(); m_dbUserInfo.SetRefDataSource(NULL); m_dbUserInfo.SetRefDataSource((LPUNKNOWN)m_pRecordset); m_dbUserInfo.SetColumnHeaders(2); m_dbUserInfo.Refresh(); AfxMessageBox(\权限修改成功\ GetDlgItem(IDC_LEVEL_SELECT)->EnableWindow(FALSE); GetDlgItem(IDC_CONFIRM)->EnableWindow(FALSE); } else { CString str,sql; int temp=0; str.Format(\ sql=\UserName='\ m_pRecordset.CreateInstance(\ m_pRecordset->Open((_variant_t)sql,_variant_t((IDispatch
*)theApp.m_pConnection,true),adOpenDynamic,adLockPessimistic,adCmdText); m_pRecordset->PutCollect(\ m_pRecordset->Update(); m_dbUserInfo.SetRefDataSource(NULL); m_dbUserInfo.SetRefDataSource((LPUNKNOWN)m_pRecordset); m_dbUserInfo.SetColumnHeaders(2); m_dbUserInfo.Refresh(); AfxMessageBox(\权限修改成功\ GetDlgItem(IDC_LEVEL_SELECT)->EnableWindow(FALSE); GetDlgItem(IDC_CONFIRM)->EnableWindow(FALSE); } } else { AfxMessageBox(\请选择权限\ } }
- 30 -