home *** CD-ROM | disk | FTP | other *** search
- // JoinSet.cpp : implementation of the CJoinSet class
- //
-
- #include "stdafx.h"
- #include "Join.h"
- #include "JoinSet.h"
-
- #include <io.h> // for _findfirst
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CJoinSet implementation
-
- IMPLEMENT_DYNAMIC(CJoinSet, CDaoRecordset)
-
- CJoinSet::CJoinSet(CDaoDatabase* pdb)
- : CDaoRecordset(pdb)
- {
- //{{AFX_FIELD_INIT(CJoinSet)
- m_Employee_Number = 0;
- m_Last_Name = _T("");
- m_First_Name = _T("");
- m_Department__ = 0;
- m_Employee_Pay_Type = 0;
- m_Hours = 0.0;
- m_Hourly_Rate = 0.0;
- m_Weekly_Salary = 0.0;
- m_Sales_Bonus_Rate = 0.0;
- m_Weekly_Sales = 0.0;
- m_Employee_Number2 = 0;
- m_Sex___Marital_Status = 0;
- m_Height = 0.0;
- m_Weight = 0.0;
- m_nFields = 15;
- //}}AFX_FIELD_INIT
- m_nDefaultType = dbOpenDynaset;
-
- m_strFilter = "[Employee Pay Table].[Employee Number] = "
- "[Employee Personal Info Table].[Employee Number]";
-
- m_strSort = "[Employee Pay Table].[Last Name], "
- "[Employee Pay Table].[First Name]";
- }
-
- CString CJoinSet::GetDefaultDBName()
- {
- // Search for the database 2 levels up...
- struct _finddata_t c_file;
- long hFile;
- CString fname = "..\\..\\personnel.mdb";
-
- hFile = _findfirst(fname, &c_file);
-
- if( -1 != hFile )
- return _T(fname);
-
- // and then one level up.
- fname = "..\\personnel.mdb";
-
- hFile = _findfirst(fname, &c_file);
-
- if( -1 != hFile )
- return _T(fname);
-
- return _T("");
- }
-
-
- CString CJoinSet::GetDefaultSQL()
- {
- return _T("[Employee Pay Table],[Employee Personal Info Table]");
- }
-
- void CJoinSet::DoFieldExchange(CDaoFieldExchange* pFX)
- {
- //{{AFX_FIELD_MAP(CJoinSet)
- pFX->SetFieldType(CDaoFieldExchange::outputColumn);
- DFX_Long(pFX, _T("[Employee Pay Table].[Employee Number]"), m_Employee_Number);
- DFX_Text(pFX, _T("[Last Name]"), m_Last_Name);
- DFX_Text(pFX, _T("[First Name]"), m_First_Name);
- DFX_Short(pFX, _T("[Department #]"), m_Department__);
- DFX_Short(pFX, _T("[Employee Pay Type]"), m_Employee_Pay_Type);
- DFX_Double(pFX, _T("[Hours]"), m_Hours);
- DFX_Double(pFX, _T("[Hourly Rate]"), m_Hourly_Rate);
- DFX_Double(pFX, _T("[Weekly Salary]"), m_Weekly_Salary);
- DFX_Double(pFX, _T("[Sales Bonus Rate]"), m_Sales_Bonus_Rate);
- DFX_Double(pFX, _T("[Weekly Sales]"), m_Weekly_Sales);
- DFX_Long(pFX, _T("[Employee Personal Info Table].[Employee Number]"), m_Employee_Number2);
- DFX_DateTime(pFX, _T("[Birthdate]"), m_Birthdate);
- DFX_Byte(pFX, _T("[Sex & Marital Status]"), m_Sex___Marital_Status);
- DFX_Double(pFX, _T("[Height]"), m_Height);
- DFX_Double(pFX, _T("[Weight]"), m_Weight);
- //}}AFX_FIELD_MAP
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CJoinSet diagnostics
-
- #ifdef _DEBUG
- void CJoinSet::AssertValid() const
- {
- CDaoRecordset::AssertValid();
- }
-
- void CJoinSet::Dump(CDumpContext& dc) const
- {
- CDaoRecordset::Dump(dc);
- }
- #endif //_DEBUG
-