商店管理系统源代码(十四)

来源:互联网 发布:淘宝店铺招牌链接 编辑:程序博客网 时间:2024/04/30 16:42
#if !defined(AFX_DIAGLOG_H__A29D4DC7_72D6_4211_88E0_448F2C34E77F__INCLUDED_)#define AFX_DIAGLOG_H__A29D4DC7_72D6_4211_88E0_448F2C34E77F__INCLUDED_#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000// DiagLog.h : header file///////////////////////////////////////////////////////////////////////////////// CDiagLog dialogclass CDiagLog : public CDialog{// Constructionpublic:CDiagLog(CWnd* pParent = NULL);   // standard constructorCString strCode, strName;// Dialog Data//{{AFX_DATA(CDiagLog)enum { IDD = IDD_LOG };CStringm_strUserCode;CStringm_strPasswd;//}}AFX_DATA// Overrides// ClassWizard generated virtual function overrides//{{AFX_VIRTUAL(CDiagLog)protected:virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support//}}AFX_VIRTUAL// Implementationprotected:// Generated message map functions//{{AFX_MSG(CDiagLog)virtual BOOL OnInitDialog();afx_msg void OnLog();//}}AFX_MSGDECLARE_MESSAGE_MAP()};//{{AFX_INSERT_LOCATION}}// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_DIAGLOG_H__A29D4DC7_72D6_4211_88E0_448F2C34E77F__INCLUDED_)// DiagLog.cpp : implementation file//#include "stdafx.h"#include "SalesManagementSystem.h"#include "DiagLog.h"#include "ADOConn.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// CDiagLog dialogCDiagLog::CDiagLog(CWnd* pParent /*=NULL*/): CDialog(CDiagLog::IDD, pParent){//{{AFX_DATA_INIT(CDiagLog)m_strUserCode = _T("");m_strPasswd = _T("");//}}AFX_DATA_INIT}void CDiagLog::DoDataExchange(CDataExchange* pDX){CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CDiagLog)DDX_Text(pDX, IDC_USER, m_strUserCode);DDX_Text(pDX, IDC_PASSWD, m_strPasswd);//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CDiagLog, CDialog)//{{AFX_MSG_MAP(CDiagLog)ON_BN_CLICKED(IDC_LOG, OnLog)//}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CDiagLog message handlersBOOL CDiagLog::OnInitDialog() {CDialog::OnInitDialog();// TODO: Add extra initialization hereGetDlgItem(IDC_USER)->SetWindowText("songdongquan");//用户名 GetDlgItem(IDC_PASSWD)->SetWindowText("123456");//密码return TRUE;  // return TRUE unless you set the focus to a control              // EXCEPTION: OCX Property Pages should return FALSE}void CDiagLog::OnLog() {// TODO: Add your control notification handler code hereUpdateData(TRUE);CADOConn adoMain;CString strSQL;strSQL = "SELECT * FROM UserInfo WHERE UserInfo.code = '";strSQL = strSQL + m_strUserCode + "' AND UserInfo.passwd = '";strSQL = strSQL + m_strPasswd + "'";adoMain.Open(strSQL);if (!adoMain.adoEOF()){strCode = adoMain.GetItemString(0);strName = adoMain.GetItemString(1);CDialog::OnOK();}else{MessageBox("密码或用户ID错误!", "提示", MB_OK + MB_ICONWARNING);}adoMain.ExitConnect();}

原创粉丝点击