📄 newbookdlg.cpp
字号:
// newbookdlg.cpp : implementation file
//
#include "stdafx.h"
#include "图书管理.h"
#include "newbookdlg.h"
#include"newbookedit.h"
#include"xitongdlg.h"
#include"newbook.h"
#include"selnewbook9.h"
//#include"grobe.h"
//#include"Users.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CUsers use;
/////////////////////////////////////////////////////////////////////////////
// newbookdlg dialog
newbookdlg::newbookdlg(CWnd* pParent /*=NULL*/)
: CDialog(newbookdlg::IDD, pParent)
{
//{{AFX_DATA_INIT(newbookdlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
str="-1";
}
void newbookdlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(newbookdlg)
DDX_Control(pDX, IDC_ADODC1, m_adoc);
DDX_Control(pDX, IDC_DATAGRID1, m_grid);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(newbookdlg, CDialog)
//{{AFX_MSG_MAP(newbookdlg)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// newbookdlg message handlers
void newbookdlg::OnButton1()
{
// TODO: Add your control notification handler code here
CString str2;
str2=m_grid.GetItem(1);
if(str=="-1")
{
MessageBox("请选择要删除的记录");
return ;
}
if (MessageBox("是否删除当前记录","请确定", MB_YESNO) == IDYES)
{
Cnewbook b;
b.sql_delete(str,str2);
}
str="-1";
m_adoc.Refresh();
CDialog::OnOK();
}
void newbookdlg::OnOK()
{
// TODO: Add extra validation here
newbookedit dlg;
dlg.DoModal();
m_adoc.Refresh();
}
void newbookdlg::OnCancel()
{
// TODO: Add extra cleanup here
xitongdlg dlg;
dlg.DoModal();
}
BEGIN_EVENTSINK_MAP(newbookdlg, CDialog)
//{{AFX_EVENTSINK_MAP(newbookdlg)
ON_EVENT(newbookdlg, IDC_DATAGRID1, -600 /* Click */, OnClickDatagrid1, VTS_NONE)
//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()
void newbookdlg::OnClickDatagrid1()
{
// TODO: Add your control notification handler code here
str=m_grid.GetItem(0);
}
BOOL newbookdlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
if(use.User_type==2)
{
GetDlgItem(IDOK)->EnableWindow(false);
GetDlgItem(IDC_BUTTON1)->EnableWindow(false);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void newbookdlg::OnButton2()
{
// TODO: Add your control notification handler code here
selnewbook9 dlg;
dlg.DoModal();
m_adoc.Refresh();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -