UserinfoView.cpp
上传用户:yuxuan88
上传日期:2022-05-09
资源大小:2290k
文件大小:4k
源码类别:

行业应用

开发平台:

Visual C++

  1. // UserinfoView.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "Inhabitants.h"
  5. #include "UserinfoView.h"
  6. #include "InhabitantsDoc.h"
  7. #include "House.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CUserinfoView
  15. IMPLEMENT_DYNCREATE(CUserinfoView, CFormView)
  16. CUserinfoView::CUserinfoView()
  17. : CFormView(CUserinfoView::IDD)
  18. {
  19. //{{AFX_DATA_INIT(CUserinfoView)
  20. m_nBuildingnum = 0;
  21. m_nCellnum = 0;
  22. m_strHousemaster = _T("");
  23. m_nRoomnum = 0;
  24. m_strSectionname = _T("");
  25. m_strBeeppager = _T("");
  26. m_strEmail = _T("");
  27. m_strHouseTel = _T("");
  28. m_strMobile = "";
  29. m_strOffice = _T("");
  30. m_strOfficeTel = _T("");
  31. //}}AFX_DATA_INIT
  32. }
  33. CUserinfoView::~CUserinfoView()
  34. {
  35. }
  36. void CUserinfoView::DoDataExchange(CDataExchange* pDX)
  37. {
  38. CFormView::DoDataExchange(pDX);
  39. //{{AFX_DATA_MAP(CUserinfoView)
  40. DDX_Text(pDX, IDC_EDIT_BUILDINGNUM, m_nBuildingnum);
  41. DDX_Text(pDX, IDC_EDIT_CELLNUM, m_nCellnum);
  42. DDX_Text(pDX, IDC_EDIT_HOUSEMASTER, m_strHousemaster);
  43. DDX_Text(pDX, IDC_EDIT_ROOMNUM, m_nRoomnum);
  44. DDX_Text(pDX, IDC_EDIT_SECTIONNAME, m_strSectionname);
  45. DDX_Text(pDX, IDC_EDIT_BEEPPAGER, m_strBeeppager);
  46. DDX_Text(pDX, IDC_EDIT_EMAIL, m_strEmail);
  47. DDX_Text(pDX, IDC_EDIT_HOMETEL, m_strHouseTel);
  48. DDX_Text(pDX, IDC_EDIT_MOBILE, m_strMobile);
  49. DDX_Text(pDX, IDC_EDIT_OFFICE, m_strOffice);
  50. DDX_Text(pDX, IDC_EDIT_OFFICETEL, m_strOfficeTel);
  51. //}}AFX_DATA_MAP
  52. }
  53. BEGIN_MESSAGE_MAP(CUserinfoView, CFormView)
  54. //{{AFX_MSG_MAP(CUserinfoView)
  55. ON_EN_CHANGE(IDC_EDIT_EMAIL, OnChangeEditEmail)
  56. //}}AFX_MSG_MAP
  57. END_MESSAGE_MAP()
  58. /////////////////////////////////////////////////////////////////////////////
  59. // CUserinfoView diagnostics
  60. #ifdef _DEBUG
  61. void CUserinfoView::AssertValid() const
  62. {
  63. CFormView::AssertValid();
  64. }
  65. void CUserinfoView::Dump(CDumpContext& dc) const
  66. {
  67. CFormView::Dump(dc);
  68. }
  69. #endif //_DEBUG
  70. /////////////////////////////////////////////////////////////////////////////
  71. // CUserinfoView message handlers
  72. //显示住址为strSectionName小区nBuildingNum号楼nCellNum单元nRoomNum房间的住户的详细信息
  73. void CUserinfoView::UpdateUserInfo(CString strSectionName,int nBuildingNum,int nCellNum,int nRoomNum)
  74. {
  75. //查询该住户
  76. CString strSql;
  77. strSql.Format("select * from house where sectionname = '%s' and buildingnum = %d and cellnum = %d and roomnum = %d",
  78. strSectionName,nBuildingNum,nCellNum,nRoomNum);
  79. CInhabitantsDoc* pDoc = (CInhabitantsDoc*)GetDocument();
  80. CCommand<CAccessor<CHouseAccessor> > dbHouse;
  81. long* pCount = new long;
  82. if(dbHouse.Open(pDoc->m_dbHouse.m_session,strSql,NULL,pCount) != S_OK)
  83. {
  84. AfxMessageBox("error");
  85. delete pCount;
  86. return;
  87. }
  88. //显示信息
  89. if(dbHouse.MoveFirst() == S_OK)
  90. {
  91. m_strHousemaster = dbHouse.m_housemaster;
  92. m_strSectionname = dbHouse.m_sectionname;
  93. m_nBuildingnum = dbHouse.m_buildingnum;
  94. m_nCellnum = dbHouse.m_cellnum;
  95. m_nRoomnum = dbHouse.m_roomnum;
  96. m_strHouseTel = dbHouse.m_housetel;
  97. m_strOffice = dbHouse.m_office;
  98. m_strOfficeTel = dbHouse.m_officetel;
  99. m_strBeeppager = dbHouse.m_beeppager;
  100. m_strMobile = dbHouse.m_mobile;
  101. m_strEmail = dbHouse.m_email;
  102. }
  103. dbHouse.Close();
  104. UpdateData(FALSE);
  105. }
  106. void CUserinfoView::OnChangeEditEmail() 
  107. {
  108. // TODO: If this is a RICHEDIT control, the control will not
  109. // send this notification unless you override the CFormView::OnInitDialog()
  110. // function and call CRichEditCtrl().SetEventMask()
  111. // with the ENM_CHANGE flag ORed into the mask.
  112. // TODO: Add your control notification handler code here
  113. }