📄 tstdlg.cpp
字号:
// TstDlg.cpp : implementation file
//
#include "stdafx.h"
#include "DerivedDialogTest.h"
#include "TstDlg.h"
#include "StrCurrency.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTstDlg dialog
CTstDlg::CTstDlg(CWnd* pParent /*=NULL*/)
:CDbSearchDlg(CTstDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CTstDlg)
m_iD = _T("");
m_Laboratorio = _T("");
m_Produto = _T("");
//}}AFX_DATA_INIT
m_iD = _T("*");
m_Laboratorio = _T("*");
m_Produto = _T("*");
m_dwProdutoId = 0;
}
void CTstDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTstDlg)
DDX_Control(pDX, IDC_PRODUTO, m_ProdutoCtrl);
DDX_Control(pDX, IDC_LABORATORIO, m_LaboratorioCtrl);
DDX_Control(pDX, IDC_ID, m_IdCtrl);
DDX_Text(pDX, IDC_ID, m_iD);
DDX_Text(pDX, IDC_LABORATORIO, m_Laboratorio);
DDX_Text(pDX, IDC_PRODUTO, m_Produto);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTstDlg, CDbSearchDlg)
//{{AFX_MSG_MAP(CTstDlg)
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDOK , OnOK )
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTstDlg message handlers
BOOL CTstDlg::OnInitDialog()
{
// AddFormField(CTRL_ID,FLAGS);
AddFormField(IDC_PRODUTO ,FFF_SEARCH_SUBSTRING );
AddFormField(IDC_ID ,FFF_EXACT_PHRASE );
AddFormField(IDC_LABORATORIO,FFF_SEARCH_SUBSTRING );
// AddResultColumn(LABEL,SQL_FIELD_NAME,FLAGS);
AddResultColumn(0,"Id" ,"produto_id" ,RCF_GET_INFO );
AddResultColumn(1,"Produto" ,"produto" ,RCF_NONE );
AddResultColumn(2,"Laboratorio" ,"laboratorio" ,RCF_GET_INFO );
// Registramos o Query, respeitando a ordem dos form-fields e dos sql_field_names acima
// estabelecidos:
SetDsn( "DSN=Ultrafarma;UID=Atendente_ultrafarma;PWD=ultra");
SetSql( "select \r\n"
" t1.produto_id as produto_id, \r\n"
" t1.nome as produto, \r\n"
" t2.nome as laboratorio \r\n"
"from \r\n"
" produtos t1 \r\n"
" inner join \r\n"
" laboratorios t2 \r\n"
" on \r\n"
" t1.lbrtr_id = t2.lbrtr_id \r\n"
"where \r\n"
" t1.nome like '?' and \r\n"
" convert(varchar,t1.produto_id) like '?' and \r\n"
" t2.nome like '?' \r\n");
CDbSearchDlg::OnInitDialog();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CTstDlg::GetInfo(UINT nSqlField, const CString strOriginal, CString &target)
{
switch(nSqlField)
{
case 0: // Id
// O texto vem em currency (local locale format)
{
CStrCurrency aCur;
aCur = strOriginal;
target.Format("%ld",((COleCurrency)(aCur)).m_cur.int64 / 10000);
}
break;
case 2: // Laboratorio
// Esse nos interessa tratar (laboratorio):
target = strOriginal;
target.MakeLower();
target += "[t]";
break;
}
return;
}
void CTstDlg::OnOK()
{
UpdateData();
// Pegamos a posi玢o do primeiro item selecionado.
POSITION pos = GetListCtrl().GetFirstSelectedItemPosition();
// Se n鉶 h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -