?? passdlg.cpp
字號:
// PassDlg.cpp : implementation file
//
#include "stdafx.h"
#include "工資管理系統.h"
#include "PassDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPassDlg dialog
CPassDlg::CPassDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPassDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPassDlg)
m_oldpass = _T("");
m_newpass = _T("");
m_new = _T("");
//}}AFX_DATA_INIT
}
void CPassDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPassDlg)
DDX_Text(pDX, IDC_OLDPASS_EDIT, m_oldpass);
DDX_Text(pDX, IDC_NEWPASS_EDIT, m_newpass);
DDX_Text(pDX, IDC_NEW_EDIT, m_new);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPassDlg, CDialog)
//{{AFX_MSG_MAP(CPassDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPassDlg message handlers
void CPassDlg::OnOK()
{
rst.CreateInstance(__uuidof(Recordset));
rst=cnn->Execute("admin",NULL,adCmdTable);
rst->MoveFirst();
UpdateData(TRUE);
if(m_oldpass==(char*)(_bstr_t)rst->GetCollect((_bstr_t)"Password"))
{
if(m_newpass=="")
AfxMessageBox("新密碼不能為空!");
else
{
if(m_newpass==m_new)
{
_bstr_t bstrValue=m_newpass;
CString sSQL,sUsername,sPassword;
sUsername="湖州忠勝";
sPassword=m_newpass;
sSQL.Format("UPDATE admin SET Password='%s' WHERE Username='%s'",sPassword,sUsername);
rst=cnn->Execute((_bstr_t)sSQL,NULL,adCmdText);
if(MessageBox("密碼修改成功!請記住您的新密碼是:"+m_newpass,"系統提示",MB_ICONQUESTION|MB_OKCANCEL)==1)
CDialog::OnOK();
}
else
{
AfxMessageBox("您兩次輸入的新密碼不一致,請重新輸一遍!");
m_new="";
UpdateData(FALSE);
}
}
}
else
{
AfxMessageBox("您輸入的管理員密碼有誤,請重新輸入!");
m_oldpass="";
UpdateData(FALSE);
}
}
BOOL CPassDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CString str;
m_StatusBar.EnableAutomation();
m_StatusBar.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,ID_STATUSBAR);
int width[]={165,350};
m_StatusBar.SetParts(2, &width[0]);
m_StatusBar.SetText(str,0,0);
m_StatusBar.SetText("程序設計:吳曉寧",0,0);
m_StatusBar.SetText("歡迎使用工資管理系統 V1.2版",0,1);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -