UserinfoView.cpp
上传用户:yuxuan88
上传日期:2022-05-09
资源大小:2290k
文件大小:4k
- // 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_nCellnum = 0;
- m_strHousemaster = _T("");
- m_nRoomnum = 0;
- m_strSectionname = _T("");
- m_strBeeppager = _T("");
- m_strEmail = _T("");
- m_strHouseTel = _T("");
- m_strMobile = "";
- m_strOffice = _T("");
- m_strOfficeTel = _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_CELLNUM, m_nCellnum);
- DDX_Text(pDX, IDC_EDIT_HOUSEMASTER, m_strHousemaster);
- DDX_Text(pDX, IDC_EDIT_ROOMNUM, m_nRoomnum);
- DDX_Text(pDX, IDC_EDIT_SECTIONNAME, m_strSectionname);
- DDX_Text(pDX, IDC_EDIT_BEEPPAGER, m_strBeeppager);
- DDX_Text(pDX, IDC_EDIT_EMAIL, m_strEmail);
- DDX_Text(pDX, IDC_EDIT_HOMETEL, m_strHouseTel);
- DDX_Text(pDX, IDC_EDIT_MOBILE, m_strMobile);
- DDX_Text(pDX, IDC_EDIT_OFFICE, m_strOffice);
- DDX_Text(pDX, IDC_EDIT_OFFICETEL, m_strOfficeTel);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CUserinfoView, CFormView)
- //{{AFX_MSG_MAP(CUserinfoView)
- ON_EN_CHANGE(IDC_EDIT_EMAIL, OnChangeEditEmail)
- //}}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
- //显示住址为strSectionName小区nBuildingNum号楼nCellNum单元nRoomNum房间的住户的详细信息
- void CUserinfoView::UpdateUserInfo(CString strSectionName,int nBuildingNum,int nCellNum,int nRoomNum)
- {
- //查询该住户
- CString strSql;
- strSql.Format("select * from house where sectionname = '%s' and buildingnum = %d and cellnum = %d and roomnum = %d",
- strSectionName,nBuildingNum,nCellNum,nRoomNum);
- 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_strHousemaster = dbHouse.m_housemaster;
- m_strSectionname = dbHouse.m_sectionname;
- m_nBuildingnum = dbHouse.m_buildingnum;
- m_nCellnum = dbHouse.m_cellnum;
- m_nRoomnum = dbHouse.m_roomnum;
- m_strHouseTel = dbHouse.m_housetel;
- m_strOffice = dbHouse.m_office;
- m_strOfficeTel = dbHouse.m_officetel;
- m_strBeeppager = dbHouse.m_beeppager;
- m_strMobile = dbHouse.m_mobile;
- m_strEmail = dbHouse.m_email;
- }
- dbHouse.Close();
- UpdateData(FALSE);
- }
- void CUserinfoView::OnChangeEditEmail()
- {
- // 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
-
- }