📄 userdata.cpp
字号:
// UserData.cpp : implementation file
//
#include "stdafx.h"
#include "ddDlqServer.h"
#include "UserData.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CUserData dialog
extern CDdDlqServerApp theApp;
CUserData::CUserData(CWnd* pParent /*=NULL*/)
: CDialog(CUserData::IDD, pParent)
{
//{{AFX_DATA_INIT(CUserData)
m_userName = _T("");
m_userPwd = _T("");
m_userIP = _T("");
m_userKaiDay = 0;
m_userKaiMonth = 0;
m_userKaiYear = 0;
m_userMonthDao = 0;
m_userDayDao = 0;
m_userYearDao = 0;
m_userAdv = _T("");
m_userCurServer = _T("");
//}}AFX_DATA_INIT
}
void CUserData::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CUserData)
DDX_Control(pDX, USER_COMBO_SELSERV, m_cbSelServ);
DDX_Control(pDX, USER_LIST_SERVER, m_lstServer);
DDX_Text(pDX, USER_EDIT_NAME, m_userName);
DDX_Text(pDX, USER_EDIT_PWD, m_userPwd);
DDX_Text(pDX, USER_EDIT_IP, m_userIP);
DDX_Text(pDX, USER_EDIT_KAIDAY, m_userKaiDay);
DDV_MinMaxInt(pDX, m_userKaiDay, 1, 31);
DDX_Text(pDX, USER_EDIT_KAIMONTH, m_userKaiMonth);
DDV_MinMaxInt(pDX, m_userKaiMonth, 1, 12);
DDX_Text(pDX, USER_EDIT_KAIYEAR, m_userKaiYear);
DDV_MinMaxInt(pDX, m_userKaiYear, 2008, 3008);
DDX_Text(pDX, USER_EDIT_MONTHDAO, m_userMonthDao);
DDV_MinMaxInt(pDX, m_userMonthDao, 1, 12);
DDX_Text(pDX, USER_EDIT_DAYDAO, m_userDayDao);
DDV_MinMaxInt(pDX, m_userDayDao, 1, 31);
DDX_Text(pDX, USER_EDIT_YEARDAO, m_userYearDao);
DDV_MinMaxInt(pDX, m_userYearDao, 2008, 3008);
DDX_Text(pDX, USER_EDIT_AD, m_userAdv);
DDX_Text(pDX, USER_EDIT_CURR, m_userCurServer);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CUserData, CDialog)
//{{AFX_MSG_MAP(CUserData)
ON_BN_CLICKED(BTN_EXIT_USERDATA, OnExitUserData)
ON_BN_CLICKED(BTN_OK_USERDATA, OnOkUserData)
ON_BN_CLICKED(BTN_USER_KAICURDATE, OnUserKaicurdate)
ON_BN_CLICKED(BTN_USER_ADDSERVER, OnUserAddserver)
ON_BN_CLICKED(BTN_USER_DELSERVER, OnUserDelserver)
ON_BN_CLICKED(BTN_USER_CURDATEDAO, OnUserCurdatedao)
ON_EN_CHANGE(USER_EDIT_AD, OnChangeEditAd)
ON_EN_CHANGE(USER_EDIT_CURR, OnChangeEditCurrent)
ON_EN_CHANGE(USER_EDIT_DAYDAO, OnChangeEditDayDao)
ON_EN_CHANGE(USER_EDIT_IP, OnChangeEditIp)
ON_EN_CHANGE(USER_EDIT_KAIDAY, OnChangeEditKaiDay)
ON_EN_CHANGE(USER_EDIT_KAIMONTH, OnChangeEditKaiMonth)
ON_EN_CHANGE(USER_EDIT_KAIYEAR, OnChangeEditKaiYear)
ON_EN_CHANGE(USER_EDIT_MONTHDAO, OnChangeEditMonthDao)
ON_EN_CHANGE(USER_EDIT_NAME, OnChangeEditName)
ON_EN_CHANGE(USER_EDIT_PWD, OnChangeEditPwd)
ON_EN_CHANGE(USER_EDIT_YEARDAO, OnChangeEditYearDao)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUserData message handlers
void CUserData::OnExitUserData()
{
CDialog::OnCancel();
}
void CUserData::OnOkUserData()
{
UpdateData(TRUE);
userInfoData.uiUseName = m_userName;
userInfoData.uiPassword = m_userPwd;
userInfoData.uiUserIP = m_userIP;
userInfoData.uiServerDateStart = theApp.glFormatDate(m_userKaiYear, m_userKaiMonth, m_userKaiDay);
userInfoData.uiServerDateEnd = theApp.glFormatDate(m_userYearDao, m_userMonthDao, m_userDayDao);
userInfoData.uiServerCurrent = m_userCurServer;
userInfoData.uiAdv = m_userAdv;
CDialog::OnOK();
}
void CUserData::OnCancel()
{
// CDialog::OnCancel();
}
void CUserData::OnOK()
{
// CDialog::OnOK();
}
BOOL CUserData::OnInitDialog()
{
CDialog::OnInitDialog();
m_userName = userInfoData.uiUseName;
m_userPwd = userInfoData.uiPassword;
m_userIP = userInfoData.uiUserIP;
int iy, im, id;
theApp.glUnFormatDate(userInfoData.uiServerDateStart, &iy, &im, &id);
m_userKaiYear = iy;
m_userKaiMonth = im;
m_userKaiDay = id;
theApp.glUnFormatDate(userInfoData.uiServerDateEnd, &iy, &im, &id);
m_userYearDao = iy;
m_userMonthDao = im;
m_userDayDao = id;
m_userCurServer = userInfoData.uiServerCurrent;
m_userAdv = userInfoData.uiAdv;
UpdateData(FALSE);
m_lstServer.SetColumnHeader(_T("可用服务器, 180"));
m_lstServer.SetGridLines(TRUE); // 显示网格
m_lstServer.SetEditable(FALSE); // 不允许编辑各个项目
m_lstServer.SortItems(0, FALSE); // 不排序
int i, irows = -1;
POSITION pos;
CString str;
irows = theApp.uiServerList.GetCount();
for(i=0; i<irows; i++)
{
const int IDX = m_lstServer.InsertItem(0, _T(""));
pos = theApp.uiServerList.FindIndex(i);
str = theApp.uiServerList.GetAt(pos);
m_lstServer.SetItemText(IDX, 0, str);
}
irows = -1;
irows = theApp.gServerList.GetCount();
m_cbSelServ.ResetContent();
for(i=0; i<irows; i++)
{
pos = theApp.gServerList.FindIndex(i);
str = theApp.gServerList.GetAt(pos);
m_cbSelServ.AddString(str);
}
if(irows > 0)
m_cbSelServ.SetCurSel(0);
if(bEdit)
SetWindowText("编辑用户数据");
else
SetWindowText("添加用户数据");
return TRUE;
}
void CUserData::OnUserKaicurdate()
{
// 得到当天的日期
SYSTEMTIME St;
GetLocalTime(&St);
m_userKaiYear = St.wYear;
m_userKaiMonth = St.wMonth;
m_userKaiDay = St.wDay;
UpdateData(FALSE);
}
void CUserData::OnUserAddserver()
{
// TODO: Add your control notification handler code here
}
void CUserData::OnUserDelserver()
{
// TODO: Add your control notification handler code here
}
void CUserData::OnUserCurdatedao()
{
// 得到当天的日期
SYSTEMTIME St;
GetLocalTime(&St);
m_userYearDao = St.wYear;
m_userMonthDao = St.wMonth;
m_userDayDao = St.wDay;
UpdateData(FALSE);
}
void CUserData::OnChangeEditName()
{
UpdateData(TRUE);
userInfoData.uiUseName = m_userName;
}
void CUserData::OnChangeEditPwd()
{
UpdateData(TRUE);
userInfoData.uiPassword = m_userPwd;
}
void CUserData::OnChangeEditIp()
{
UpdateData(TRUE);
userInfoData.uiUserIP = m_userIP;
}
void CUserData::OnChangeEditKaiYear()
{
UpdateData(TRUE);
userInfoData.uiServerDateStart =
theApp.glFormatDate(m_userKaiYear, m_userKaiMonth, m_userKaiDay);
}
void CUserData::OnChangeEditKaiMonth()
{
UpdateData(TRUE);
userInfoData.uiServerDateStart =
theApp.glFormatDate(m_userKaiYear, m_userKaiMonth, m_userKaiDay);
}
void CUserData::OnChangeEditKaiDay()
{
UpdateData(TRUE);
userInfoData.uiServerDateStart =
theApp.glFormatDate(m_userKaiYear, m_userKaiMonth, m_userKaiDay);
}
void CUserData::OnChangeEditYearDao()
{
UpdateData(TRUE);
userInfoData.uiServerDateEnd =
theApp.glFormatDate(m_userYearDao, m_userMonthDao, m_userDayDao);
}
void CUserData::OnChangeEditMonthDao()
{
UpdateData(TRUE);
userInfoData.uiServerDateEnd =
theApp.glFormatDate(m_userYearDao, m_userMonthDao, m_userDayDao);
}
void CUserData::OnChangeEditDayDao()
{
UpdateData(TRUE);
userInfoData.uiServerDateEnd =
theApp.glFormatDate(m_userYearDao, m_userMonthDao, m_userDayDao);
}
void CUserData::OnChangeEditCurrent()
{
UpdateData(TRUE);
userInfoData.uiServerCurrent = m_userCurServer;
}
void CUserData::OnChangeEditAd()
{
UpdateData(TRUE);
userInfoData.uiAdv = m_userAdv;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -