📄 membermanager.cpp
字号:
// MemberManager.cpp : implementation file
//
#include "stdafx.h"
#include "SuperMarket.h"
#include "MemberManager.h"
#include "ClientRegedit.h"
#include "ClientModify.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMemberManager dialog
CMemberManager::CMemberManager(CWnd* pParent /*=NULL*/)
: CDialog(CMemberManager::IDD, pParent)
{
//{{AFX_DATA_INIT(CMemberManager)
m_strShow = _T("");
m_List = _T("");
m_List1 = _T("");
//}}AFX_DATA_INIT
}
void CMemberManager::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMemberManager)
DDX_Text(pDX, IDC_STATICSHOW, m_strShow);
DDX_Text(pDX, IDC_STATICLIST, m_List);
DDX_Text(pDX, IDC_EDIT1, m_List1);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMemberManager, CDialog)
//{{AFX_MSG_MAP(CMemberManager)
ON_BN_CLICKED(IDC_MODIFY, OnModify)
ON_BN_CLICKED(IDC_SHOPPING, OnShopping)
ON_BN_CLICKED(IDC_COPYLIST, OnCopylist)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMemberManager message handlers
int CMemberManager::DoModal()
{
// TODO: Add your specialized code here and/or call the base class
m_strShow="您的用户ID:"+strID+" 用户密码:"+strPwd;
return CDialog::DoModal();
}
void CMemberManager::OnModify()
{
// TODO: Add your control notification handler code here
CClientRegedit myregedit;
m_pRecordset.CreateInstance(__uuidof(Recordset));
//***********************************************************
UpdateData(true);
myregedit.boolModify=true;
CString source,str;
_variant_t RecordsAffected,var;
source="SELECT * FROM Client ";
source+="WHERE Cid= ";
source+=strID;
try
{
m_pRecordset=theApp.m_pConnection->Execute(source.AllocSysString(),
&RecordsAffected,
adCmdText);
}
catch(_com_error *e)
{
AfxMessageBox(e->ErrorMessage());
}
//**************************************************************
m_pRecordset->MoveFirst();
// while(!m_pRecordset->adoEOF)
// {
var=m_pRecordset->GetCollect("Cid");
myregedit.m_intID =var.iVal;
var=m_pRecordset->GetCollect("Cname");
str=(LPCSTR)_bstr_t(var);
myregedit.m_strName= str;
var=m_pRecordset->GetCollect("Address");
str=(LPCSTR)_bstr_t(var);
myregedit.m_strAddr = str;
var=m_pRecordset->GetCollect("Postcode");
str=(LPCSTR)_bstr_t(var);
myregedit.m_strPost = str;
var=m_pRecordset->GetCollect("Phone");
str=(LPCSTR)_bstr_t(var);
myregedit.m_strPhone = str;
var=m_pRecordset->GetCollect("Fax");
str=(LPCSTR)_bstr_t(var);
myregedit.m_strFax = str;
// var=m_pRecordset->GetCollect("Memo");
str=(LPCSTR)_bstr_t(var);
myregedit.m_strDes= str;
var=m_pRecordset->GetCollect("Cpwd");
str=(LPCSTR)_bstr_t(var);
myregedit.m_strPwd1= str;
myregedit.m_strPwd2= str;
//更新所有控件显示
UpdateData(false);
m_pRecordset->MoveNext();
// }
//**********************************************************************
myregedit.DoModal();
}
void CMemberManager::OnShopping()
{
// TODO: Add your control notification handler code here
CClientModify mydlg;
mydlg.strCid=strID;
mydlg.DoModal();
}
void CMemberManager::OnCopylist()
{
// TODO: Add your control notification handler code here
m_pRecordset.CreateInstance(__uuidof(Recordset));
_variant_t var;
CString str;
try
{
m_pRecordset->Open("SELECT*FROM Shopping",
theApp.m_pConnection.GetInterfacePtr(),
adOpenDynamic,
adLockOptimistic,
adCmdText);
// MessageBox("BBBBBBBBBBBBBBBBBBBBBB");
}
catch(_com_error*e)
{
AfxMessageBox(e->ErrorMessage());
}
//*****************************************************
// var=m_pRecordset->GetCollect("Cid");
// str=(LPCSTR)_bstr_t(var);
// m_List="客户ID: "+strID+"\n";
while(!m_pRecordset->adoEOF)
{
var=m_pRecordset->GetCollect("ProName");
str=(LPCSTR)_bstr_t(var);
m_List1=m_List1+"商品名: "+str+"*";
var=m_pRecordset->GetCollect("ProQu");
str=(LPCSTR)_bstr_t(var);
m_List1=m_List1+"购买数量: "+str+"*";
var=m_pRecordset->GetCollect("Menoy");
str=(LPCSTR)_bstr_t(var);
m_List1=m_List1+"你所付金额 : "+str+"";
m_List1=m_List1+"************************************************************"
+"****************************";
m_pRecordset->MoveNext();
}
UpdateData(false);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -