C + + Course Design -- Design of community property management system (MFC)

Lesson title

The design of property management system in community

Class setting requirements

Design content
The property management of a residential area is investigated and demand analysis is carried out. The owner information and housing information are designed to realize the property management of the residential area (including property fee, elevator fee, water fee, heating fee, etc.). The system can set charging standards, and the property fee, elevator fee and heating fee are calculated based on the area of the house. The main functions include:

  1. user management
  2. Input, modification, deletion and import of house information and owner information
  3. Manual entry, modification, deletion and file import of quarterly expense information
  4. Query the owner's payment information by building number + room number
  5. Entry, deletion and query of house maintenance records in community
  6. The room number of the unpaid fee shall be counted according to the building number and quarter, and the room number, the name of the owner, telephone number and expenses shall be output and saved in the document
  7. Community announcement management

Program operation interface






Part of source code

void CFangwuManDlg::OnButton5() 
{
	CString strtemp;
	GetDlgItem(IDC_EDIT1)->GetWindowText(strtemp);
	Cfangwu *  ptr = Cfangwu::Gethbinfo(strtemp.GetBuffer(100));
	strtemp.ReleaseBuffer();
	
	if(ptr != NULL)
	{
		GetDlgItem(IDC_EDIT1)->SetWindowText(ptr->szzkz);
		GetDlgItem(IDC_EDIT2)->SetWindowText(ptr->name);
		GetDlgItem(IDC_EDIT3)->SetWindowText(ptr->yezhu);
		GetDlgItem(IDC_EDIT4)->SetWindowText(ptr->phone);
		GetDlgItem(IDC_EDIT5)->SetWindowText(ptr->mianji);
		
	}
	else
		AfxMessageBox("No record");
	
}

void CFangwuManDlg::OnButton1() 
{
	// TODO: Add your control notification handler code here
	Cfangwu st;
	memset(&st,0,sizeof(st));
	
	CString strtemp;
	GetDlgItem(IDC_EDIT1)->GetWindowText(strtemp);
	strcpy(st.szzkz,strtemp);
	
	GetDlgItem(IDC_EDIT2)->GetWindowText(strtemp);
	strcpy(st.name,strtemp);
	
	GetDlgItem(IDC_EDIT3)->GetWindowText(strtemp);
	strcpy(st.yezhu,strtemp);
	
	GetDlgItem(IDC_EDIT4)->GetWindowText(strtemp);
	strcpy(st.phone,strtemp);
	
	GetDlgItem(IDC_EDIT5)->GetWindowText(strtemp);
	strcpy(st.mianji,strtemp);
	
	
	if(Cfangwu::inputhb(st))
	{
		AfxMessageBox("Add success");
	}
	else
	{
		AfxMessageBox("Add failed. Make sure the information already exists");
	}
}

void CFangwuManDlg::OnButton2() 
{
	// TODO: Add your control notification handler code here
	CString strtemp;
	GetDlgItem(IDC_EDIT1)->GetWindowText(strtemp);
	Cfangwu *  ptr = Cfangwu::Gethbinfo(strtemp.GetBuffer(100));
	strtemp.ReleaseBuffer();
	
	if(ptr != NULL)
	{
		
		GetDlgItem(IDC_EDIT2)->GetWindowText(strtemp);
		strcpy(ptr->name,strtemp);
		
		GetDlgItem(IDC_EDIT3)->GetWindowText(strtemp);
		strcpy(ptr->yezhu,strtemp);
		
		GetDlgItem(IDC_EDIT4)->GetWindowText(strtemp);
		strcpy(ptr->phone,strtemp);
		
		GetDlgItem(IDC_EDIT5)->GetWindowText(strtemp);
		strcpy(ptr->mianji,strtemp);
		
		
		AfxMessageBox("Modified success");
	}
	else
		AfxMessageBox("No record");
}

void CFangwuManDlg::OnButton6() 
{
	CString strtemp;
	GetDlgItem(IDC_EDIT1)->GetWindowText(strtemp);
	Cfangwu *  ptr = Cfangwu::Gethbinfo(strtemp.GetBuffer(100));
	strtemp.ReleaseBuffer();
	
	vector<Cfangwu> * pall = Cfangwu::GetAllhb();
	if (ptr != NULL)
	{
		vector<Cfangwu>::iterator it;
		for (it = pall->begin(); it != pall->end() ; it++)
		{
			if(strcmp((*it).szzkz, ptr->szzkz) == 0)
			{
				pall->erase(it);
				AfxMessageBox("Delete successful");
				return;
			}
		}
	}
	else
	{
		AfxMessageBox("The information does not exist");
	}
	
}

void CFangwuManDlg::OnButton10() 
{
	// TODO: Add your control notification handler code here
	CListCtrl *plist = (CListCtrl *)GetDlgItem(IDC_LIST1);
	plist->DeleteAllItems();
	
	
	
	CString strtemp;
	int i = 0;
	int iall = 0;
	
	vector<Cfangwu> *VEC1 = Cfangwu::GetAllhb();
	for(i = 0; i < VEC1->size(); i++)
	{
		Cfangwu st = VEC1->at(i);
		
		strtemp.Format("%d",iall+1);
		plist->InsertItem(iall,"");
		plist->SetItemText(iall,0,strtemp);
		
		
		plist->SetItemText(iall,1,st.szzkz);
		plist->SetItemText(iall,2,st.name);
		plist->SetItemText(iall,3,st.yezhu);
		plist->SetItemText(iall,4,st.phone);
		plist->SetItemText(iall,5,st.mianji);
		iall+=1;
		
	}
}
155 original articles published, praised 103, visited 50000+
Private letter follow

Posted by bpat1434 on Sat, 08 Feb 2020 09:37:38 -0800