【VC开源代码栏目提醒】:网学会员鉴于大家对VC开源代码十分关注,论文会员在此为大家搜集整理了“CustomerEditDlg.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();
}
上一篇:
CustomerDLG.cpp
下一篇:
4种小菜缓解孕妈咪不适