人事管理系统View.cpp
上传用户:z_mail1980
上传日期:2007-06-01
资源大小:647k
文件大小:4k
源码类别:

SNMP编程

开发平台:

Visual C++

  1. // 人事管理系统View.cpp : implementation of the CMyView class
  2. //
  3. #include "stdafx.h"
  4. #include "人事管理系统.h"
  5. #include "人事管理系统Set.h"
  6. #include "人事管理系统Doc.h"
  7. #include "人事管理系统View.h"
  8. #include "DlgQuery.h"
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CMyView
  16. IMPLEMENT_DYNCREATE(CMyView, CRecordView)
  17. BEGIN_MESSAGE_MAP(CMyView, CRecordView)
  18. //{{AFX_MSG_MAP(CMyView)
  19. ON_BN_CLICKED(IDC_ADDRECO, OnAddreco)
  20. ON_BN_CLICKED(IDC_RECODELE, OnRecodele)
  21. ON_BN_CLICKED(IDC_SORTRECO, OnSortreco)
  22. ON_BN_CLICKED(IDC_FILTERRECO, OnFilterreco)
  23. //}}AFX_MSG_MAP
  24. // Standard printing commands
  25. ON_COMMAND(ID_FILE_PRINT, CRecordView::OnFilePrint)
  26. ON_COMMAND(ID_FILE_PRINT_DIRECT, CRecordView::OnFilePrint)
  27. ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRecordView::OnFilePrintPreview)
  28. END_MESSAGE_MAP()
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CMyView construction/destruction
  31. CMyView::CMyView()
  32. : CRecordView(CMyView::IDD)
  33. {
  34. //{{AFX_DATA_INIT(CMyView)
  35. m_pSet = NULL;
  36. m_oledtGZSJ = COleDateTime::GetCurrentTime();
  37. //}}AFX_DATA_INIT
  38. // TODO: add construction code here
  39. }
  40. CMyView::~CMyView()
  41. {
  42. }
  43. void CMyView::DoDataExchange(CDataExchange* pDX)
  44. {
  45. CRecordView::DoDataExchange(pDX);
  46. //{{AFX_DATA_MAP(CMyView)
  47. if(pDX->m_bSaveAndValidate==FALSE)
  48. m_oledtGZSJ=m_pSet->m_GZSJ;
  49. DDX_FieldText(pDX, IDC_EDITJBGZ, m_pSet->m_JBGZ, m_pSet);
  50. DDX_FieldText(pDX, IDC_EDITJL, m_pSet->m_JL, m_pSet);
  51. DDX_FieldText(pDX, IDC_EDITSZBM, m_pSet->m_SZBM, m_pSet);
  52. DDX_FieldText(pDX, IDC_EDITZC, m_pSet->m_ZC, m_pSet);
  53. DDX_FieldText(pDX, IDC_EDITZGBH, m_pSet->m_GZBH, m_pSet);
  54. DDX_FieldText(pDX, IDC_EDITZGLL, m_pSet->m_ZGLL, m_pSet);
  55. DDX_FieldText(pDX, IDC_EDITZGXB, m_pSet->m_ZGXB, m_pSet);
  56. DDX_FieldText(pDX, IDC_EDITZGXM, m_pSet->m_ZGXM, m_pSet);
  57. DDX_Text(pDX, IDC_EDITGZTIM, m_oledtGZSJ);
  58. //}}AFX_DATA_MAP
  59. if(pDX->m_bSaveAndValidate==true)
  60. m_pSet->m_GZSJ=m_oledtGZSJ;
  61. }
  62. BOOL CMyView::PreCreateWindow(CREATESTRUCT& cs)
  63. {
  64. // TODO: Modify the Window class or styles here by modifying
  65. //  the CREATESTRUCT cs
  66. return CRecordView::PreCreateWindow(cs);
  67. }
  68. void CMyView::OnInitialUpdate()
  69. {
  70. m_pSet = &GetDocument()->m_mySet;
  71. CRecordView::OnInitialUpdate();
  72. GetParentFrame()->RecalcLayout();
  73. ResizeParentToFit();
  74. }
  75. /////////////////////////////////////////////////////////////////////////////
  76. // CMyView printing
  77. BOOL CMyView::OnPreparePrinting(CPrintInfo* pInfo)
  78. {
  79. // default preparation
  80. return DoPreparePrinting(pInfo);
  81. }
  82. void CMyView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  83. {
  84. // TODO: add extra initialization before printing
  85. }
  86. void CMyView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  87. {
  88. // TODO: add cleanup after printing
  89. }
  90. /////////////////////////////////////////////////////////////////////////////
  91. // CMyView diagnostics
  92. #ifdef _DEBUG
  93. void CMyView::AssertValid() const
  94. {
  95. CRecordView::AssertValid();
  96. }
  97. void CMyView::Dump(CDumpContext& dc) const
  98. {
  99. CRecordView::Dump(dc);
  100. }
  101. CMyDoc* CMyView::GetDocument() // non-debug version is inline
  102. {
  103. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMyDoc)));
  104. return (CMyDoc*)m_pDocument;
  105. }
  106. #endif //_DEBUG
  107. /////////////////////////////////////////////////////////////////////////////
  108. // CMyView database support
  109. CRecordset* CMyView::OnGetRecordset()
  110. {
  111. return m_pSet;
  112. }
  113. /////////////////////////////////////////////////////////////////////////////
  114. // CMyView message handlers
  115. void CMyView::OnAddreco() 
  116. {
  117. // TODO: Add your control notification handler code here
  118. m_pSet->AddNew();
  119. UpdateData(FALSE);
  120. }
  121. void CMyView::OnRecodele() 
  122. {
  123. // TODO: Add your control notification handler code here
  124. m_pSet->Delete();
  125.     m_pSet->MoveNext();
  126. if(m_pSet->IsEOF())
  127. m_pSet->MoveLast();
  128. if(m_pSet->IsBOF())
  129. m_pSet->SetFieldNull(NULL);
  130. UpdateData(FALSE);
  131. }
  132. void CMyView::OnSortreco() 
  133. {
  134. // TODO: Add your control notification handler code here
  135. CDlgQuery Dlgquery;
  136.     Dlgquery.DoModal();
  137. CString value;
  138. if(Dlgquery.DoModal()==IDOK)
  139. {
  140. value="职工编号=+"+Dlgquery.m_query+"";
  141. m_pSet->m_strFilter=value;
  142. m_pSet->Requery();
  143. UpdateData(FALSE);
  144. }
  145. }
  146. void CMyView::OnFilterreco() 
  147. {
  148. // TODO: Add your control notification handler code here
  149. m_pSet->m_strSort="职工编号";
  150. m_pSet->Requery();
  151.     UpdateData(FALSE);
  152. }