📄 addread.cpp
字号:
// AddRead.cpp : implementation file
//
#include "stdafx.h"
#include "Material_MIS.h"
#include "AddRead.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAddRead dialog
CAddRead::CAddRead(CWnd* pParent /*=NULL*/)
: CDialog(CAddRead::IDD, pParent)
{
//{{AFX_DATA_INIT(CAddRead)
//}}AFX_DATA_INIT
}
void CAddRead::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAddRead)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAddRead, CDialog)
//{{AFX_MSG_MAP(CAddRead)
ON_BN_CLICKED(IDCANCELREAD, OnCancelread)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAddRead message handlers
BOOL CAddRead::OnInitDialog()
{
CDialog::OnInitDialog();
_variant_t strQuery, Holder;
int iCount;
CString ADm=_T("administrator");
strQuery = "select distinct UserID from UserInfo where UserID not like '"+ADm+"'";
theApp.ADOExecute(theApp.m_pADOSet, strQuery);
iCount = theApp.m_pADOSet->GetRecordCount();
if(iCount>0)
{
theApp.m_pADOSet->MoveFirst();
for (int i=0; i<iCount; i++)
{
Holder = theApp.m_pADOSet->GetCollect("UserID");
((CComboBox*)GetDlgItem(IDC_COMBOREAD))->InsertString(i, Holder.vt==VT_NULL?"":(char*)(_bstr_t)Holder);
theApp.m_pADOSet->MoveNext();
}
((CComboBox*)GetDlgItem(IDC_COMBOREAD))->SetCurSel(0);
}
UpdateData(false);
return TRUE;
}
void CAddRead::OnOK()
{
_variant_t strQuery;
CString oo=_T("on");
CString reader=_T(" ");
int pindex=(((CComboBox*)GetDlgItem(IDC_COMBOREAD))->GetCurSel());
((CComboBox*)GetDlgItem(IDC_COMBOREAD))->GetLBText(pindex,reader);
strQuery = "Update UserInfo set ReadRight='"+oo+"' where UserID like '"+reader+"'";
if ( theApp.ADOExecute(theApp.m_pADOSet, strQuery) )
AfxMessageBox(_T("修改成功!"), MB_ICONINFORMATION);
else
AfxMessageBox(_T("修改失败!"), MB_ICONINFORMATION);
CDialog::OnOK();
}
void CAddRead::OnCancelread()
{
_variant_t strQuery;
CString oo=_T("off");
CString reader=_T(" ");
int pindex=(((CComboBox*)GetDlgItem(IDC_COMBOREAD))->GetCurSel());
((CComboBox*)GetDlgItem(IDC_COMBOREAD))->GetLBText(pindex,reader);
strQuery = "Update UserInfo set ReadRight='"+oo+"' where UserID='"+reader+"'";
if ( theApp.ADOExecute(theApp.m_pADOSet, strQuery) )
AfxMessageBox(_T("修改成功!"), MB_ICONINFORMATION);
else
AfxMessageBox(_T("修改失败!"), MB_ICONINFORMATION);
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -