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

书籍源码

开发平台:

Visual C++

  1. // OLAPConsumerView.cpp : implementation of the COLAPConsumerView class
  2. //
  3. #include "stdafx.h"
  4. #include "OLAPConsumer.h"
  5. #include "OLAPConsumerSet.h"
  6. #include "OLAPConsumerDoc.h"
  7. #include "OLAPConsumerView.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // COLAPConsumerView
  15. IMPLEMENT_DYNCREATE(COLAPConsumerView, COleDBRecordView)
  16. BEGIN_MESSAGE_MAP(COLAPConsumerView, COleDBRecordView)
  17. //{{AFX_MSG_MAP(COLAPConsumerView)
  18. //}}AFX_MSG_MAP
  19. END_MESSAGE_MAP()
  20. /////////////////////////////////////////////////////////////////////////////
  21. // COLAPConsumerView construction/destruction
  22. COLAPConsumerView::COLAPConsumerView()
  23. : COleDBRecordView(COLAPConsumerView::IDD)
  24. {
  25. //{{AFX_DATA_INIT(COLAPConsumerView)
  26. // NOTE: the ClassWizard will add member initialization here
  27. m_pSet = NULL;
  28. //}}AFX_DATA_INIT
  29. }
  30. COLAPConsumerView::~COLAPConsumerView()
  31. {
  32. }
  33. void COLAPConsumerView::DoDataExchange(CDataExchange* pDX)
  34. {
  35. COleDBRecordView::DoDataExchange(pDX);
  36. //{{AFX_DATA_MAP(COLAPConsumerView)
  37. // NOTE: the ClassWizard will add DDX and DDV calls here
  38. //}}AFX_DATA_MAP
  39. }
  40. BOOL COLAPConsumerView::PreCreateWindow(CREATESTRUCT& cs)
  41. {
  42. return COleDBRecordView::PreCreateWindow(cs);
  43. }
  44. void COLAPConsumerView::OnInitialUpdate()
  45. {
  46. m_pSet = &GetDocument()->m_oLAPConsumerSet;
  47. {
  48. CWaitCursor wait;
  49. HRESULT hr = m_pSet->Open();
  50. if (hr != S_OK)
  51. {
  52. AfxMessageBox(_T("Record set failed to open."), MB_OK);
  53. m_bOnFirstRecord = TRUE;
  54. m_bOnLastRecord = TRUE;
  55. }
  56. }
  57. COleDBRecordView::OnInitialUpdate();
  58. }
  59. /////////////////////////////////////////////////////////////////////////////
  60. // COLAPConsumerView diagnostics
  61. #ifdef _DEBUG
  62. void COLAPConsumerView::AssertValid() const
  63. {
  64. COleDBRecordView::AssertValid();
  65. }
  66. void COLAPConsumerView::Dump(CDumpContext& dc) const
  67. {
  68. COleDBRecordView::Dump(dc);
  69. }
  70. COLAPConsumerDoc* COLAPConsumerView::GetDocument() // non-debug version is inline
  71. {
  72. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(COLAPConsumerDoc)));
  73. return (COLAPConsumerDoc*)m_pDocument;
  74. }
  75. #endif //_DEBUG
  76. /////////////////////////////////////////////////////////////////////////////
  77. // COLAPConsumerView database support
  78. CRowset* COLAPConsumerView::OnGetRowset()
  79. {
  80. return m_pSet;
  81. }
  82. /////////////////////////////////////////////////////////////////////////////
  83. // COLAPConsumerView message handlers