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

📄 iiserthotel.cpp

📁 这是一个简单的酒店管理系统
💻 CPP
字号:
// IisertHotel.cpp : implementation file
//

#include "stdafx.h"
#include "shujuku.h"
#include "IisertHotel.h"
#include "HotSet.h"

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

/////////////////////////////////////////////////////////////////////////////
// CIisertHotel dialog


CIisertHotel::CIisertHotel(CWnd* pParent /*=NULL*/)
	: CDialog(CIisertHotel::IDD, pParent)
{
	//{{AFX_DATA_INIT(CIisertHotel)
	m_HAdd = _T("");
	m_HInCity = _T("");
	m_HName = _T("");
	m_HToS = 0;
	m_HStar = _T("");
	//}}AFX_DATA_INIT
}


void CIisertHotel::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CIisertHotel)
	DDX_Text(pDX, IDC_HAddress, m_HAdd);
	DDX_Text(pDX, IDC_HInCity, m_HInCity);
	DDX_Text(pDX, IDC_HName, m_HName);
	DDX_Text(pDX, IDC_HToS, m_HToS);
	DDX_Text(pDX, IDC_HStar, m_HStar);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CIisertHotel, CDialog)
	//{{AFX_MSG_MAP(CIisertHotel)
	ON_BN_CLICKED(IDC_InsertHotel, OnInsertHotel)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CIisertHotel message handlers

void CIisertHotel::OnInsertHotel() 
{
	// TODO: Add your control notification handler code here
	this->UpdateData(TRUE);
	if(!IsLeagle())
	{
		this->MessageBox("Error!");
		return ;
	}

	CHotSet set;
	if(!set.IsOpen())
		set.Open();

	set.AddNew();

	set.m_Name= m_HName ;
	set.m_Address= m_HAdd ;
	set.m_star=m_HStar;
	set.m_toStation=m_HToS;
	set.m_cityID=1;
	set.m_ID=3;



/*	try
	{
		reAgent.Open(CRecordset::forwardOnly,"SELECT ID FROM TCustomer WHERE ID = "+ m_CusID,CRecordset::readOnly);	
	}
	catch(CException e)
	{
		e.ReportError();
	}
	
	while(!reAgent.IsEOF())
	{
		reAgent.GetFieldValue("ID",id);
		reAgent.MoveNext();
	}
	reAgent.Close();

	if(id == m_CusID)
	{
		MessageBox("ID已存在!");
	}
	else
	{
		set.Update();
		this->MessageBox("Add Success!");
	}

	set.Close();*/	
	

	set.Update();
	this->MessageBox("Add Success!");
}

BOOL CIisertHotel::IsLeagle()
{
	if(m_HStar<1 || m_HToS<0)
		return 0;
	if(m_HAdd.IsEmpty() || m_HName.IsEmpty() || m_HInCity.IsEmpty())
		return 0;
	return 1;
}

BOOL CIisertHotel::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	
	this->m_HStar=1;
	this->UpdateData(false);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

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