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

📄 dclime_adddlg.cpp

📁 一个VC++写的商品库存管理系统
💻 CPP
字号:
// DClime_AddDlg.cpp : implementation file
//

#include "stdafx.h"
#include "商品库存管理系统.h"
#include "DClime_AddDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern _ConnectionPtr cnn;
extern CMyApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CDClime_AddDlg dialog


CDClime_AddDlg::CDClime_AddDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CDClime_AddDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDClime_AddDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CDClime_AddDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDClime_AddDlg)
	DDX_Control(pDX, IDC_STANode, m_StaNode);
	DDX_Control(pDX, IDC_EDTName, m_EdtName);
	DDX_Control(pDX, IDC_COMIcoStyle, m_ComIcoStyle);
	DDX_Control(pDX, IDC_COMConnection, m_ComConnection);
	DDX_Control(pDX, IDC_BUTSure, m_ButSure);
	DDX_Control(pDX, IDC_BUTExt, m_butExit);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDClime_AddDlg, CDialog)
	//{{AFX_MSG_MAP(CDClime_AddDlg)
	ON_BN_CLICKED(IDC_BUTSure, OnBUTSure)
	ON_BN_CLICKED(IDC_BUTExt, OnBUTExt)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDClime_AddDlg message handlers

void CDClime_AddDlg::OnOK() 
{
	// TODO: Add extra validation here
	
	//CDialog::OnOK();
}

void CDClime_AddDlg::SetNode(CTreeCtrl * tree,HTREEITEM Node)
{

	SelectNodeName=tree->GetItemText(Node);
	if(SelectNodeName=="中华人民共和国")
	{
		nStyle=1;
	}
	else
	{
		int NodeStyle=this->NodeStyle(Node,SelectNodeName);
		if(NodeStyle==0)
			nStyle=0;
		else
		{
			if(NodeStyle==3)
				nStyle=3;
			else
				nStyle=2;
		}
	}
}
/*
	获得节点的类型
	*/
int CDClime_AddDlg::NodeStyle(HTREEITEM Node,CString sNodeName)
{
	_RecordsetPtr rst;
 	CString sSQL;
 	rst.CreateInstance(__uuidof(Recordset));
 	sSQL.Format("SELECT * from 地域信息表 WHERE 名称='%s'",sNodeName);
	try{
 		rst=cnn->Execute((_bstr_t)sSQL,NULL,adCmdText);
	}
	catch(...)
 	{
 		theApp.ADOError(rst);
 		rst->Close();
 		return 0;
 	}
 	if(theApp.GetRecordCount(rst)<=0)
 	{
 		rst->Close();
 		return 0;
 	}
 	else
	{
 		rst->MoveFirst();
		CString NodeStyle=(char*)(_bstr_t)rst->GetCollect((_bstr_t)"类型");
 		rst->Close();

 		return atoi(NodeStyle);
 	}
}

void CDClime_AddDlg::OnBUTSure() 
{
	this->m_EdtName.GetWindowText(this->Name);
	CString sCon;
	if(m_ComConnection.GetCurSel()==0)
		this->Connection=1;
	else
		this->Connection=2;
	this->IconStyle=this->m_ComIcoStyle.GetCurSel()+1;
	this->IsOK=true;
	this->OnCancel();
}

BOOL CDClime_AddDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	this->IsOK=false;
	if(nStyle==0)
	{
		MessageBox("初始化失败!","系统提示",MB_OK|MB_ICONSTOP);
		this->OnCancel();
	}
	if(nStyle==1)
	{
		m_StaNode.SetWindowText(SelectNodeName);
		m_ComConnection.SetCurSel(0);
		m_ComConnection.EnableWindow(false);
		m_ComIcoStyle.SetCurSel(0);
		m_EdtName.SetFocus();
	}
	if(nStyle==2)
	{
		m_StaNode.SetWindowText(SelectNodeName);
		m_ComConnection.SetCurSel(0);
		m_ComIcoStyle.SetCurSel(0);
		m_ComConnection.SetFocus();
	}
	if(nStyle==3)
	{
		m_StaNode.SetWindowText(SelectNodeName);
		m_ComConnection.SetCurSel(1);
		m_ComIcoStyle.SetCurSel(0);
		m_ComConnection.EnableWindow(false);
		m_EdtName.SetFocus();
	}
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDClime_AddDlg::OnBUTExt() 
{
	this->OnCancel();
	this->IsOK=false;
}

⌨️ 快捷键说明

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