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

📄 registrationeditdlg.cpp

📁 VC++做的汽车维修管理系统,很有参考价值的,附上源码与说明文档.
💻 CPP
字号:
// RegistrationEditDlg.cpp : implementation file
//

#include "stdafx.h"
#include "CarService.h"
#include "RegistrationEditDlg.h"
#include "Registration.h"

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

/////////////////////////////////////////////////////////////////////////////
// CRegistrationEditDlg dialog


CRegistrationEditDlg::CRegistrationEditDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CRegistrationEditDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CRegistrationEditDlg)
	m_CreateDate = _T("");
	m_CustName = _T("");
	m_CarNo = _T("");
	m_CarType = _T("");
	m_Color = _T("");
	m_EngNo = _T("");
	m_fDate = _T("");
	m_iCost = 0.0f;
	m_mCost = 0.0f;
	m_Memo = _T("");
	m_Miles = 0;
	m_oCost = 0.0f;
	m_Registor = _T("");
	m_Man = _T("");
	m_Sum = 0.0f;
	m_Tel = _T("");
	//}}AFX_DATA_INIT
}


void CRegistrationEditDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CRegistrationEditDlg)
	DDX_Text(pDX, IDC_CREATEDATE_EDIT, m_CreateDate);
	DDX_Text(pDX, IDC_CUSTNAME_EDIT, m_CustName);
	DDX_Text(pDX, IDC_CARNO_EDIT, m_CarNo);
	DDX_Text(pDX, IDC_CARTYPE_EDIT, m_CarType);
	DDX_Text(pDX, IDC_COLOR_EDIT, m_Color);
	DDX_Text(pDX, IDC_ENGNO_EDIT, m_EngNo);
	DDX_Text(pDX, IDC_FINISHDATE_EDIT, m_fDate);
	DDX_Text(pDX, IDC_ICOST_EDIT, m_iCost);
	DDX_Text(pDX, IDC_MCOST_EDIT, m_mCost);
	DDX_Text(pDX, IDC_MEMO_EDIT, m_Memo);
	DDX_Text(pDX, IDC_MILES_EDIT, m_Miles);
	DDX_Text(pDX, IDC_OCOST_EDIT, m_oCost);
	DDX_Text(pDX, IDC_REGISTOR_EDIT, m_Registor);
	DDX_Text(pDX, IDC_REPAIRMAN_EDIT, m_Man);
	DDX_Text(pDX, IDC_SUM_EDIT, m_Sum);
	DDX_Text(pDX, IDC_TEL_EDIT, m_Tel);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CRegistrationEditDlg, CDialog)
	//{{AFX_MSG_MAP(CRegistrationEditDlg)
	ON_EN_CHANGE(IDC_ICOST_EDIT, OnChangeIcostEdit)
	ON_EN_CHANGE(IDC_MCOST_EDIT, OnChangeMcostEdit)
	ON_EN_CHANGE(IDC_OCOST_EDIT, OnChangeOcostEdit)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CRegistrationEditDlg message handlers

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

	// 有效性判断
	if(m_CustName == "")
	{
		MessageBox("请输入客户名称");
		return;
	}
	if(m_Tel == "")
	{
		MessageBox("请输入客户联系电话");
		return;
	}
	if(m_CarNo == "")
	{
		MessageBox("请输入车牌号");
		return;
	}
	if(m_CarType == "")
	{
		MessageBox("请输入汽车型号");
		return;
	}
	//将用户输入的数据赋值到对象cur中,为更新数据库做准备
	CRegistration reg;
	reg.CreateDate = m_CreateDate;
	reg.CustName = m_CustName;
	reg.Tel = m_Tel;
	reg.CarNo = m_CarNo;
	reg.CarType = m_CarType;
	reg.CarColor = m_Color;
	reg.EngineNo = m_EngNo;
	reg.DriveMiles = m_Miles;
	reg.RepairMan = m_Man;
	reg.Registor = m_Registor;
	reg.FinishDate = m_fDate;
	reg.ICost = m_iCost;
	reg.MCost = m_mCost;
	reg.OCost = m_oCost;
	reg.Memo = m_Memo;

	// 判断此登记信息是否存在
	if(cRegId == "")
		reg.SqlInsert();
	else
		reg.SqlUpdate(cRegId);
	CDialog::OnOK();
}

void CRegistrationEditDlg::OnChangeIcostEdit() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_Sum = m_iCost + m_mCost + m_oCost;
	UpdateData(FALSE);	
}

void CRegistrationEditDlg::OnChangeMcostEdit() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_Sum = m_iCost + m_mCost + m_oCost;
	UpdateData(FALSE);	
}

void CRegistrationEditDlg::OnChangeOcostEdit() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_Sum = m_iCost + m_mCost + m_oCost;
	UpdateData(FALSE);	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -