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

📄 productifdlg.cpp

📁 本程序是居于对话框用access数据库开发的一个简单的销售管理系统
💻 CPP
字号:
// ProductifDlg.cpp : implementation file
//

#include "stdafx.h"
#include "WinNerComputers.h"
#include "ProductifDlg.h"
#include "ProductifSet.h"
#include "Productif_TJDlg.h"
#include "Productif_XGDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CProductifDlg dialog


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


void CProductifDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CProductifDlg)
	DDX_Control(pDX, IDC_LIST1, m_list);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CProductifDlg, CDialog)
	//{{AFX_MSG_MAP(CProductifDlg)
	ON_BN_CLICKED(IDC_SHUAXIN, OnShuaxin)
	ON_BN_CLICKED(IDC_TIANJIA, OnTianjia)
	ON_BN_CLICKED(IDC_XIUGAI, OnXiugai)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CProductifDlg message handlers

void CProductifDlg::OnShuaxin() 
{
	// TODO: Add your control notification handler code here
	product("");
}

void CProductifDlg::OnTianjia() 
{
	// TODO: Add your control notification handler code here
	CProductif_TJDlg  dlg;
	dlg.DoModal();
}

void CProductifDlg::OnXiugai() 
{
	// TODO: Add your control notification handler code here
	CProductif_XGDlg  dlg;
	int Index = m_list.GetSelectionMark();//获取被选中的记录
	if (Index !=-1)
	{
		dlg.edit = m_list.GetItemText(Index,0);
		dlg.DoModal();
	}
	else
	{
		MessageBox("请选中要修改的项!");
	}
}

BOOL CProductifDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
	m_list.InsertColumn(0,"商品编号",LVCFMT_CENTER,100);
	m_list.InsertColumn(1,"商品名称",LVCFMT_CENTER,100);
	m_list.InsertColumn(2,"商品单位",LVCFMT_CENTER,100);
	m_list.InsertColumn(3,"商品规格",LVCFMT_CENTER,100);
	m_list.InsertColumn(4,"备注信息",LVCFMT_CENTER,200);
	product("");
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CProductifDlg::product(CString P)
{
	m_list.DeleteAllItems();
	m_pSet = new CProductifSet();
	m_pSet->m_strFilter = P;
	m_pSet->Open();
	if (!m_pSet->IsEOF()) 
	{
		m_pSet->MoveFirst();
	}
	int Intem = 0;
	while (!m_pSet->IsEOF()) 
	{
		CString str;
		Intem = m_list.InsertItem(Intem,m_pSet->m_ProductId);
		m_list.SetItemText(Intem,1,m_pSet->m_ProductName);
		m_list.SetItemText(Intem,2,m_pSet->m_Spec);
		m_list.SetItemText(Intem,3,m_pSet->m_Unit);
		m_list.SetItemText(Intem,4,m_pSet->m_Productmeno);
		Intem ++;
		m_pSet->MoveNext();
	}
	m_pSet->Close();
	UpdateData(FALSE);

}

⌨️ 快捷键说明

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