📄 xiugaimimadlg.cpp
字号:
// xiugaimimaDlg.cpp : implementation file
//
#include "stdafx.h"
#include "pmz.h"
#include "xiugaimimaDlg.h"
#include "pmzDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// xiugaimimaDlg dialog
extern CString user_name;
xiugaimimaDlg::xiugaimimaDlg(CWnd* pParent /*=NULL*/)
: CDialog(xiugaimimaDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(xiugaimimaDlg)
m_oldmima = _T("");
m_newmima1 = _T("");
m_newmima2 = _T("");
//}}AFX_DATA_INIT
m_pdb=new CDatabase;
m_pdb->Open( NULL, FALSE, FALSE,mydb);
}
xiugaimimaDlg::~xiugaimimaDlg()
{m_pdb->Close();
delete m_pdb;
}
void xiugaimimaDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(xiugaimimaDlg)
DDX_Text(pDX, IDC_EDIT1, m_oldmima);
DDX_Text(pDX, IDC_EDIT2, m_newmima1);
DDX_Text(pDX, IDC_EDIT3, m_newmima2);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(xiugaimimaDlg, CDialog)
//{{AFX_MSG_MAP(xiugaimimaDlg)
ON_BN_CLICKED(IDC_BUTTON1, Onxiugaimima)
ON_BN_CLICKED(IDC_BUTTON2, Onquxiao)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// xiugaimimaDlg message handlers
void xiugaimimaDlg::Onxiugaimima()
{
UpdateData(TRUE);
m_oldmima.TrimLeft();
m_oldmima.TrimRight();
if( m_oldmima.GetLength()<1)
{
AfxMessageBox("旧密码不能为空!");
return;
}
m_newmima1.TrimLeft();
m_newmima1.TrimRight();
if( m_newmima1.GetLength()<1)
{
AfxMessageBox("新密码不能为空!");
return;
}
m_newmima2.TrimLeft();
m_newmima2.TrimRight();
if( m_newmima2.GetLength()<1)
{
AfxMessageBox("新密码不能为空!");
return;
}
if( m_newmima1!=m_newmima2)
{
AfxMessageBox("两次密码输入不一样,请重新输入!");
this->GetDlgItem(IDC_EDIT2)->SetWindowText("");
this->GetDlgItem(IDC_EDIT3)->SetWindowText("");
return;
}
CString str5="select * from S_info where S_no='"+user_name+"' ";
m_precordset=new S_infodb(m_pdb);
m_precordset->Open(S_infodb::snapshot,str5);
CString mima,name;
mima=m_precordset->m_S_mima;
name=m_precordset->m_S_name;
if( m_oldmima!=mima)
{
AfxMessageBox("旧密码输入错误!");
this->GetDlgItem(IDC_EDIT1)->SetWindowText("");
return;
}
AfxMessageBox(name+"同学,你的密码将被修改,继续吗?");
CString str,str0,str1,str2,str4;
str=user_name;
str0=m_oldmima;
str1=m_newmima1;
str2=m_newmima2;
m_precordset=new S_infodb(m_pdb);
str4="update S_info set S_mima='"+str1+"'where S_no='"+str+"' ";
m_pdb->ExecuteSQL(str4);
AfxMessageBox(name+"你的密码修改成功! 下次登录使用新密码");
delete m_precordset;
this->GetDlgItem(IDC_EDIT1)->SetWindowText("");
this->GetDlgItem(IDC_EDIT2)->SetWindowText("");
this->GetDlgItem(IDC_EDIT3)->SetWindowText("");
}
void xiugaimimaDlg::Onquxiao()
{
CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -