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

书籍源码

开发平台:

Visual C++

  1. // ODBCDepartmentView.cpp : implementation of the CODBCDepartmentView class
  2. //
  3. #include "stdafx.h"
  4. #include "ODBCDepartment.h"
  5. #include "ODBCDepartmentSet.h"
  6. #include "ODBCDepartmentDoc.h"
  7. #include "ODBCDepartmentView.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CODBCDepartmentView
  15. IMPLEMENT_DYNCREATE(CODBCDepartmentView, CRecordView)
  16. BEGIN_MESSAGE_MAP(CODBCDepartmentView, CRecordView)
  17. //{{AFX_MSG_MAP(CODBCDepartmentView)
  18. //}}AFX_MSG_MAP
  19. END_MESSAGE_MAP()
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CODBCDepartmentView construction/destruction
  22. CODBCDepartmentView::CODBCDepartmentView()
  23. : CRecordView(CODBCDepartmentView::IDD)
  24. {
  25. //{{AFX_DATA_INIT(CODBCDepartmentView)
  26. m_pSet = NULL;
  27. //}}AFX_DATA_INIT
  28. }
  29. CODBCDepartmentView::~CODBCDepartmentView()
  30. {
  31. }
  32. void CODBCDepartmentView::DoDataExchange(CDataExchange* pDX)
  33. {
  34. CRecordView::DoDataExchange(pDX);
  35. //{{AFX_DATA_MAP(CODBCDepartmentView)
  36. DDX_FieldText(pDX, IDC_DEPARTMENTCODE, m_pSet->m_DepartmentCode, m_pSet);
  37. DDV_MaxChars(pDX, m_pSet->m_DepartmentCode, 4);
  38. DDX_FieldText(pDX, IDC_DEPARTMENTNAME, m_pSet->m_DepartmentName, m_pSet);
  39. DDV_MaxChars(pDX, m_pSet->m_DepartmentName, 50);
  40. //}}AFX_DATA_MAP
  41. }
  42. BOOL CODBCDepartmentView::PreCreateWindow(CREATESTRUCT& cs)
  43. {
  44. return CRecordView::PreCreateWindow(cs);
  45. }
  46. void CODBCDepartmentView::OnInitialUpdate()
  47. {
  48. m_pSet = &GetDocument()->m_oDBCDepartmentSet;
  49. CRecordView::OnInitialUpdate();
  50. GetParentFrame()->RecalcLayout();
  51. ResizeParentToFit();
  52. }
  53. /////////////////////////////////////////////////////////////////////////////
  54. // CODBCDepartmentView diagnostics
  55. #ifdef _DEBUG
  56. void CODBCDepartmentView::AssertValid() const
  57. {
  58. CRecordView::AssertValid();
  59. }
  60. void CODBCDepartmentView::Dump(CDumpContext& dc) const
  61. {
  62. CRecordView::Dump(dc);
  63. }
  64. CODBCDepartmentDoc* CODBCDepartmentView::GetDocument() // non-debug version is inline
  65. {
  66. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CODBCDepartmentDoc)));
  67. return (CODBCDepartmentDoc*)m_pDocument;
  68. }
  69. #endif //_DEBUG
  70. /////////////////////////////////////////////////////////////////////////////
  71. // CODBCDepartmentView database support
  72. CRecordset* CODBCDepartmentView::OnGetRecordset()
  73. {
  74. return m_pSet;
  75. }