DAODepartmentView.cpp
上传用户:benben_wyd
上传日期:2010-02-26
资源大小:1229k
文件大小:3k
源码类别:

书籍源码

开发平台:

Visual C++

  1. // DAODepartmentView.cpp : implementation of the CDAODepartmentView class
  2. //
  3. #include "stdafx.h"
  4. #include "DAODepartment.h"
  5. #include "DAODepartmentSet.h"
  6. #include "DAODepartmentDoc.h"
  7. #include "DAODepartmentView.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CDAODepartmentView
  15. IMPLEMENT_DYNCREATE(CDAODepartmentView, CDaoRecordView)
  16. BEGIN_MESSAGE_MAP(CDAODepartmentView, CDaoRecordView)
  17. //{{AFX_MSG_MAP(CDAODepartmentView)
  18. //}}AFX_MSG_MAP
  19. // Standard printing commands
  20. ON_COMMAND(ID_FILE_PRINT, CDaoRecordView::OnFilePrint)
  21. ON_COMMAND(ID_FILE_PRINT_DIRECT, CDaoRecordView::OnFilePrint)
  22. ON_COMMAND(ID_FILE_PRINT_PREVIEW, CDaoRecordView::OnFilePrintPreview)
  23. END_MESSAGE_MAP()
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CDAODepartmentView construction/destruction
  26. CDAODepartmentView::CDAODepartmentView()
  27. : CDaoRecordView(CDAODepartmentView::IDD)
  28. {
  29. //{{AFX_DATA_INIT(CDAODepartmentView)
  30. m_pSet = NULL;
  31. //}}AFX_DATA_INIT
  32. }
  33. CDAODepartmentView::~CDAODepartmentView()
  34. {
  35. }
  36. void CDAODepartmentView::DoDataExchange(CDataExchange* pDX)
  37. {
  38. CDaoRecordView::DoDataExchange(pDX);
  39. //{{AFX_DATA_MAP(CDAODepartmentView)
  40. DDX_FieldText(pDX, IDC_DEPARTMENTCODE, m_pSet->m_DepartmentCode, m_pSet);
  41. DDV_MaxChars(pDX, m_pSet->m_DepartmentCode, 4);
  42. DDX_FieldText(pDX, IDC_DEPARTMENTNAME, m_pSet->m_DepartmentName, m_pSet);
  43. DDV_MaxChars(pDX, m_pSet->m_DepartmentName, 50);
  44. //}}AFX_DATA_MAP
  45. }
  46. BOOL CDAODepartmentView::PreCreateWindow(CREATESTRUCT& cs)
  47. {
  48. return CDaoRecordView::PreCreateWindow(cs);
  49. }
  50. void CDAODepartmentView::OnInitialUpdate()
  51. {
  52. m_pSet = &GetDocument()->m_dAODepartmentSet;
  53. CDaoRecordView::OnInitialUpdate();
  54. GetParentFrame()->RecalcLayout();
  55. ResizeParentToFit();
  56. }
  57. /////////////////////////////////////////////////////////////////////////////
  58. // CDAODepartmentView printing
  59. BOOL CDAODepartmentView::OnPreparePrinting(CPrintInfo* pInfo)
  60. {
  61. // default preparation
  62. return DoPreparePrinting(pInfo);
  63. }
  64. void CDAODepartmentView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  65. {
  66. }
  67. void CDAODepartmentView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  68. {
  69. }
  70. /////////////////////////////////////////////////////////////////////////////
  71. // CDAODepartmentView diagnostics
  72. #ifdef _DEBUG
  73. void CDAODepartmentView::AssertValid() const
  74. {
  75. CDaoRecordView::AssertValid();
  76. }
  77. void CDAODepartmentView::Dump(CDumpContext& dc) const
  78. {
  79. CDaoRecordView::Dump(dc);
  80. }
  81. CDAODepartmentDoc* CDAODepartmentView::GetDocument() // non-debug version is inline
  82. {
  83. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDAODepartmentDoc)));
  84. return (CDAODepartmentDoc*)m_pDocument;
  85. }
  86. #endif //_DEBUG
  87. /////////////////////////////////////////////////////////////////////////////
  88. // CDAODepartmentView database support
  89. CDaoRecordset* CDAODepartmentView::OnGetRecordset()
  90. {
  91. return m_pSet;
  92. }
  93. /////////////////////////////////////////////////////////////////////////////
  94. // CDAODepartmentView message handlers