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

📄 yonghuedit.cpp

📁 图书管理系统可进行查询,添加,修改,等操作 用树行结构为图书馆进行图书分类
💻 CPP
字号:
// yonghuedit.cpp : implementation file
//

#include "stdafx.h"
#include "图书管理.h"
#include "yonghuedit.h"
#include"Users.h"

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

/////////////////////////////////////////////////////////////////////////////
// yonghuedit dialog


yonghuedit::yonghuedit(CWnd* pParent /*=NULL*/)
	: CDialog(yonghuedit::IDD, pParent)
{
	//{{AFX_DATA_INIT(yonghuedit)
	m_password = _T("");
	m_name = _T("");
	//}}AFX_DATA_INIT
}


void yonghuedit::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(yonghuedit)
	DDX_Control(pDX, IDC_COMBO1, m_leixing);
	DDX_Text(pDX, IDC_EDIT2, m_password);
	DDX_Text(pDX, IDC_EDIT1, m_name);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(yonghuedit, CDialog)
	//{{AFX_MSG_MAP(yonghuedit)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)

	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// yonghuedit message handlers

void yonghuedit::OnOK() 
{
	// TODO: Add extra validation here
		UpdateData(TRUE);

	CUsers usr;
	usr.SetUserName(m_name);
	usr.SetPwd(m_password);
	usr.SetUser_type(m_leixing.GetCurSel()+1);
	
	if (usr.HaveName(m_name) == 1) //如果存在当前用户
	{
		MessageBox("当前用户已存在,请选择其他用户名");
		return;
	}
	//插入用户记录
	usr.sql_insert();

	CDialog::OnOK();
}


void yonghuedit::OnButton1() 
{
	// TODO: Add your control notification handler code here
    UpdateData(TRUE);
	CUsers usr;
	usr.SetPwd(m_password);
	usr.SetUser_type(m_leixing.GetCurSel()+1);

	usr.sql_updatePwd(m_name);
	CDialog::OnOK();
}



BOOL yonghuedit::OnInitDialog() 
{
	CDialog::OnInitDialog();
	if(leixing=="1")
		m_leixing.SetCurSel(0);
	else
		m_leixing.SetCurSel(1);
	
	// TODO: Add extra initialization here
	
	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 + -