📄 userinfoview.cpp
字号:
// UserinfoView.cpp : implementation file
//
#include "stdafx.h"
#include "Inhabitants.h"
#include "UserinfoView.h"
#include "InhabitantsDoc.h"
#include "House.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CUserinfoView
IMPLEMENT_DYNCREATE(CUserinfoView, CFormView)
CUserinfoView::CUserinfoView()
: CFormView(CUserinfoView::IDD)
{
//{{AFX_DATA_INIT(CUserinfoView)
m_nBuildingnum = 0;
m_nRoomnum = 0;
m_strStudentname = _T("");
m_nBednum = 0;
m_strRoomtype = _T("");
m_strMajor = _T("");
m_strRemarks = _T("");
m_strHouseTel = _T("");
m_strId = "";
m_strSex = _T("");
m_strNationNal = _T("");
//}}AFX_DATA_INIT
}
CUserinfoView::~CUserinfoView()
{
}
void CUserinfoView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CUserinfoView)
DDX_Text(pDX, IDC_EDIT_BUILDINGNUM, m_nBuildingnum);
DDX_Text(pDX, IDC_EDIT_ROOMNUM, m_nRoomnum);
DDX_Text(pDX, IDC_EDIT_STUDENTNAME, m_strStudentname);
DDX_Text(pDX, IDC_EDIT_BED, m_nBednum);
DDX_Text(pDX, IDC_EDIT_ROOMTYPE, m_strRoomtype);
DDX_Text(pDX, IDC_EDIT_MAJOR, m_strMajor);
DDX_Text(pDX, IDC_EDIT_REMARKS, m_strRemarks);
DDX_Text(pDX, IDC_EDIT_HOMETEL, m_strHouseTel);
DDX_Text(pDX, IDC_EDIT_ID, m_strId);
DDX_Text(pDX, IDC_EDIT_SEX, m_strSex);
DDX_Text(pDX, IDC_EDIT_NATIONAL, m_strNationNal);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CUserinfoView, CFormView)
//{{AFX_MSG_MAP(CUserinfoView)
ON_EN_CHANGE(IDC_EDIT_REMARKS, OnChangeEditRemarks)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUserinfoView diagnostics
#ifdef _DEBUG
void CUserinfoView::AssertValid() const
{
CFormView::AssertValid();
}
void CUserinfoView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CUserinfoView message handlers
//显示住址为strStudentName宿舍类型nBuildingNum号楼nRoomNum房间号nBedNum床铺的住户的详细信息
void CUserinfoView::UpdateUserInfo(CString strStudentName,int nBuildingNum,int nRoomNum,int nBedNum)
{
//查询该学生
CString strSql;
strSql.Format("select * from house where roomtype = '%s' and buildingnum = %d and roomnum = %d and bednum = %d",
strStudentName,nBuildingNum,nRoomNum,nBedNum);
CInhabitantsDoc* pDoc = (CInhabitantsDoc*)GetDocument();
CCommand<CAccessor<CHouseAccessor> > dbHouse;
long* pCount = new long;
if(dbHouse.Open(pDoc->m_dbHouse.m_session,strSql,NULL,pCount) != S_OK)
{
AfxMessageBox("error");
delete pCount;
return;
}
//显示信息
if(dbHouse.MoveFirst() == S_OK)
{
m_strStudentname = dbHouse.m_studentname;
m_strRoomtype = dbHouse.m_roomtype;
m_nBuildingnum = dbHouse.m_buildingnum;
m_nRoomnum = dbHouse.m_roomnum;
m_nBednum = dbHouse.m_bednum;
m_strHouseTel = dbHouse.m_housetel;
m_strSex = dbHouse.m_sex;
m_strNationNal = dbHouse.m_national;
m_strMajor = dbHouse.m_major;
m_strId = dbHouse.m_id;
m_strRemarks = dbHouse.m_remarks;
}
dbHouse.Close();
UpdateData(FALSE);
}
void CUserinfoView::OnChangeEditRemarks()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CFormView::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -