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

📄 customereditdlg.cpp

📁 VC做的一个电脑报价管理系统,有源码和说明文档.
💻 CPP
字号:
// CustomerEditDlg.cpp : implementation file
//

#include "stdafx.h"
#include "QuoteManage.h"
#include "CustomerEditDlg.h"
#include "CustomerInfo.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCustomerEditDlg dialog


CCustomerEditDlg::CCustomerEditDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCustomerEditDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCustomerEditDlg)
	m_company = _T("");
	m_home = _T("");
	m_memo = _T("");
	m_mobile = _T("");
	m_name = _T("");
	//}}AFX_DATA_INIT
}


void CCustomerEditDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCustomerEditDlg)
	DDX_Control(pDX, IDC_SEX_COMBO, m_sex);
	DDX_Text(pDX, IDC_COMPANY_EDIT, m_company);
	DDX_Text(pDX, IDC_HOME_EDIT, m_home);
	DDX_Text(pDX, IDC_MEMO_EDIT, m_memo);
	DDX_Text(pDX, IDC_MOBILE_EDIT, m_mobile);
	DDX_Text(pDX, IDC_NAME_EDIT, m_name);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCustomerEditDlg, CDialog)
	//{{AFX_MSG_MAP(CCustomerEditDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCustomerEditDlg message handlers

BOOL CCustomerEditDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	// TODO: Add extra initialization here
	if (cId == "")
		m_sex.SetCurSel(0);
	else
		if (cSex == "男")
			m_sex.SetCurSel(0);
		else
			m_sex.SetCurSel(1);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}


// 单击确定按钮
void CCustomerEditDlg::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData(TRUE);

	//检查用户输入数据的有效性
	if (m_name == "")
	{
		MessageBox("请输入姓名","信息提示");
		return;
	}
	if(m_mobile == "")
	{
		MessageBox("请输入手机号","信息提示");
		return;
	}

	//将用户输入数据赋值到类CCustomerInfo变量中
	CCustomerInfo cus;
	cus.Name = m_name;				// 姓名
	//性别
	CString cSex;
	m_sex.GetLBText(m_sex.GetCurSel(), cSex);
	cus.Sex=cSex;
	cus.Company = m_company;		// 所在单位
	cus.Mobile = m_mobile;			// 手机
	cus.Home = m_home;				// 家庭电话
	cus.Memo = m_memo;				// 备注

	// 根据是插入还是修改,保存到数据库
	if (cId == "") //插入数据
		cus.SqlInsert();
	else
		cus.SqlUpdate(cId);

	CDialog::OnOK();
}

⌨️ 快捷键说明

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