reservationview.cpp

来自「一个课程作业」· C++ 代码 · 共 101 行

CPP
101
字号
// ReservationView.cpp : implementation file
//

#include "stdafx.h"
#include "order.h"
#include "ReservationView.h"
#include "FilterReservation.h"

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

/////////////////////////////////////////////////////////////////////////////
// CReservationView

IMPLEMENT_DYNCREATE(CReservationView, CRecordView)

CReservationView::CReservationView()
	: CRecordView(CReservationView::IDD)
{
	//{{AFX_DATA_INIT(CReservationView)
	m_pSet = NULL;
	//}}AFX_DATA_INIT
}

CReservationView::~CReservationView()
{
	if (m_pSet)
		delete m_pSet;
}

void CReservationView::DoDataExchange(CDataExchange* pDX)
{
	CRecordView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CReservationView)
	DDX_FieldText(pDX, IDC_EDIT1, m_pSet->m_custName, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT2, m_pSet->m_resvType, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT3, m_pSet->m_resvKey, m_pSet);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CReservationView, CRecordView)
	//{{AFX_MSG_MAP(CReservationView)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CReservationView diagnostics

#ifdef _DEBUG
void CReservationView::AssertValid() const
{
	CRecordView::AssertValid();
}

void CReservationView::Dump(CDumpContext& dc) const
{
	CRecordView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CReservationView message handlers

CRecordset* CReservationView::OnGetRecordset()
{
	if (m_pSet != NULL)
		return m_pSet;

	m_pSet = new CReservationSet(NULL);
	m_pSet->Open();

	return m_pSet;
}

CReservationSet* CReservationView::GetRecordset()
{
	CReservationSet* pData = (CReservationSet*) OnGetRecordset();
	ASSERT(pData == NULL || pData->IsKindOf(RUNTIME_CLASS(CReservationSet)));
	return pData;
}

void CReservationView::OnInitialUpdate()
{
	BeginWaitCursor();
	GetRecordset();
	CRecordView::OnInitialUpdate();
	if (m_pSet->IsOpen())
	{
		CString strTitle = m_pSet->m_pDatabase->GetDatabaseName();
		CString strTable = m_pSet->GetTableName();
		if (!strTable.IsEmpty())
			strTitle += _T(":") + strTable;
		GetDocument()->SetTitle(strTitle);
	}
	EndWaitCursor();
}

⌨️ 快捷键说明

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