Files

91 lines
1.8 KiB
C++

// Schedule.cpp : implementation file
//
#include "stdafx.h"
#include "sp.h"
#include "Schedule.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSchedule dialog
CSchedule::CSchedule(CWnd* pParent /*=NULL*/)
: CDialog(CSchedule::IDD, pParent)
{
//{{AFX_DATA_INIT(CSchedule)
//}}AFX_DATA_INIT
m_pApp= (CSpApp*)AfxGetApp();
rs=new GZRset("Error: Schedule screen");
rs->SetConnect(m_pApp->strConnectString);
}
CSchedule::~CSchedule()
{
if(rs!=NULL)
delete rs;
}
void CSchedule::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSchedule)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSchedule, CDialog)
//{{AFX_MSG_MAP(CSchedule)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSchedule message handlers
BOOL CSchedule::OnInitDialog()
{
CDialog::OnInitDialog();
ShowWindow(SW_MAXIMIZE);
m_sched.SetTitleText("Technician");
//m_sched.SetRulerDays(TRUE);
FillTechList();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSchedule::FillTechList()
{
CString q;
CString strData;
short x;
long lData;
q="SELECT users.id, [last] & \", \" & [first] AS fullname FROM users "
"WHERE (((users.id)<>1) AND ((users.tech)=True) AND ((users.active)=True)) "
"ORDER BY users.last;";
rs->QueryReadOnly(q);
if(rs==NULL)
{
AfxMessageBox("There are no active technicians!");
return;
}
do {
rs->FetchField("fullname",&strData);
m_sched.AddItem(strData);
x=m_sched.GetListIndex();
}while(rs->MoveForward());
}