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

📄 renyuan.cpp

📁 应用vc+sqlserver做的一个保卫处数据管理系统
💻 CPP
📖 第 1 页 / 共 2 页
字号:
void CRenYuan::OnSearch() 
{
	CSearch search;
	search.DoModal();
	// TODO: Add your command handler code here
	
}

void CRenYuan::OnAdd() 
{
	Index=1;
	CAdd add;
	add.DoModal();
	// TODO: Add your command handler code here
	
}

void CRenYuan::OnEdit() 
{
	Index=0;
	CAdd add;
	add.DoModal();
	// TODO: Add your command handler code here
	
}
BOOL CRenYuan::DestroyWindow() 
{
    //TerminateThread(pThread,0);	
	return CDialog::DestroyWindow();
}

void CRenYuan::OnSelchangeCombo1() 
{
  int i=m_type.GetCurSel();
  m_type.GetLBText(i,SearchType);
  CSearch search;
  search.DoModal();
}

void CRenYuan::OnDetail() 
{
	Index=2;
	CAdd add;
	add.DoModal();
	// TODO: Add your command handler code here
	
}

void CRenYuan::OnFresh() 
{
  this->Init_m_all();	
  itemText="全部单位";
}

void CRenYuan::OnTimer(UINT nIDEvent) 
{
	if(this->Important)
	if(SearchMode!=-1)
	{
            Result_m_result();
			SearchMode=-1;
	}
	CDialog::OnTimer(nIDEvent);
}

void CRenYuan::OnRclickList2(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
	char str[256];
	LVCOLUMN col; 
	col.fmt = LVIF_TEXT;
	col.cchTextMax = 256;
	col.pszText = str;
	if (! m_result.GetColumn(pNMListView->iSubItem, &col)) 
		return; 
	SearchType=col.pszText;
	
	POSITION pos;
	pos=m_result.GetFirstSelectedItemPosition();
	Position=m_result.GetNextSelectedItem(pos);
	r_ID=m_result.GetItemText(Position,0);
	SearchValue=r_ID;
	
	POINT point;
	GetCursorPos(&point);
	ScreenToClient(&point);
	CMenu menu;
	menu.LoadMenu(IDR_Detail);
	CMenu *me=menu.GetSubMenu(0);
	me->EnableMenuItem(ID_Search,MF_GRAYED|MF_DISABLED);	
    if(SearchValue.IsEmpty())
	{
		me->EnableMenuItem(ID_Delelte,MF_GRAYED|MF_DISABLED);
		me->EnableMenuItem(ID_Edit,MF_GRAYED|MF_DISABLED);
		me->EnableMenuItem(ID_Detail,MF_GRAYED|MF_DISABLED);
	}
	me->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON,point.x,point.y,this);
	*pResult = 0;
}

void CRenYuan::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	POSITION pos;
	pos=m_result.GetFirstSelectedItemPosition();
	Position=m_result.GetNextSelectedItem(pos);
	r_ID=m_result.GetItemText(Position,0);
	SearchValue=r_ID;
	if(!SearchValue.IsEmpty())
		this->tool_enable=true;
	*pResult = 0;
}

void CRenYuan::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	POSITION pos;
	pos=m_all.GetFirstSelectedItemPosition();
	Position=m_all.GetNextSelectedItem(pos);
	r_ID=m_all.GetItemText(Position,0);
	SearchValue=r_ID;
	if(!SearchValue.IsEmpty())
		this->tool_enable=true;
	*pResult = 0;
}

void CRenYuan::OnToolbarAdd() 
{
  this->OnAdd();	
}

void CRenYuan::OnToolbarDel() 
{
  	if(this->tool_enable)
     this->OnDelete();
}

void CRenYuan::OnToolbarEdit() 
{
  if(this->tool_enable)
	  this->OnEdit();
}

void CRenYuan::OnToolbarInfor() 
{
  if(this->tool_enable)
	  this->OnDetail();
}

void CRenYuan::OnToolbarSearch() 
{
  this->OnSearch();	
}

BOOL CRenYuan::PreTranslateMessage(MSG* pMsg) 
{
	/*
	if(m_tip[0].m_hWnd!=NULL)
		m_tip[0].RelayEvent(pMsg);
	if(m_tip[1].m_hWnd!=NULL)
		m_tip[1].RelayEvent(pMsg);	// TODO: Add your specialized code here and/or call the base class
	if(m_tip[2].m_hWnd!=NULL)
		m_tip[2].RelayEvent(pMsg);
	if(m_tip[3].m_hWnd!=NULL)
		m_tip[3].RelayEvent(pMsg);
	if(m_tip[4].m_hWnd!=NULL)
		m_tip[4].RelayEvent(pMsg);
		*/
	return CDialog::PreTranslateMessage(pMsg);
}

