📄 aa_ch.cpp
字号:
// aa_ch.cpp : implementation file
//
#include "stdafx.h"
#include "课程设计.h"
#include "aa_ch.h"
#include "film.h"
#include "rage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// Caa_ch dialog
Caa_ch::Caa_ch(CWnd* pParent /*=NULL*/)
: CDialog(Caa_ch::IDD, pParent)
{
//{{AFX_DATA_INIT(Caa_ch)
m_id = 0;
m_name = _T("");
m_author = _T("");
m_rage = 0;
//}}AFX_DATA_INIT
}
void Caa_ch::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(Caa_ch)
DDX_Control(pDX, IDC_TYPE, m_type);
DDX_Control(pDX, IDC_STATE, m_state);
DDX_Text(pDX, IDC_EDIT1, m_id);
DDX_Text(pDX, IDC_EDIT2, m_name);
DDX_Text(pDX, IDC_EDIT3, m_author);
DDX_Text(pDX, IDC_EDIT4, m_rage);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(Caa_ch, CDialog)
//{{AFX_MSG_MAP(Caa_ch)
ON_BN_CLICKED(IDC_ADD, OnAdd)
ON_BN_CLICKED(IDC_CHANGE, OnChange)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Caa_ch message handlers
BOOL Caa_ch::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
//SetIcon(m_hIcon, TRUE); // Set big icon
//SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
m_type.AddString("CD");
m_type.AddString("DCD");
m_type.AddString("VCD");
//m_state.AddString("是");
m_state.AddString("否");
return TRUE; // return TRUE unless you set the focus to a control
}
void Caa_ch::OnAdd()
{
// TODO: Add your control notification handler code here
UpdateData(true);
if(m_id==0)
AfxMessageBox("编号不能为零");
else{
CString msg;
Cfilm film;
Crage rage;
rage.id=m_id;
rage.rage=m_rage;
film.author=m_author;
film.id=m_id;
if(CB_ERR ==m_type.GetCurSel())
AfxMessageBox("你必须选择他类型");
else
{
m_type.GetLBText(m_type.GetCurSel(),msg);
film.type=msg;
if(CB_ERR ==m_state.GetCurSel())
AfxMessageBox("你必须选择他的状态");
else
{
m_state.GetLBText(m_state.GetCurSel(),msg);
if(msg=="是")
film.lend=true;
else film.lend=false;
film.name=m_name;
film.sql_insert();
rage.sql_insert();
}
}
}
OnOK() ;
}
void Caa_ch::OnChange()
{
// TODO: Add your control notification handler code here
UpdateData(true);
if(m_id==0)
AfxMessageBox("编号不能为零");
else{
CString msg;
Cfilm film;
Crage rage;
rage.id=m_id;
rage.rage=m_rage;
film.author=m_author;
film.id=m_id;
if(CB_ERR ==m_type.GetCurSel())
AfxMessageBox("你必须选择他类型");
else
{
m_type.GetLBText(m_type.GetCurSel(),msg);
film.type=msg;
if(CB_ERR ==m_state.GetCurSel())
AfxMessageBox("你必须选择他的状态");
else
{
CString str;
m_state.GetLBText(m_state.GetCurSel(),msg);
if(msg=="是")
film.lend=true;
else film.lend=false;
str.Format("%d",m_id);
film.name=m_name;
film.sql_delete(str);
film.sql_insert();
rage.sql_delete(str);
rage.sql_insert();
}
}
}
OnOK() ;
}
void Caa_ch::OnOK()
{
// TODO: Add extra validation here
m_id = 0;
m_name = _T("");
m_author = _T("");
m_rage = 0;
UpdateData(false);
//CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -