home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / tutorial / enroll / step4 / enroldoc.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-27  |  2.0 KB  |  97 lines

  1. // EnrolDoc.cpp : implementation of the CEnrollDoc class
  2. //
  3.  
  4. #include "Stdafx.h"
  5. #include "Enroll.h"
  6. #include "SectSet.h"
  7. #include "CoursSet.h"
  8. #include "EnrolDoc.h"
  9.  
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CUpdateHint
  18.  
  19. IMPLEMENT_DYNAMIC(CUpdateHint, CObject)
  20.  
  21. CUpdateHint::CUpdateHint()
  22. {
  23. }
  24.  
  25.  
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CEnrollDoc
  28.  
  29. IMPLEMENT_DYNCREATE(CEnrollDoc, CDocument)
  30.  
  31. BEGIN_MESSAGE_MAP(CEnrollDoc, CDocument)
  32.     //{{AFX_MSG_MAP(CEnrollDoc)
  33.         // NOTE - the ClassWizard will add and remove mapping macros here.
  34.         //    DO NOT EDIT what you see in these blocks of generated code!
  35.     //}}AFX_MSG_MAP
  36. END_MESSAGE_MAP()
  37.  
  38. /////////////////////////////////////////////////////////////////////////////
  39. // CEnrollDoc construction/destruction
  40.  
  41. CEnrollDoc::CEnrollDoc()
  42. {
  43.     // TODO: add one-time construction code here
  44.  
  45. }
  46.  
  47. CEnrollDoc::~CEnrollDoc()
  48. {
  49. }
  50.  
  51. BOOL CEnrollDoc::OnNewDocument()
  52. {
  53.     if (!CDocument::OnNewDocument())
  54.         return FALSE;
  55.  
  56.     // TODO: add reinitialization code here
  57.     // (SDI documents will reuse this document)
  58.  
  59.     return TRUE;
  60. }
  61.  
  62. /////////////////////////////////////////////////////////////////////////////
  63. // CEnrollDoc database support
  64.  
  65. CDatabase* CEnrollDoc::GetDatabase()
  66. {
  67.     TRY
  68.     {
  69.         if (!m_database.IsOpen())
  70.             m_database.Open("Student Registration;");
  71.     }
  72.     CATCH(CDBException, e)
  73.     {
  74.         AfxMessageBox(e->m_strError);
  75.     }
  76.     END_CATCH
  77.     return &m_database;
  78. }
  79.  
  80. /////////////////////////////////////////////////////////////////////////////
  81. // CEnrollDoc diagnostics
  82.  
  83. #ifdef _DEBUG
  84. void CEnrollDoc::AssertValid() const
  85. {
  86.     CDocument::AssertValid();
  87. }
  88.  
  89. void CEnrollDoc::Dump(CDumpContext& dc) const
  90. {
  91.     CDocument::Dump(dc);
  92. }
  93. #endif //_DEBUG
  94.  
  95. /////////////////////////////////////////////////////////////////////////////
  96. // CEnrollDoc commands
  97.