206 lines
5.1 KiB
C++
206 lines
5.1 KiB
C++
// SantaryIndustryDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "SantaryIndustryDlg.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
#include "globalfunc.h"
|
|
#include"TGAs.h"
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CSantaryIndustryDlg dialog
|
|
|
|
int CSantaryIndustryDlg::m_iType = 0;
|
|
|
|
CSantaryIndustryDlg::CSantaryIndustryDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CSantaryIndustryDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CSantaryIndustryDlg)
|
|
//}}AFX_DATA_INIT
|
|
m_nRet = 0;
|
|
m_nRet2 = 0;
|
|
|
|
}
|
|
|
|
|
|
void CSantaryIndustryDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CSantaryIndustryDlg)
|
|
DDX_Control(pDX, IDC_LIST_DANG, m_listCtrl);
|
|
DDX_Radio(pDX, IDC_RADIO_TYPE1, m_iType);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CSantaryIndustryDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CSantaryIndustryDlg)
|
|
ON_NOTIFY(NM_DBLCLK, IDC_LIST_DANG, OnDblclkListDang)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE1, OnRadioType1)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE2, OnRadioType2)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE3, OnRadioType3)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE4, OnRadioType4)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE5, OnRadioType5)
|
|
ON_BN_CLICKED(IDC_RADIO1, OnRadioType6)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CSantaryIndustryDlg message handlers
|
|
|
|
BOOL CSantaryIndustryDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
m_listCtrl.SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
|
|
m_listCtrl.InsertColumn ( 0, _T("给水配件名称"), LVCFMT_LEFT, 165 );
|
|
m_listCtrl.InsertColumn ( 1, _T("额定流量(L/s)"), LVCFMT_LEFT, 90 );
|
|
m_listCtrl.InsertColumn ( 2, _T("同时给水百分数"), LVCFMT_LEFT, 120 );
|
|
|
|
|
|
|
|
ResetList();
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void CSantaryIndustryDlg::OnOK()
|
|
{
|
|
POSITION pos = m_listCtrl.GetFirstSelectedItemPosition();
|
|
int nItem = m_listCtrl.GetNextSelectedItem(pos);
|
|
if(nItem > -1){
|
|
m_csRetName = m_listCtrl.GetItemText(nItem, 0);
|
|
CString csTmp = m_listCtrl.GetItemText(nItem, 2);
|
|
int idx = csTmp.Find(_T("~"), 0);
|
|
if(idx > -1)
|
|
csTmp = csTmp.Left(idx);
|
|
m_nRet = _tstof(csTmp);
|
|
csTmp = m_listCtrl.GetItemText(nItem, 1);
|
|
m_nRet2 = _tstof(csTmp);
|
|
}
|
|
|
|
CDialog::OnOK();
|
|
}
|
|
|
|
void CSantaryIndustryDlg::OnDblclkListDang(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
OnOK();
|
|
*pResult = 0;
|
|
}
|
|
|
|
void CSantaryIndustryDlg::OnRadioType1()
|
|
{
|
|
ResetList();
|
|
}
|
|
|
|
void CSantaryIndustryDlg::OnRadioType2()
|
|
{
|
|
ResetList();
|
|
}
|
|
|
|
void CSantaryIndustryDlg::OnRadioType3()
|
|
{
|
|
ResetList();
|
|
}
|
|
|
|
void CSantaryIndustryDlg::OnRadioType4()
|
|
{
|
|
ResetList();
|
|
}
|
|
|
|
void CSantaryIndustryDlg::OnRadioType5()
|
|
{
|
|
ResetList();
|
|
}
|
|
|
|
void CSantaryIndustryDlg::OnRadioType6()
|
|
{
|
|
ResetList();
|
|
}
|
|
|
|
void CSantaryIndustryDlg::ResetList()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_listCtrl.DeleteAllItems();
|
|
CodeBase db;
|
|
XString fullFile;
|
|
if(!GlobalFunc::FindFile(_T("datastore.dbf"), fullFile)) {
|
|
AfxMessageBox(_T("对不起,没有发现datastore.dbf文件!"));
|
|
return;
|
|
}
|
|
int Number;
|
|
CString csType, csValue, csRemark;
|
|
int idx = 0;
|
|
DbfTable *pTable = db.Open(fullFile);
|
|
if(!pTable)
|
|
return;
|
|
XString xsMaterial;
|
|
int iDn(0);
|
|
double nDj(0);
|
|
for(pTable->MoveFirst();!pTable->IsEOF();pTable->MoveNext()){
|
|
GET_FIELD(pTable, _T("TypeNumber"), Number);
|
|
if(Number == 44)
|
|
{
|
|
GET_FIELD(pTable, _T("TypeName"), csType);
|
|
GET_FIELD(pTable, _T("TypeValue"), csValue);
|
|
GET_FIELD(pTable, _T("REMARK"), csRemark);
|
|
TCHAR cName[256]=_T(""), eName[256]=_T("");
|
|
|
|
GlobalFunc::GetStringAtIndex(csRemark, 1, cName);
|
|
GlobalFunc::GetStringAtIndex(csRemark, 2, eName);
|
|
|
|
if(m_iType == 0 && csType == _T("工业企业生活间"))
|
|
{
|
|
m_listCtrl.InsertItem ( idx, csValue, 0 );
|
|
m_listCtrl.SetItemText ( idx, 1, eName);
|
|
m_listCtrl.SetItemText ( idx, 2, cName);
|
|
idx++;
|
|
}
|
|
else if(m_iType == 1 && csType == _T("公共浴室"))
|
|
{
|
|
m_listCtrl.InsertItem ( idx, csValue, 0 );
|
|
m_listCtrl.SetItemText ( idx, 1, eName);
|
|
m_listCtrl.SetItemText ( idx, 2, cName);
|
|
idx++;
|
|
}
|
|
else if(m_iType == 2 && csType == _T("剧院化妆间"))
|
|
{
|
|
m_listCtrl.InsertItem ( idx, csValue, 0 );
|
|
m_listCtrl.SetItemText ( idx, 1, eName);
|
|
m_listCtrl.SetItemText ( idx, 2, cName);
|
|
idx++;
|
|
}
|
|
else if(m_iType == 3 && csType == _T("体育场馆休息室"))
|
|
{
|
|
m_listCtrl.InsertItem ( idx, csValue, 0 );
|
|
m_listCtrl.SetItemText ( idx, 1, eName);
|
|
m_listCtrl.SetItemText ( idx, 2, cName);
|
|
idx++;
|
|
}
|
|
else if(m_iType == 4 && csType == _T("职工食堂"))
|
|
{
|
|
m_listCtrl.InsertItem ( idx, csValue, 0 );
|
|
m_listCtrl.SetItemText ( idx, 1, eName);
|
|
m_listCtrl.SetItemText ( idx, 2, cName);
|
|
idx++;
|
|
}
|
|
else if(m_iType == 5 && csType == _T("宿舍")) // cet 2010.6.28 add 宿舍(Ⅲ、Ⅳ类)
|
|
{
|
|
m_listCtrl.InsertItem ( idx, csValue, 0 );
|
|
m_listCtrl.SetItemText ( idx, 1, eName);
|
|
m_listCtrl.SetItemText ( idx, 2, cName);
|
|
idx++;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|