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

📄 bookdlg.cpp

📁 图书管理系统可进行查询,添加,修改,等操作 用树行结构为图书馆进行图书分类
💻 CPP
字号:
// bookdlg.cpp : implementation file
//

#include "stdafx.h"
#include "图书管理.h"
#include "bookdlg.h"
#include"bookedit.h"
#include"xitongdlg.h"
#include"borbackdlog.h"
#include"_Recordset.h"
#include"readdlg.h"
#include"borrow.h"
#include"book.h"
#include"selbook9.h"
//#include"Users.h"
#include"grobe.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// bookdlg dialog
extern CUsers use;

bookdlg::bookdlg(CWnd* pParent /*=NULL*/)
	: CDialog(bookdlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(bookdlg)
	//}}AFX_DATA_INIT
	str="-1";
}


void bookdlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(bookdlg)
	DDX_Control(pDX, IDC_DATAGRID1, m_grid);
	DDX_Control(pDX, IDC_ADODC1, m_adoc);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(bookdlg, CDialog)
	//{{AFX_MSG_MAP(bookdlg)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// bookdlg message handlers

void bookdlg::OnButton1() 
{
	// TODO: Add your control notification handler code here
	bookedit dlg;
  
	dlg.m_bookno=str;
	if(str=="-1")
	{
		MessageBox("请选择要修改的记录");
		return ;
	}
    str="-1";
	dlg.DoModal();
    m_adoc.Refresh();
}

void bookdlg::OnButton2() 
{
	// TODO: Add your control notification handler code here

    str=m_grid.GetItem(0);
	if(str=="-1")
	{
		MessageBox("请选择要删除的记录");
		return ;
	}	
	if (MessageBox("是否删除当前记录","请确定", MB_YESNO) == IDYES)
	{
		Cbook b;
		b.sql_delete(str);
		
	}
    str="-1";
	m_adoc.Refresh();
}

void bookdlg::OnOK() 
{
	// TODO: Add extra validation here
	
	bookedit dlg;
	dlg.DoModal();
    m_adoc.Refresh();
}

void bookdlg::OnCancel() 
{
	// TODO: Add extra cleanup here
	xitongdlg dlg;
	dlg.DoModal();

	

}

BEGIN_EVENTSINK_MAP(bookdlg, CDialog)
    //{{AFX_EVENTSINK_MAP(bookdlg)
	ON_EVENT(bookdlg, IDC_DATAGRID1, -600 /* Click */, OnClickDatagrid1, VTS_NONE)
	//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()

void bookdlg::OnClickDatagrid1() 
{
	// TODO: Add your control notification handler code here
	  str=m_grid.GetItem(0);
}

BOOL bookdlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
     bookdlg dlg;
	 int t;
	 t=dlg.gettype();
	// TODO: Add extra initialization here
	if(use.User_type==2)
	{
		GetDlgItem(IDOK)->EnableWindow(false);
        GetDlgItem(IDC_BUTTON1)->EnableWindow(false); 
		GetDlgItem(IDC_BUTTON2)->EnableWindow(false);
	}

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
int bookdlg::gettype()
{
	return type;
}
void bookdlg::settype(int i)
{
	type=i;
}

void bookdlg::OnButton3() 
{
	// TODO: Add your control notification handler code here
 selbook9 dlg;
 	dlg.DoModal();
 
	
}

⌨️ 快捷键说明

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