home *** CD-ROM | disk | FTP | other *** search
- // EmployeeView.cpp : implementation of the CEmployeeView class
- //
-
- #include "stdafx.h"
- #include "Employee.h"
-
- #include "EmployeePaySet.h"
- #include "EmployeePersonalSet.h"
- #include "EmployeeDoc.h"
- #include "EmployeeView.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CEmployeeView
-
- IMPLEMENT_DYNCREATE(CEmployeeView, CDaoRecordView)
-
- BEGIN_MESSAGE_MAP(CEmployeeView, CDaoRecordView)
- //{{AFX_MSG_MAP(CEmployeeView)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG_MAP
- // Standard printing commands
- ON_COMMAND(ID_FILE_PRINT, CDaoRecordView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_DIRECT, CDaoRecordView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_PREVIEW, CDaoRecordView::OnFilePrintPreview)
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CEmployeeView construction/destruction
-
- CEmployeeView::CEmployeeView()
- : CDaoRecordView(CEmployeeView::IDD)
- {
- //{{AFX_DATA_INIT(CEmployeeView)
- m_pSet = NULL;
- //}}AFX_DATA_INIT
- // TODO: add construction code here
-
- }
-
- CEmployeeView::~CEmployeeView()
- {
- }
-
- void CEmployeeView::DoDataExchange(CDataExchange* pDX)
- {
- CDaoRecordView::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CEmployeeView)
- DDX_FieldText(pDX, IDC_FNAME, m_pSet->m_First_Name, m_pSet);
- DDX_FieldText(pDX, IDC_LNAME, m_pSet->m_Last_Name, m_pSet);
- DDX_FieldText(pDX, IDC_EMP_NO, m_pSet->m_Employee_Number, m_pSet);
- DDX_FieldText(pDX, IDC_DEPT, m_pSet->m_Department__, m_pSet);
- DDX_FieldText(pDX, IDC_PAY_TYPE, m_pSet->m_Employee_Pay_Type, m_pSet);
- DDX_FieldText(pDX, IDC_HOUR_RATE, m_pSet->m_Hourly_Rate, m_pSet);
- //}}AFX_DATA_MAP
-
- // Make sure this dataset pointer has been setup before trying
- // to access it.
- if(m_pEmplInfoSet != NULL)
- {
- DDX_FieldText(pDX, IDC_BIRTH, m_pEmplInfoSet->m_Birthdate, m_pEmplInfoSet);
- DDX_FieldText(pDX, IDC_MARITAL_STATUS, m_pEmplInfoSet->m_Sex___Marital_Status, m_pEmplInfoSet);
- DDX_FieldText(pDX, IDC_HEIGHT, m_pEmplInfoSet->m_Height, m_pEmplInfoSet);
- DDX_FieldText(pDX, IDC_WEIGHT, m_pEmplInfoSet->m_Weight, m_pEmplInfoSet);
- }
-
- }
-
- BOOL CEmployeeView::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
-
- return CDaoRecordView::PreCreateWindow(cs);
- }
-
- void CEmployeeView::OnInitialUpdate()
- {
- m_pSet = GetDocument()->GetEmployeePaySet();
- m_pEmplInfoSet = GetDocument()->GetEmployeeInfoSet();
-
- CDaoRecordView::OnInitialUpdate();
-
- //resize the window
- GetParentFrame()->RecalcLayout();
- ResizeParentToFit(FALSE);
-
- //set the parameter for the info query
- m_pEmplInfoSet->m_EmployeeNumberParam = m_pSet->m_Employee_Number;
-
- //open the Info record set
- try
- {
- m_pEmplInfoSet->Open();
- }
- catch (CDaoException* e)
- {
- AfxMessageBox(e->m_pErrorInfo->m_strDescription);
- e->Delete();
- return;
- }
-
- UpdateData(FALSE);
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CEmployeeView printing
-
- BOOL CEmployeeView::OnPreparePrinting(CPrintInfo* pInfo)
- {
- // default preparation
- return DoPreparePrinting(pInfo);
- }
-
- void CEmployeeView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add extra initialization before printing
- }
-
- void CEmployeeView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add cleanup after printing
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CEmployeeView diagnostics
-
- #ifdef _DEBUG
- void CEmployeeView::AssertValid() const
- {
- CDaoRecordView::AssertValid();
- }
-
- void CEmployeeView::Dump(CDumpContext& dc) const
- {
- CDaoRecordView::Dump(dc);
- }
-
- CEmployeeDoc* CEmployeeView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEmployeeDoc)));
- return (CEmployeeDoc*)m_pDocument;
- }
- #endif //_DEBUG
-
- /////////////////////////////////////////////////////////////////////////////
- // CEmployeeView database support
- CDaoRecordset* CEmployeeView::OnGetRecordset()
- {
- return m_pSet;
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CEmployeeView message handlers
- BOOL CEmployeeView::OnMove(UINT nIDMoveCommand)
- {
- CDaoRecordView::OnMove(nIDMoveCommand);
-
- //set the parameter for the info query
- m_pEmplInfoSet->m_EmployeeNumberParam = m_pSet->m_Employee_Number;
-
- //do the secondary query
- m_pEmplInfoSet->Requery();
-
- UpdateData(FALSE);
-
- return TRUE;
- }
-
-