void CRenYuan::OnMouseMove(UINT nFlags, CPoint point) 
{
	/*
	m_tip[0].UpdateTipText("修改",pSub[0]);
	m_tip[1].UpdateTipText("删除",pSub[1]);	// TODO: Add your message handler code here and/or call default
	m_tip[2].UpdateTipText("添加",pSub[2]);
	m_tip[3].UpdateTipText("具体信息",pSub[3]);
	m_tip[4].UpdateTipText("查找",pSub[4]);
	*/
	CDialog::OnMouseMove(nFlags, point);
}

void CRenYuan::OnSelchangedTree1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
	HTREEITEM hItem = m_tree.GetSelectedItem();
	itemText = m_tree.GetItemText(hItem);
	if(itemText=="全部单位")
		this->Init_m_all();
	else if(itemText!="选择单位")
	{
		m_all.DeleteAllItems();
		CDetailInfor detail;
		detail.m_strFilter.Format("%s='%s'",g_Shop,itemText);
		detail.Open();
		int i=0;
		while(!detail.IsEOF())
		{
			m_all.InsertItem(i,NULL);
			m_all.SetItemText(i,0,detail.m_ID);
			m_all.SetItemText(i,1,detail.m_Name);
			m_all.SetItemText(i,2,detail.m_Sex);
			m_all.SetItemText(i,3,detail.m_Birthday);
			m_all.SetItemText(i,4,detail.m_Card_ID);
			m_all.SetItemText(i,5,detail.m_Phone);
			m_all.SetItemText(i,6,detail.m_Shop);
			detail.MoveNext();
			i++;
		}
		detail.Close();
	}
	*pResult = 0;
}

void CRenYuan::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	int n = m_all.GetSelectionMark();
	r_ID=m_all.GetItemText(n, 0);
	SearchValue=r_ID;
	Index=2;
	CAdd add;
	add.DoModal();
	*pResult = 0;
}

void CRenYuan::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	int n = m_result.GetSelectionMark();
	r_ID=m_result.GetItemText(n, 0);
	SearchValue=r_ID;
	Index=2;
	CAdd add;
	add.DoModal();
	*pResult = 0;
}

void CRenYuan::OnRAdd() 
{
this->OnAdd();
	// TODO: Add your command handler code here
	
}

void CRenYuan::OnRSearch() 
{
	this->OnSearch();
	// TODO: Add your command handler code here
	
}

void CRenYuan::OnShow() 
{
    CRetiredWorker re;
	re.DoModal();
	// TODO: Add your command handler code here
	
}

void CRenYuan::OnAbout() 
{
	CAbout about;
	about.DoModal();
	// TODO: Add your command handler code here
	
}

void CRenYuan::OnDelete() 
{
	CRetireType re;
	re.DoModal();
	int i=MessageBox("真的要删除此纪录吗?",NULL,MB_OKCANCEL);
	if(i==IDOK)
	{
		CDetailInfor detail;
		detail.m_strFilter.Format("%s='%s'",g_ID,r_ID);////////////////////////////////
		detail.Open();
		RetiredWorker retire;
		retire.Open();
		retire.AddNew();
		retire.m_address=detail.m_Address;
		retire.m_name=detail.m_Name;
		SYSTEMTIME time;
		GetLocalTime(&time);
        CString str;
		str.Format("%d-%d-%d",time.wYear,time.wMonth,time.wDay);
		retire.m_retiretime=str;
		retire.m_shop=detail.m_Shop;
		if(RetireType==0)
			retire.m_type="解雇";
		else
			retire.m_type="辞职";	
		retire.Update();
		retire.Close();
		detail.Delete();
		m_all.DeleteItem(Position);
        detail.Close();
		MessageBox("删除成功");
	}
	/*
	COleDateTime time;
	time.SetYear(...);
	time.SetDay(...);
	time.SetMonth(...);
	...
	pSet->AddNew();
	......
	pSet->Update();
	pSet->Edit();
	pSet->Update();
	*/
}

void CRenYuan::OnDataBackup() 
{
	CDatabase database;
	CString ConnectString,SQL;
	ConnectString.Format("DRIVER={SQL Server};SERVER=%s;DATABASE=Information;UID="";PWD="";","(LOCAL)");
	database.OpenEx( ConnectString,
		CDatabase::noOdbcDialog );//CDatabase::openReadOnly |
		
   SQL="backup database Information to Disk = 'D:\\Infor.dat'";
	database.ExecuteSQL(SQL);
    database.Close();
	MessageBox("备份成功");
}

void CRenYuan::OnDataRecover() 
{
	MessageBox("请在程序目录下找到'数据恢复.exe',并执行数据恢复");
		this->OnOK();
}

void CRenYuan::OnAddcompany() 
{
 
	CAddCompany add;
	add.DoModal();
}

void CRenYuan::OnEditpas() 
{
	CEditPas edit;
	edit.DoModal();
	
}

void CRenYuan::OnDeleteman() 
{
  CDeleteName d;
  d.DoModal();
	
}

void CRenYuan::OnAddman() 
{
  	CAddName add;
	add.DoModal();
}

⌨️ 快捷键说明

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