📄 costctr.cpp
字号:
// CostCtr.cpp : implementation file
//
#include "stdafx.h"
#include "SQL.h"
#include "CostCtr.h"
#include "CostNumber.h"
#include "Boss.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCostCtr dialog
CCostCtr::CCostCtr(CWnd* pParent /*=NULL*/)
: CDialog(CCostCtr::IDD, pParent)
{
//{{AFX_DATA_INIT(CCostCtr)
m_cother = _T("");
m_ccost = _T("");
m_cpno = _T("");
m_csno = _T("");
m_cname = _T("");
//}}AFX_DATA_INIT
}
void CCostCtr::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCostCtr)
DDX_Text(pDX, IDC_COTHER, m_cother);
DDX_Text(pDX, IDC_CCOST, m_ccost);
DDX_Text(pDX, IDC_CPNO, m_cpno);
DDX_Text(pDX, IDC_CSNO, m_csno);
DDX_Text(pDX, IDC_CNAME, m_cname);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCostCtr, CDialog)
//{{AFX_MSG_MAP(CCostCtr)
ON_BN_CLICKED(IDC_ADD, OnAdd)
ON_BN_CLICKED(IDC_DELETE, OnDelete)
ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCostCtr message handlers
void CCostCtr::OnAdd()
{
// TODO: Add your control notification handler code here
UpdateData(true);
CCostNumber m_costnumber(&m_db);
CString str;
str = "select * from CostNumber";
if (!m_costnumber.Open(CRecordset::dynaset,str)) {
AfxMessageBox("数据库打开失败!");
return;
}
m_costnumber.AddNew();
m_costnumber.m_Pno = m_cpno;
m_costnumber.m_Cname = m_cname;
m_costnumber.m_Cost = m_ccost;
m_costnumber.m_Cother = m_cother;
m_costnumber.m_Csno = m_csno;
m_costnumber.Update();
AfxMessageBox("修改成功!请退出!");
}
void CCostCtr::OnDelete()
{
// TODO: Add your control notification handler code here
UpdateData(true);
CCostNumber m_costnumber(&m_db);
CString str;
str.Format("select * from CostNumber where Pno = '%s'",m_cpno);
if (! m_costnumber.Open(CRecordset::dynaset,str)) {
AfxMessageBox("");
return;
}
m_costnumber.Delete();
m_costnumber.Close();
AfxMessageBox("修改成功!请退出!");
}
void CCostCtr::OnButton5()
{
// TODO: Add your control notification handler code here
UpdateData(true);
CCostNumber m_costnumber(&m_db);
CString str;
str.Format("select * from CostNumber where Pno = '%s'",m_cpno);
if (!m_costnumber.Open(CRecordset::dynaset,str)) {
AfxMessageBox("数据库打开失败!");
return;
}
m_costnumber.Edit();
m_costnumber.m_Pno = m_cpno;
if (m_cname.IsEmpty()) {
m_costnumber.m_Cname = m_cname;
}
if (m_ccost.IsEmpty()) {
m_costnumber.m_Cost = m_ccost;
}
if (m_cother.IsEmpty()) {
m_costnumber.m_Cother = m_cother;
}
if (m_csno.IsEmpty()) {
m_costnumber.m_Csno = m_csno;
}
m_costnumber.Update();
AfxMessageBox("修改成功!请退出!");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -