📄 zhuce.cpp
字号:
// Zhuce.cpp : implementation file
//
#include "stdafx.h"
#include "物业管理系统.h"
#include "Zhuce.h"
#include"Password.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CZhuce dialog
CZhuce::CZhuce(CWnd* pParent /*=NULL*/)
: CDialog(CZhuce::IDD, pParent)
{
//{{AFX_DATA_INIT(CZhuce)
m_nname = _T("");
m_npass = _T("");
m_npass1 = _T("");
//}}AFX_DATA_INIT
}
void CZhuce::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CZhuce)
DDX_Control(pDX, IDC_EDIT3, m_pass1);
DDX_Control(pDX, IDC_EDIT2, m_pass);
DDX_Control(pDX, IDC_EDIT1, m_name);
DDX_Text(pDX, IDC_EDIT1, m_nname);
DDX_Text(pDX, IDC_EDIT2, m_npass);
DDX_Text(pDX, IDC_EDIT3, m_npass1);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CZhuce, CDialog)
//{{AFX_MSG_MAP(CZhuce)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CZhuce message handlers
void CZhuce::OnButton1()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
if(m_nname.IsEmpty())
{
MessageBox("用户名不能为空!");
m_nname="";
m_npass="";
UpdateData(FALSE);
m_name.SetFocus();
return;
}
if(m_npass.IsEmpty())
{
MessageBox("密码不能为空!");
m_pass.SetFocus();
return ;
}
if(m_npass1.IsEmpty())
{
MessageBox("重置密码不能为空!");
m_pass1.SetFocus();
return ;
}
if(m_npass!=m_npass1)
{
MessageBox("两次密码不一致");
m_npass="";
m_npass1="";
UpdateData(FALSE);
return ;
}
CString strSQL;
CPassword recordset;
strSQL.Format("select * from password WHERE name='%s'",m_nname);
if(!recordset.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL))
{
MessageBox("打开数据失败!");
return ;
}
if(recordset.m_name!="")
{
MessageBox("用户名已经存在!请重新输入");
m_nname="";
m_npass="";
m_npass1="";
UpdateData(FALSE);
m_name.SetFocus();
return;
}
recordset.AddNew();
recordset.m_name=m_nname;
recordset.m_pass=m_npass;
recordset.Update();
recordset.Close();
MessageBox("注册成功!");
CDialog::OnCancel();
}
void CZhuce::OnButton3()
{
// TODO: Add your control notification handler code here
m_nname="";
m_npass="";
m_npass1="";
UpdateData(FALSE);
m_name.SetFocus();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -