📄 remoterecordplanconfig.cpp
字号:
// RemoteRecordPlanConfig.cpp : implementation file
//
#include "stdafx.h"
#include "newclient.h"
#include "RemoteRecordPlanConfig.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRemoteRecordPlanConfig dialog
CRemoteRecordPlanConfig::CRemoteRecordPlanConfig(CWnd* pParent /*=NULL*/)
: CDialog(CRemoteRecordPlanConfig::IDD, pParent)
{
//{{AFX_DATA_INIT(CRemoteRecordPlanConfig)
m_AllDayRecord = FALSE;
m_iHour11 = 0;
m_iHour12 = 0;
m_iHour21 = 0;
m_iHour22 = 0;
m_iHour31 = 0;
m_iHour32 = 0;
m_iHour41 = 0;
m_iHour42 = 0;
m_iMin11 = 0;
m_iMin21 = 0;
m_iMin12 = 0;
m_iMin22 = 0;
m_iMin31 = 0;
m_iMin32 = 0;
m_iMin41 = 0;
m_iMin42 = 0;
//}}AFX_DATA_INIT
}
void CRemoteRecordPlanConfig::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CRemoteRecordPlanConfig)
DDX_Control(pDX, IDC_TIMERECTYPE4, m_RecordType4Ctrl);
DDX_Control(pDX, IDC_TIMERECTYPE3, m_RecordType3Ctrl);
DDX_Control(pDX, IDC_TIMERECTYPE2, m_RecordType2Ctrl);
DDX_Control(pDX, IDC_TIMERECTYPE1, m_RecordType1Ctrl);
DDX_Control(pDX, IDC_COPYWEEKDAY, m_CopyDayCtrl);
DDX_Control(pDX, IDC_COMBOWEEKDAY, m_WeekDayCtrl);
DDX_Control(pDX, IDC_ALLDAYTYPE, m_AllDayTypeCtrl);
DDX_Check(pDX, IDC_CHECALLDAY, m_AllDayRecord);
DDX_Text(pDX, IDC_EDITHOUR011, m_iHour11);
DDX_Text(pDX, IDC_EDITHOUR012, m_iHour12);
DDX_Text(pDX, IDC_EDITHOUR021, m_iHour21);
DDX_Text(pDX, IDC_EDITHOUR022, m_iHour22);
DDX_Text(pDX, IDC_EDITHOUR031, m_iHour31);
DDX_Text(pDX, IDC_EDITHOUR032, m_iHour32);
DDX_Text(pDX, IDC_EDITHOUR041, m_iHour41);
DDX_Text(pDX, IDC_EDITHOUR042, m_iHour42);
DDX_Text(pDX, IDC_EDITMIN011, m_iMin11);
DDX_Text(pDX, IDC_EDITMIN021, m_iMin21);
DDX_Text(pDX, IDC_EDITMIN012, m_iMin12);
DDX_Text(pDX, IDC_EDITMIN022, m_iMin22);
DDX_Text(pDX, IDC_EDITMIN031, m_iMin31);
DDX_Text(pDX, IDC_EDITMIN032, m_iMin32);
DDX_Text(pDX, IDC_EDITMIN041, m_iMin41);
DDX_Text(pDX, IDC_EDITMIN042, m_iMin42);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CRemoteRecordPlanConfig, CDialog)
//{{AFX_MSG_MAP(CRemoteRecordPlanConfig)
ON_BN_CLICKED(IDC_BUTRECCOPY, OnButreccopy)
ON_BN_CLICKED(IDC_CHECALLDAY, OnChecallday)
ON_CBN_SELCHANGE(IDC_COMBOWEEKDAY, OnSelchangeComboweekday)
ON_CBN_SELCHANGE(IDC_COPYWEEKDAY, OnSelchangeCopyweekday)
ON_BN_CLICKED(IDREMRECOK, OnRemrecok)
ON_BN_CLICKED(IDEXIT, OnExit)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRemoteRecordPlanConfig message handlers
BOOL CRemoteRecordPlanConfig::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_nDate = 0;
m_WeekDayCtrl.SetCurSel(m_nDate);
m_nCopyDate = 0;
m_CopyDayCtrl.SetCurSel(m_nCopyDate);
m_AllDayRecord = serverrecordplan->struRecAllDay[m_nDate].wAllDayRecord;
m_AllDayTypeCtrl.SetCurSel(serverrecordplan->struRecAllDay[m_nDate].byRecordType);
m_RecordType1Ctrl.SetCurSel(serverrecordplan->struRecordSched[m_nDate][0].byRecordType);
m_RecordType2Ctrl.SetCurSel(serverrecordplan->struRecordSched[m_nDate][1].byRecordType);
m_RecordType3Ctrl.SetCurSel(serverrecordplan->struRecordSched[m_nDate][2].byRecordType);
m_RecordType4Ctrl.SetCurSel(serverrecordplan->struRecordSched[m_nDate][3].byRecordType);
m_iHour11 = serverrecordplan->struRecordSched[m_nDate][0].struRecordTime.byStartHour;
m_iHour12 = serverrecordplan->struRecordSched[m_nDate][0].struRecordTime.byStopHour;
m_iHour21 = serverrecordplan->struRecordSched[m_nDate][1].struRecordTime.byStartHour;
m_iHour22 = serverrecordplan->struRecordSched[m_nDate][1].struRecordTime.byStopHour;
m_iHour31 = serverrecordplan->struRecordSched[m_nDate][2].struRecordTime.byStartHour;
m_iHour32 = serverrecordplan->struRecordSched[m_nDate][2].struRecordTime.byStopHour;
m_iHour41 = serverrecordplan->struRecordSched[m_nDate][3].struRecordTime.byStartHour;
m_iHour42 = serverrecordplan->struRecordSched[m_nDate][3].struRecordTime.byStopHour;
m_iMin11 = serverrecordplan->struRecordSched[m_nDate][0].struRecordTime.byStartMin;
m_iMin12 = serverrecordplan->struRecordSched[m_nDate][0].struRecordTime.byStopMin;
m_iMin21 = serverrecordplan->struRecordSched[m_nDate][1].struRecordTime.byStartMin;
m_iMin22 = serverrecordplan->struRecordSched[m_nDate][1].struRecordTime.byStopMin;
m_iMin31 = serverrecordplan->struRecordSched[m_nDate][2].struRecordTime.byStartMin;
m_iMin32 = serverrecordplan->struRecordSched[m_nDate][2].struRecordTime.byStopMin;
m_iMin41 = serverrecordplan->struRecordSched[m_nDate][3].struRecordTime.byStartMin;
m_iMin42 = serverrecordplan->struRecordSched[m_nDate][3].struRecordTime.byStopMin;
EnableControl(!m_AllDayRecord);
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CRemoteRecordPlanConfig::OnButreccopy()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_nCopyDate = m_CopyDayCtrl.GetCurSel() - 1;
if(!TimeTest())
return;
if(m_nCopyDate != -1)
{
serverrecordplan->struRecAllDay[m_nCopyDate].wAllDayRecord = m_AllDayRecord;
serverrecordplan->struRecAllDay[m_nCopyDate].byRecordType = m_AllDayTypeCtrl.GetCurSel();
serverrecordplan->struRecordSched[m_nCopyDate][0].byRecordType = m_RecordType1Ctrl.GetCurSel();
serverrecordplan->struRecordSched[m_nCopyDate][1].byRecordType = m_RecordType2Ctrl.GetCurSel();
serverrecordplan->struRecordSched[m_nCopyDate][2].byRecordType = m_RecordType3Ctrl.GetCurSel();
serverrecordplan->struRecordSched[m_nCopyDate][3].byRecordType = m_RecordType4Ctrl.GetCurSel();
serverrecordplan->struRecordSched[m_nCopyDate][0].struRecordTime.byStartHour = m_iHour11;
serverrecordplan->struRecordSched[m_nCopyDate][0].struRecordTime.byStopHour = m_iHour12;
serverrecordplan->struRecordSched[m_nCopyDate][1].struRecordTime.byStartHour = m_iHour21;
serverrecordplan->struRecordSched[m_nCopyDate][1].struRecordTime.byStopHour = m_iHour22;
serverrecordplan->struRecordSched[m_nCopyDate][2].struRecordTime.byStartHour = m_iHour31;
serverrecordplan->struRecordSched[m_nCopyDate][2].struRecordTime.byStopHour = m_iHour32;
serverrecordplan->struRecordSched[m_nCopyDate][3].struRecordTime.byStartHour = m_iHour41;
serverrecordplan->struRecordSched[m_nCopyDate][3].struRecordTime.byStopHour = m_iHour42;
serverrecordplan->struRecordSched[m_nCopyDate][0].struRecordTime.byStartMin = m_iMin11;
serverrecordplan->struRecordSched[m_nCopyDate][0].struRecordTime.byStopMin = m_iMin12;
serverrecordplan->struRecordSched[m_nCopyDate][1].struRecordTime.byStartMin = m_iMin21;
serverrecordplan->struRecordSched[m_nCopyDate][1].struRecordTime.byStopMin = m_iMin22;
serverrecordplan->struRecordSched[m_nCopyDate][2].struRecordTime.byStartMin = m_iMin31;
serverrecordplan->struRecordSched[m_nCopyDate][2].struRecordTime.byStopMin = m_iMin32;
serverrecordplan->struRecordSched[m_nCopyDate][3].struRecordTime.byStartMin = m_iMin41;
serverrecordplan->struRecordSched[m_nCopyDate][3].struRecordTime.byStopMin = m_iMin42;
}
else
{
for(int i = 0;i < MAX_DAYS;i++)
{
serverrecordplan->struRecAllDay[i].wAllDayRecord = m_AllDayRecord;
serverrecordplan->struRecAllDay[i].byRecordType = m_AllDayTypeCtrl.GetCurSel();
serverrecordplan->struRecordSched[i][0].byRecordType = m_RecordType1Ctrl.GetCurSel();
serverrecordplan->struRecordSched[i][1].byRecordType = m_RecordType2Ctrl.GetCurSel();
serverrecordplan->struRecordSched[i][2].byRecordType = m_RecordType3Ctrl.GetCurSel();
serverrecordplan->struRecordSched[i][3].byRecordType = m_RecordType4Ctrl.GetCurSel();
serverrecordplan->struRecordSched[i][0].struRecordTime.byStartHour = m_iHour11;
serverrecordplan->struRecordSched[i][0].struRecordTime.byStopHour = m_iHour12;
serverrecordplan->struRecordSched[i][1].struRecordTime.byStartHour = m_iHour21;
serverrecordplan->struRecordSched[i][1].struRecordTime.byStopHour = m_iHour22;
serverrecordplan->struRecordSched[i][2].struRecordTime.byStartHour = m_iHour31;
serverrecordplan->struRecordSched[i][2].struRecordTime.byStopHour = m_iHour32;
serverrecordplan->struRecordSched[i][3].struRecordTime.byStartHour = m_iHour41;
serverrecordplan->struRecordSched[i][3].struRecordTime.byStopHour = m_iHour42;
serverrecordplan->struRecordSched[i][0].struRecordTime.byStartMin = m_iMin11;
serverrecordplan->struRecordSched[i][0].struRecordTime.byStopMin = m_iMin12;
serverrecordplan->struRecordSched[i][1].struRecordTime.byStartMin = m_iMin21;
serverrecordplan->struRecordSched[i][1].struRecordTime.byStopMin = m_iMin22;
serverrecordplan->struRecordSched[i][2].struRecordTime.byStartMin = m_iMin31;
serverrecordplan->struRecordSched[i][2].struRecordTime.byStopMin = m_iMin32;
serverrecordplan->struRecordSched[i][3].struRecordTime.byStartMin = m_iMin41;
serverrecordplan->struRecordSched[i][3].struRecordTime.byStopMin = m_iMin42;
}
}
}
void CRemoteRecordPlanConfig::OnChecallday()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
EnableControl(!m_AllDayRecord);
}
BOOL CRemoteRecordPlanConfig::TimeTest()
{
int i,j;
CString sTemp;
CString sTime[4][2];
sTime[0][0].Format("%02d%02d",m_iHour11,m_iMin11);
sTime[0][1].Format("%02d%02d",m_iHour12,m_iMin12);
sTime[1][0].Format("%02d%02d",m_iHour21,m_iMin21);
sTime[1][1].Format("%02d%02d",m_iHour22,m_iMin22);
sTime[2][0].Format("%02d%02d",m_iHour31,m_iMin31);
sTime[2][1].Format("%02d%02d",m_iHour32,m_iMin32);
sTime[3][0].Format("%02d%02d",m_iHour41,m_iMin41);
sTime[3][1].Format("%02d%02d",m_iHour42,m_iMin42);
BOOL bvalid = TRUE;
for(i=0;i<4;i++)
{
if (!bvalid)
{
if((sTime[i][0]!="0000") || (sTime[i][1]!="0000"))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -