人事管理系统View.cpp
上传用户:z_mail1980
上传日期:2007-06-01
资源大小:647k
文件大小:4k
- // 人事管理系统View.cpp : implementation of the CMyView class
- //
- #include "stdafx.h"
- #include "人事管理系统.h"
- #include "人事管理系统Set.h"
- #include "人事管理系统Doc.h"
- #include "人事管理系统View.h"
- #include "DlgQuery.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CMyView
- IMPLEMENT_DYNCREATE(CMyView, CRecordView)
- BEGIN_MESSAGE_MAP(CMyView, CRecordView)
- //{{AFX_MSG_MAP(CMyView)
- ON_BN_CLICKED(IDC_ADDRECO, OnAddreco)
- ON_BN_CLICKED(IDC_RECODELE, OnRecodele)
- ON_BN_CLICKED(IDC_SORTRECO, OnSortreco)
- ON_BN_CLICKED(IDC_FILTERRECO, OnFilterreco)
- //}}AFX_MSG_MAP
- // Standard printing commands
- ON_COMMAND(ID_FILE_PRINT, CRecordView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_DIRECT, CRecordView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRecordView::OnFilePrintPreview)
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CMyView construction/destruction
- CMyView::CMyView()
- : CRecordView(CMyView::IDD)
- {
- //{{AFX_DATA_INIT(CMyView)
- m_pSet = NULL;
- m_oledtGZSJ = COleDateTime::GetCurrentTime();
- //}}AFX_DATA_INIT
- // TODO: add construction code here
- }
- CMyView::~CMyView()
- {
- }
- void CMyView::DoDataExchange(CDataExchange* pDX)
- {
- CRecordView::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CMyView)
- if(pDX->m_bSaveAndValidate==FALSE)
- m_oledtGZSJ=m_pSet->m_GZSJ;
- DDX_FieldText(pDX, IDC_EDITJBGZ, m_pSet->m_JBGZ, m_pSet);
- DDX_FieldText(pDX, IDC_EDITJL, m_pSet->m_JL, m_pSet);
- DDX_FieldText(pDX, IDC_EDITSZBM, m_pSet->m_SZBM, m_pSet);
- DDX_FieldText(pDX, IDC_EDITZC, m_pSet->m_ZC, m_pSet);
- DDX_FieldText(pDX, IDC_EDITZGBH, m_pSet->m_GZBH, m_pSet);
- DDX_FieldText(pDX, IDC_EDITZGLL, m_pSet->m_ZGLL, m_pSet);
- DDX_FieldText(pDX, IDC_EDITZGXB, m_pSet->m_ZGXB, m_pSet);
- DDX_FieldText(pDX, IDC_EDITZGXM, m_pSet->m_ZGXM, m_pSet);
- DDX_Text(pDX, IDC_EDITGZTIM, m_oledtGZSJ);
- //}}AFX_DATA_MAP
- if(pDX->m_bSaveAndValidate==true)
- m_pSet->m_GZSJ=m_oledtGZSJ;
- }
- BOOL CMyView::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- return CRecordView::PreCreateWindow(cs);
- }
- void CMyView::OnInitialUpdate()
- {
- m_pSet = &GetDocument()->m_mySet;
- CRecordView::OnInitialUpdate();
- GetParentFrame()->RecalcLayout();
- ResizeParentToFit();
- }
- /////////////////////////////////////////////////////////////////////////////
- // CMyView printing
- BOOL CMyView::OnPreparePrinting(CPrintInfo* pInfo)
- {
- // default preparation
- return DoPreparePrinting(pInfo);
- }
- void CMyView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add extra initialization before printing
- }
- void CMyView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add cleanup after printing
- }
- /////////////////////////////////////////////////////////////////////////////
- // CMyView diagnostics
- #ifdef _DEBUG
- void CMyView::AssertValid() const
- {
- CRecordView::AssertValid();
- }
- void CMyView::Dump(CDumpContext& dc) const
- {
- CRecordView::Dump(dc);
- }
- CMyDoc* CMyView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMyDoc)));
- return (CMyDoc*)m_pDocument;
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CMyView database support
- CRecordset* CMyView::OnGetRecordset()
- {
- return m_pSet;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CMyView message handlers
- void CMyView::OnAddreco()
- {
- // TODO: Add your control notification handler code here
- m_pSet->AddNew();
- UpdateData(FALSE);
- }
- void CMyView::OnRecodele()
- {
- // TODO: Add your control notification handler code here
- m_pSet->Delete();
- m_pSet->MoveNext();
- if(m_pSet->IsEOF())
- m_pSet->MoveLast();
- if(m_pSet->IsBOF())
- m_pSet->SetFieldNull(NULL);
- UpdateData(FALSE);
- }
- void CMyView::OnSortreco()
- {
- // TODO: Add your control notification handler code here
- CDlgQuery Dlgquery;
- Dlgquery.DoModal();
- CString value;
- if(Dlgquery.DoModal()==IDOK)
- {
- value="职工编号=+"+Dlgquery.m_query+"";
- m_pSet->m_strFilter=value;
- m_pSet->Requery();
- UpdateData(FALSE);
- }
- }
- void CMyView::OnFilterreco()
- {
- // TODO: Add your control notification handler code here
- m_pSet->m_strSort="职工编号";
- m_pSet->Requery();
- UpdateData(FALSE);
- }