📄 xinjyhdlg.cpp
字号:
// Xinjyhdlg.cpp : implementation file
//
#include "stdafx.h"
#include "GZGLXT.h"
#include "Xinjyhdlg.h"
#include "Czyxxb.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CXinjyhdlg dialog
CXinjyhdlg::CXinjyhdlg(CWnd* pParent /*=NULL*/)
: CDialog(CXinjyhdlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CXinjyhdlg)
m_name = _T("");
m_pwd = _T("");
m_pwd1 = _T("");
//}}AFX_DATA_INIT
m_hIcon = AfxGetApp()->LoadIcon(IDI_XINJYHICON);
}
void CXinjyhdlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CXinjyhdlg)
DDX_Control(pDX, IDC_COMBO1, m_jb);
DDX_Text(pDX, IDC_EDIT1, m_name);
DDX_Text(pDX, IDC_EDIT2, m_pwd);
DDX_Text(pDX, IDC_EDIT3, m_pwd1);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CXinjyhdlg, CDialog)
//{{AFX_MSG_MAP(CXinjyhdlg)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CXinjyhdlg message handlers
void CXinjyhdlg::OnOK()
{
// TODO: Add extra validation here
UpdateData(true);
if(m_name=="")
{
MessageBox("请输入用户名","工资管理系统");
return;
}
CString jb;
m_jb.GetWindowText(jb);
if(jb=="")
{
MessageBox("级别不能为空","工资管理系统");
return;
}
if(m_pwd=="")
{
MessageBox("请输入密码","工资管理系统");
return;
}
if(m_pwd1=="")
{
MessageBox("请确认密码","工资管理系统");
return;
}
if(m_pwd!=m_pwd1)
{
MessageBox("两次密码不同","工资管理系统");
return;
}
CCzyxxb xxb;
if(xxb.Havename(m_name)==1)
{
MessageBox("用户以存在,请重新输入","工资管理系统");
return;
}
xxb.SetCzyName(m_name);
xxb.SetPwd(m_pwd);
m_jb.GetLBText(m_jb.GetCurSel(),strjb);
if(strjb=="系统管理员")
strjb="1";
else
strjb="0";
xxb.SetCzyjb(strjb);
xxb.sql_insert();
CDialog::OnOK();
}
BOOL CXinjyhdlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
SetIcon(m_hIcon, TRUE);
m_jb.AddString("系统管理员");
m_jb.AddString("普通管理员");
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CXinjyhdlg::OnButton1()
{
// TODO: Add your control notification handler code here
UpdateData(true);
if(MessageBox("是否删除当前记录","请确认",MB_YESNO)==IDYES)
{
CCzyxxb xxb;
xxb.sql_delete(m_name);
MessageBox("用户删除成功!","工资管理系统");
}
CDialog::OnOK();
}
BOOL CXinjyhdlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message==WM_KEYDOWN && pMsg->wParam==13)
pMsg->wParam=9;
return CDialog::PreTranslateMessage(pMsg);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -