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

📄 auinfomodifydlg.cpp

📁 VC下基于SQL的图书管理系统源代码
💻 CPP
字号:
// AuInfoModifyDlg.cpp : implementation file
//

#include "stdafx.h"
#include "BookAdmi.h"
#include "AuInfoModifyDlg.h"
#include "AuthorInfo.h"
#include "ADOConn.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// AuInfoModifyDlg dialog


AuInfoModifyDlg::AuInfoModifyDlg(CWnd* pParent /*=NULL*/)
	: CDialog(AuInfoModifyDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(AuInfoModifyDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void AuInfoModifyDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT1, m_AuthorNameEdit);
	DDX_Text(pDX, IDC_EDIT2, m_AuthorIdEdit);
	DDX_Text(pDX, IDC_EDIT4, m_CityEdit);
	DDX_Text(pDX, IDC_EDIT3, m_AuthorAdrEdit);
	DDX_Text(pDX, IDC_EDIT5, m_PostNumEdit);
	DDX_Text(pDX, IDC_EDIT6, m_TelEdit);
	DDX_Text(pDX, IDC_EDIT7, m_FaxEdit);
	DDX_Text(pDX, IDC_EDIT8, m_EmailEdit);
	DDX_Text(pDX, IDC_EDIT9, m_RemarkEdit);
	//{{AFX_DATA_MAP(AuInfoModifyDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(AuInfoModifyDlg, CDialog)
	//{{AFX_MSG_MAP(AuInfoModifyDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// AuInfoModifyDlg message handlers

void AuInfoModifyDlg::OnOK() 
{
	UpdateData(true);
	ADOConn m_AdoConn;
	m_AdoConn.OnInitADOConn();
	_bstr_t vSQL;
	vSQL="SELECT * from t_author where AuthorId='"+m_AuthorIdEdit+"'";
	_RecordsetPtr m_pRecordset;
	m_pRecordset=m_AdoConn.GetRecordSet(vSQL);
	if(!m_pRecordset->adoEOF&&OldAuthorId!=m_AuthorIdEdit)
	{
		MessageBox("此作者编号已存在!!");
		return;
	}
	if(AuthorInfoError())
	{
		MessageBox(ErrorStr+"输入有误!!");
		return;
	}
	pSearchResultDlg->deadDelete=true;
	pSearchResultDlg->OnDelete();
	AuthorInfo AInfo;
	AInfo.a_AuthorId=m_AuthorIdEdit;
	AInfo.a_AuthorName=m_AuthorNameEdit;
	AInfo.a_AuthorAdr=m_AuthorAdrEdit;	
	AInfo.a_City=m_CityEdit;
	AInfo.a_Email=m_EmailEdit;
	AInfo.a_Fax=m_FaxEdit;
	AInfo.a_PostNum=m_PostNumEdit;
	AInfo.a_Remark=m_RemarkEdit;
	AInfo.a_Tel=m_TelEdit;
/*	if(m_BookPriceEdit=="")
		AInfo.a_BookPrice="0";	
	AInfo.a_PageAmount=m_PageAmountEdit;
	if(m_PageAmountEdit=="")
		AInfo.a_PageAmount="0";*/
	AInfo.sql_insert();
	pSearchResultDlg->m_adodc.Refresh();
	MessageBox("数据修改成功!!");
	pSearchResultDlg->deadDelete=false;
	CDialog::OnOK();
}

bool AuInfoModifyDlg::AuthorInfoError()
{
	if(m_AuthorNameEdit=="")
	{
		ErrorStr="作者名";
		return(true);
	}
	if(m_AuthorIdEdit=="")
	{
		ErrorStr="作者编号";
		return(true);
	}
	if(m_PostNumEdit!="")
		if(m_PostNumEdit.GetLength()!=6)
		{
			ErrorStr="邮编";
			return(true);
		}
	if(m_TelEdit!="")
		if(m_TelEdit.GetLength()>11)
		{
			ErrorStr="电话";
			return(true);
		}
	if(m_FaxEdit!="")
		if(m_FaxEdit.GetLength()>11)
		{
			ErrorStr="传真";
			return(true);
		}
	return(false);
}

void AuInfoModifyDlg::OnCancel() 
{
	pSearchResultDlg->deadDelete=false;	
	CDialog::OnCancel();
}

⌨️ 快捷键说明

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