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

📄 admin_form.cpp

📁 LTMS软件说明 软件名称:LTMS(Luinse Teaching Management System)
💻 CPP
字号:
// admin_form.cpp : implementation file
//

#include "stdafx.h"
#include "LMTS.h"
#include "admin_form.h"
#include "change_pro.h"
#include "user.h"
#include "edit_pro.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// admin_form dialog


admin_form::admin_form(CWnd* pParent /*=NULL*/)
	: CDialog(admin_form::IDD, pParent)
{
	//{{AFX_DATA_INIT(admin_form)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void admin_form::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(admin_form)
	DDX_Control(pDX, IDC_LIST1, show_user);		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(admin_form, CDialog)
	//{{AFX_MSG_MAP(admin_form)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// admin_form message handlers
BOOL admin_form::OnInitDialog()
{
	CDialog::OnInitDialog();
//	SetDialogBkColor(RGB(200,223,200),RGB(0,0,255));
	show_user.SetTextColor(RGB(100,0,100));
	show_user.SetTextBkColor(RGB(240,247,233));
	show_user.InsertColumn(0,"id");
	show_user.InsertColumn(1,"姓名");
	show_user.InsertColumn(2,"属性");
	show_user.InsertColumn(3,"注册信息");
	show_user.SetColumnWidth(0,50);
	show_user.SetColumnWidth(1,100);	
	show_user.SetColumnWidth(2,100);
	show_user.SetColumnWidth(3,100);
	show_user.SetExtendedStyle(LVS_EX_FULLROWSELECT| LVS_EX_GRIDLINES);
	user user_db;
	CString get_id,str;
	str.Format("select * from user");
	user_db.Open(AFX_DB_USE_DEFAULT_TYPE,str);
    int i=0; 
	while(!user_db.IsEOF())
	  {
		 show_user.InsertItem(i,user_db.m_id,0);
		 show_user.SetItemText(i,1,user_db.m_name);
		 show_user.SetItemText(i,2,user_db.m_property);
		 show_user.SetItemText(i,3,user_db.m_regist);
         user_db.MoveNext();
		 i++;
	  }


	return TRUE;
}

void admin_form::OnButton1() 
{
	change_pro chg_pro;
	CString id;
	GetDlgItem(IDC_EDIT1)->GetWindowText(id);
	chg_pro.id=id;
	chg_pro.DoModal();
	// TODO: Add your control notification handler code here
	
}
void admin_form::OnButton3()
{
	show_user.DeleteAllItems();
	user user_db;
	CString get_id,str;
	str.Format("select * from user");
	user_db.Open(AFX_DB_USE_DEFAULT_TYPE,str);
    int i=0; 
	while(!user_db.IsEOF())
	  {
		 show_user.InsertItem(i,user_db.m_id,0);
		 show_user.SetItemText(i,1,user_db.m_name);
		 show_user.SetItemText(i,2,user_db.m_property);
		 show_user.SetItemText(i,3,user_db.m_regist);
         user_db.MoveNext();
		 i++;
	  }

}
void admin_form::OnButton2() 
{
	edit_pro e_pro;
	int i=show_user.GetSelectionMark();
	if(i!=-1){
	CString sel_id=show_user.GetItemText(i,0);
	user sel_user;
	CString str;
	str.Format("select * from user where id='%s'",sel_id);
	sel_user.Open(AFX_DB_USE_DEFAULT_TYPE,str);
	e_pro.user_name=sel_user.m_id;
	e_pro.user_property=sel_user.m_property;
	e_pro.user_regist=sel_user.m_regist;
	e_pro.DoModal();
	}

}

⌨️ 快捷键说明

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