⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 passwordsetdlg.cpp

📁 这是采用mfc编写的工资管理系统
💻 CPP
字号:
// PasswordSetDlg.cpp : implementation file
//

#include "stdafx.h"
#include "salarymanagement.h"
#include "PasswordSetDlg.h"
#include "USkin.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPasswordSetDlg dialog


CPasswordSetDlg::CPasswordSetDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CPasswordSetDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPasswordSetDlg)
	m_confirmSimple = _T("");
	m_newSimple = _T("");
	m_originSimple = _T("");
	//}}AFX_DATA_INIT
	m_hIcon=AfxGetApp()->LoadIcon(IDI_PASSWORD);
	m_ado.OnInitADOConn();
}

CPasswordSetDlg::~CPasswordSetDlg()
{
	m_ado.ExitConnect();
}

void CPasswordSetDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPasswordSetDlg)
	DDX_Text(pDX, IDC_NEW2, m_confirmSimple);
	DDX_Text(pDX, IDC_NEW1, m_newSimple);
	DDX_Text(pDX, IDC_ORIGIN1, m_originSimple);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPasswordSetDlg, CDialog)
	//{{AFX_MSG_MAP(CPasswordSetDlg)
	ON_WM_DESTROY()
	ON_EN_CHANGE(IDC_ORIGIN1, OnChangeOrigin1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPasswordSetDlg message handlers
extern CSalaryManagementApp theApp;

void CPasswordSetDlg::OnDestroy() 
{	
	USkinRemoveSkin();
		
	theApp.m_pMainWnd->SetWindowPos(&wndTop,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW);	

	CDialog::OnDestroy();
}

BOOL CPasswordSetDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	CString str=theApp.m_CurrentDirectory+"\\Skin\\绿色界面.u3";
	USkinLoadSkin(str);
	
	CenterWindow(CWnd::GetDesktopWindow());

	SetIcon(m_hIcon,TRUE);
	SetIcon(m_hIcon,FALSE);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CPasswordSetDlg::OnOK() 
{
	UpdateData();
	CString sql="";
	extern CSalaryManagementApp theApp;
	
	//检查确认密码和修改密码是否一致
	if(strcmp(m_newSimple,m_confirmSimple)!=0)
	{
		AfxMessageBox("确认密码错误,请重新输入!!!");
		return;
	}
	//在登陆表中查找相关信息
	else
		sql.Format("Select * From Login Where UserID='%s' And Password='%s'",
		theApp.m_userID,m_originSimple);
	try{
		_RecordsetPtr recordset;
		recordset=m_ado.GetRecordSet(sql);
		if(recordset->adoEOF)
		{
			AfxMessageBox("密码错误,请重新输入!!!");
			return;
		}
		
		recordset->PutCollect("Password",(_variant_t)m_newSimple);
	}
	catch(_com_error e)
	{
		AfxMessageBox(e.Description());
	}

	CDialog::OnOK();
}


void CPasswordSetDlg::OnChangeOrigin1() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -