📄 setpaydlg.cpp
字号:
// SetPayDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Server.h"
#include "SetPayDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSetPayDlg dialog
CSetPayDlg::CSetPayDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSetPayDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSetPayDlg)
m_strLafternoon = _T("");
m_strLallnight = _T("");
m_strLmorning = _T("");
m_strNafternoon = _T("");
m_strNmorning = _T("");
m_strNallnight = _T("");
m_strMiniCell = _T("");
m_strMiniSecond = _T("");
//}}AFX_DATA_INIT
}
CSetPayDlg::~CSetPayDlg()
{
}
void CSetPayDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSetPayDlg)
DDX_Control(pDX, IDC_DATETIME_ALLNIGHT2, m_CtrlAllnight_end);
DDX_Control(pDX, IDC_DATETIME_ALLNIGHT1, m_CtrlAllnight_start);
DDX_Control(pDX, IDC_DATETIME_AFTERNOON2, m_CtrlAfternoon_end);
DDX_Control(pDX, IDC_DATETIME_AFTERNOON1, m_CtrlAfternoon_start);
DDX_Control(pDX, IDC_DATETIME_MORNING2, m_CtrlMorning_end);
DDX_Control(pDX, IDC_DATETIME_MORNING1, m_CtrlMorning_start);
DDX_Control(pDX, IDC_MINISECOND_SPIN, m_MiniSecondSpin);
DDX_Control(pDX, IDC_MINICELL_SPIN, m_MiniCellSpin);
DDX_Text(pDX, IDC_LEAGUER_AFTERNOON, m_strLafternoon);
DDX_Text(pDX, IDC_LEAGUER_ALLNIGHT, m_strLallnight);
DDX_Text(pDX, IDC_LEAGUER_MORNING, m_strLmorning);
DDX_Text(pDX, IDC_NORMAL_AFTERNOON, m_strNafternoon);
DDX_Text(pDX, IDC_NORMAL_MORNING, m_strNmorning);
DDX_Text(pDX, IDC_NORMAL_ALLNIGHT, m_strNallnight);
DDX_Text(pDX, IDC_MINICELL_EDIT, m_strMiniCell);
DDX_Text(pDX, IDC_MINISECOND_EDIT, m_strMiniSecond);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSetPayDlg, CDialog)
//{{AFX_MSG_MAP(CSetPayDlg)
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSetPayDlg message handlers
void CSetPayDlg::CreateSpinCtrl()
{
UDACCEL accel;
accel.nSec = 2;
accel.nInc = 5;
CWnd* pEditMiniCell = GetDlgItem(IDC_MINICELL_EDIT);
CWnd* pEditMiniSecond = GetDlgItem(IDC_MINISECOND_EDIT);
m_MiniCellSpin.SetRange(5,30);
m_MiniCellSpin.SetBuddy(pEditMiniCell);
m_MiniSecondSpin.SetRange(0,10);
m_MiniSecondSpin.SetBuddy(pEditMiniSecond);
TCHAR buf1[32];
TCHAR buf2[32];
int pos1 = m_MiniCellSpin.GetPos();
int pos2 = m_MiniSecondSpin.GetPos();
wsprintf(buf1, _T("%d"), pos1);
wsprintf(buf2, _T("%d"), pos2);
CWnd* pWnd1 = m_MiniCellSpin.GetBuddy();
CWnd* pWnd2 = m_MiniSecondSpin.GetBuddy();
if(pWnd1 != NULL)
pWnd1->SetWindowText(buf1);
if(pWnd2 != NULL)
pWnd2->SetWindowText(buf2);
m_MiniCellSpin.SetAccel(1,&accel);
}
BOOL CSetPayDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CMenu* pSysMenu = GetSystemMenu(FALSE);
pSysMenu->ModifyMenu(SC_CLOSE,MF_BYCOMMAND | MF_GRAYED );
CString str;
DaoRecord.Open();
if(DaoRecord.GetRecordCount() != 0)
{
DaoRecord.MoveFirst();
str.Format("%.1f",DaoRecord.m_Normal_Morning);
this->m_strNmorning = str;
str.Format("%.1f",DaoRecord.m_Normal_Afternoon);
this->m_strNafternoon = str;
str.Format("%.1f",DaoRecord.m_Normal_Allnight);
this->m_strNallnight = str;
str.Format("%.1f",DaoRecord.m_Leaguer_Morning);
this->m_strLmorning = str;
str.Format("%.1f",DaoRecord.m_Leaguer_Afternoon);
this->m_strLafternoon = str;
str.Format("%.1f",DaoRecord.m_Leaguer_Allnight);
this->m_strLallnight = str;
str.Format("%d",DaoRecord.m_MiniCell);
this->m_strMiniCell = str;
str.Format("%d",DaoRecord.m_MiniSecond);
this->m_strMiniSecond = str;
}
m_CtrlMorning_start.SetTime(&time_morning_start);
m_CtrlMorning_end.SetTime(&time_morning_end);
m_CtrlAfternoon_start.SetTime(&time_afternoon_start);
m_CtrlAfternoon_end.SetTime(&time_afternoon_end);
m_CtrlAllnight_start.SetTime(&time_all_night_start);
m_CtrlAllnight_end.SetTime(&time_all_night_end);
UpdateData(false);
CreateSpinCtrl();
DaoRecord.Close();
return TRUE;
}
HBRUSH CSetPayDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor == CTLCOLOR_STATIC)
{
CString ss;
pWnd->GetWindowText(ss);
if(memcmp(ss,"普通用户",8) != 0 && memcmp(ss,"会员用户",8) != 0 && memcmp(ss,"时间段设置",10) != 0)
{
pDC->SetTextColor(RGB(0,0,238));
}
else
pDC->SetTextColor(RGB(250,0,238));
}
if(nCtlColor ==CTLCOLOR_EDIT)
{
//pDC->SetBkColor(RGB(0,0,0));
pDC->SetTextColor(RGB(250,0,238));
}
return hbr;
}
void CSetPayDlg::OnOK()
{
UpdateData(true);
DaoRecord.Open();
DaoRecord.MoveFirst();
DaoRecord.Edit();
DaoRecord.m_Normal_Morning = (float)atof(this->m_strNmorning);
DaoRecord.m_Normal_Afternoon = (float)atof(this->m_strNafternoon);
DaoRecord.m_Normal_Allnight = (float)atof(this->m_strNallnight);
DaoRecord.m_Leaguer_Morning = (float)atof(this->m_strLmorning);
DaoRecord.m_Leaguer_Afternoon = (float)atof(this->m_strLafternoon);
DaoRecord.m_Leaguer_Allnight = (float)atof(this->m_strLallnight);
DaoRecord.m_MiniCell = atoi(this->m_strMiniCell);
DaoRecord.m_MiniSecond = atoi(this->m_strMiniSecond);
CTime time;
this->m_CtrlMorning_start.GetTime(time);
DaoRecord.m_Morning1.SetTime(time.GetHour(),time.GetMinute(),time.GetSecond());
this->m_CtrlMorning_end.GetTime(time);
DaoRecord.m_Morning2.SetTime(time.GetHour(),time.GetMinute(),time.GetSecond());
this->m_CtrlAfternoon_start.GetTime(time);
DaoRecord.m_Afternoon1.SetTime(time.GetHour(),time.GetMinute(),time.GetSecond());
this->m_CtrlAfternoon_end.GetTime(time);
DaoRecord.m_Afternoon2.SetTime(time.GetHour(),time.GetMinute(),time.GetSecond());
this->m_CtrlAllnight_start.GetTime(time);
DaoRecord.m_Allnight1.SetTime(time.GetHour(),time.GetMinute(),time.GetSecond());
this->m_CtrlAllnight_end.GetTime(time);
DaoRecord.m_Allnight2.SetTime(time.GetHour(),time.GetMinute(),time.GetSecond());
DaoRecord.Update();
DaoRecord.Close();
AfxMessageBox("重新启动服务器,设置才有效!");
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -