• 大小: 1.71MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-14
  • 语言: C/C++
  • 标签: c++  mfc  项目源码  

资源简介

代码是VC++6.0的工程,可以直接打开,数据库用的是access 学习很不错哈

资源截图

代码片段和文件信息

// AddFoodDlg.cpp : implementation file
//

#include “stdafx.h“
#include “Server.h“
#include “AddFoodDlg.h“

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAddFoodDlg dialog


CAddFoodDlg::CAddFoodDlg(CWnd* pParent /*=NULL*/)
: CDialog(CAddFoodDlg::IDD pParent)
{
//{{AFX_DATA_INIT(CAddFoodDlg)
m_strNumbers = _T(““);
m_strPrice = _T(““);
m_strStorage = _T(““);
m_strName = _T(““);
//}}AFX_DATA_INIT
}


void CAddFoodDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAddFoodDlg)
DDX_Control(pDX IDC_NUMBERS_SPIN m_CtrlSpin);
DDX_Control(pDX IDC_FOOD_NAME_COMBO m_CtrlCombox);
DDX_Text(pDX IDC_NUMBERS_EDIT m_strNumbers);
DDX_Text(pDX IDC_PRICE_EDIT m_strPrice);
DDX_Text(pDX IDC_STORAGE_EDIT m_strStorage);
DDX_CBString(pDX IDC_FOOD_NAME_COMBO m_strName);
//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CAddFoodDlg CDialog)
//{{AFX_MSG_MAP(CAddFoodDlg)
ON_CBN_SELCHANGE(IDC_FOOD_NAME_COMBO OnSelchangeFoodNameCombo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAddFoodDlg message handlers

BOOL CAddFoodDlg::OnInitDialog() 
{
CDialog::OnInitDialog();

CWnd* pEditNumbers = GetDlgItem(IDC_NUMBERS_EDIT);

m_CtrlSpin.SetBuddy(pEditNumbers);

TCHAR buf1[32];

int pos1 = m_CtrlSpin.GetPos();

wsprintf(buf1 _T(“%d“) pos1);

CWnd* pWnd1 = m_CtrlSpin.GetBuddy();

if(pWnd1 != NULL)
pWnd1->SetWindowText(buf1);

m_daoFood.Open();
if(m_daoFood.IsBOF() && m_daoFood.IsEOF())
return true;

m_daoFood.MoveLast();
int nCount = m_daoFood.GetRecordCount();
m_daoFood.MoveFirst();
CString str;
this->m_strNumbers = “1“;
UpdateData(false);
for( int i = 0; i < nCount; i++)
{
m_CtrlCombox.AddString(m_daoFood.m_Name);
if ( i == 0)
{
str.Format(“%.1f“m_daoFood.m_Price);
this->m_strPrice = str;
str.Format(“%d“m_daoFood.m_Numbers);
this->m_strStorage = str;
int nRange = atoi(this->m_strStorage);
if (nRange == 0)
m_CtrlSpin.SetRange(0nRange);
else
m_CtrlSpin.SetRange(1nRange);
UpdateData(false);
}
m_daoFood.MoveNext();
}
m_CtrlCombox.SetCurSel(0);
m_daoFood.Close();
return TRUE;
}

void CAddFoodDlg::OnSelchangeFoodNameCombo() 
{
m_daoFood.Open();
int nSelected = m_CtrlCombox.GetCurSel();
CString str;
m_CtrlCombox.GetLBText(nSelected str);
CString strFilter(“[Name]=\““);
strFilter += str;
strFilter += ‘\“‘;
    if(m_daoFood.FindFirst(strFilter))
{
str.Format(“%.1f“m_daoFood.m_Price);
this->m_strPrice = str;
str.Format(“%d“m_daoFood.m_Numbers);
this->m_strStorage = str;
int nRange = atoi(this->m_strStorage);
if (nRange == 0)
m_CtrlSpin.SetRange(0nRange);
else
m_CtrlSpin.SetRange(1nRange);
UpdateData

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       3089  2004-05-24 21:01  Server\AddFoodDlg.cpp

     文件       1418  2004-05-05 12:59  Server\AddFoodDlg.h

     文件       1868  2004-05-23 01:29  Server\AddFreeDlg.cpp

     文件       1303  2004-05-23 01:26  Server\AddFreeDlg.h

     文件       4408  2004-05-30 20:21  Server\AddLeaguerDlg.cpp

     文件       1761  2004-05-22 23:18  Server\AddLeaguerDlg.h

     文件       5789  2004-05-30 22:12  Server\CheckOutDialog.cpp

     文件       1900  2004-05-17 18:21  Server\CheckOutDialog.h

     文件       2134  2004-05-30 15:20  Server\CommSocket.cpp

     文件       1329  2004-04-29 22:02  Server\CommSocket.h

     文件       1802  2003-12-22 21:22  Server\cs.cpp

     文件       1396  2003-12-22 21:22  Server\cs.h

     文件       1305  2004-05-02 21:28  Server\DaoFood.cpp

     文件       1282  2004-04-27 16:02  Server\DaoFood.h

     文件       1837  2004-05-19 14:25  Server\DaoHistoryFree.cpp

     文件       1495  2004-05-19 14:24  Server\DaoHistoryFree.h

     文件       2309  2004-06-04 20:53  Server\DaoLeaguer.cpp

     文件       1647  2004-06-04 20:53  Server\DaoLeaguer.h

     文件       1304  2004-05-26 09:46  Server\DaoMessage.cpp

     文件       1300  2004-04-26 15:11  Server\DaoMessage.h

     文件       2400  2004-05-02 21:28  Server\DaoPayProperty.cpp

     文件       1676  2004-05-01 13:23  Server\DaoPayProperty.h

     文件       1887  2004-05-18 00:16  Server\DaoRecord.cpp

     文件       1485  2004-05-03 22:05  Server\DaoRecord.h

     文件       1466  2004-05-17 15:29  Server\DaoSaledFood.cpp

     文件       1362  2004-05-17 15:29  Server\DaoSaledFood.h

     文件         64  2006-10-26 13:49  Server\db1.ldb

     文件     141312  2004-06-15 16:30  Server\db1.mdb

     文件     270336  2004-06-15 16:22  Server\db5.mdb

     文件         64  2003-12-14 18:39  Server\db6.ldb

............此处省略144个文件信息

评论

共有 条评论