📄 教学管理信息系统dlg.cpp
字号:
// 教学管理信息系统Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "教学管理信息系统.h"
#include "教学管理信息系统Dlg.h"
//#include "Splash1.h"
#include "PassDlg.h"
#include "Dlgstuinfo.h"
#include "Dlgclassinfo.h"
#include "Dlgteacherinfo.h"
#include "Dlglessoninfo.h"
#include "Dlgmarkinfo.h"
#include "Dlgstuquery.h"
#include "Dlgdelstuinfo.h"
#include "Public.h"
#include "Dlgset.h"
#include "Dlgmarkquerynew.h"
#include "Mysheet.h"
#include "classsheet.h"
#include "feesheet.h"
#include "notesheet.h"
#include "Dlgdelgrade.h"
#include <memory.h>
#include <windows.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyDlg dialog
CMyDlg::CMyDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMyDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMyDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CMyDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
//{{AFX_MSG_MAP(CMyDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_CREATE()
ON_BN_CLICKED(IDC_BUTTONEXIT, OnButtonexit)
ON_BN_CLICKED(IDC_BUTTONinfostu, OnBUTTONinfostu)
ON_BN_CLICKED(IDC_BUTTONinfoteacher, OnBUTTONinfoteacher)
ON_BN_CLICKED(IDC_BUTTONinfolesson, OnBUTTONinfolesson)
ON_BN_CLICKED(IDC_BUTTONinfomark, OnBUTTONinfomark)
ON_BN_CLICKED(IDC_BUTTONset, OnBUTTONset)
ON_BN_CLICKED(IDC_BUTTONquerymark, OnBUTTONquerymark)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTONinfofee, OnBUTTONinfofee)
ON_BN_CLICKED(IDC_BUTTONnote, OnBUTTONnote)
ON_COMMAND(ID_STU_ADD, OnStuAdd)
ON_COMMAND(ID_STU_DEL, OnStuDel)
ON_COMMAND(ID_STU_QUERY, OnStuQuery)
ON_COMMAND(ID_CLASS_FEE, OnClassFee)
ON_COMMAND(ID_STU_FEE, OnStuFee)
ON_COMMAND(ID_MARK_ADD, OnMarkAdd)
ON_COMMAND(ID_MARK_DEL, OnMarkDel)
ON_COMMAND(ID_MARK_QUERY, OnMarkQuery)
ON_COMMAND(ID_TEACHER, OnTeacher)
ON_COMMAND(ID_CLASS_DIARY, OnClassDiary)
ON_COMMAND(ID_CLASS_NOTE, OnClassNote)
ON_COMMAND(ID_SET, OnSet)
ON_COMMAND(ID_DATA, OnData)
ON_COMMAND(ID_DATA_IN, OnDataIn)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyDlg message handlers
BOOL CMyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
if(CPublic::or==2)//若全局变量or=2,说明是普通用户,
{
GetDlgItem(IDC_BUTTONset)->EnableWindow(FALSE);
}
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
void CMyDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CMyDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CMyDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
int CMyDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
CPassDlg PassDlg;
PassDlg.DoModal();
//CSplashWnd::ShowSplashScreen(this); //显示启动画面
return 0;
}
BOOL CMyDlg::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::Create(IDD, pParentWnd);
}
void CMyDlg::OnButtonexit()
{
// TODO: Add your control notification handler code here
//退出系统
OnCancel();
}
void CMyDlg::OnBUTTONinfostu()
{
// TODO: Add your control notification handler code here
//调用学生信息对话框
CDlgstuinfo Dlgstuinfo;
Dlgstuinfo.DoModal();
//if(or==2)
//GetDlgItem(IDC_BUTTONadd)->EnableWindow(FALSE);
}
void CMyDlg::OnBUTTONinfoteacher()
{
// TODO: Add your control notification handler code here
//调用教师信息对话框
InitCommonControls();
//CWinApp::InitInstance();
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
//#ifdef _AFXDLL
//Enable3dControls(); // Call this when using MFC in a shared DLL
//#else
//Enable3dControlsStatic(); // Call this when linking to MFC statically
//#endif
CMysheet dlg1("教职工信息");
m_pMainWnd = &dlg1;
int nResponse = dlg1.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
}
void CMyDlg::OnBUTTONinfolesson()
{
// TODO: Add your control notification handler code here
//调用课程信息对话框
CDlglessoninfo Dlglessoninfo;
Dlglessoninfo.DoModal();
}
void CMyDlg::OnBUTTONinfomark()
{
// TODO: Add your control notification handler code here
//调用成绩信息对话框
CDlgmarkinfo Dlgmarkinfo;
Dlgmarkinfo.DoModal();
}
void CMyDlg::OnBUTTONset()
{
// TODO: Add your control notification handler code here
CDlgset dlgset;
dlgset.DoModal();
}
void CMyDlg::OnBUTTONquerymark()
{
// TODO: Add your control notification handler code here
}
void CMyDlg::OnButton1()
{// TODO: Add your control notification handler code here
InitCommonControls();
AfxEnableControlContainer();
Cclasssheet dlg1("班务信息");
m_pMainWnd = &dlg1;
int nResponse = dlg1.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CMyDlg::OnBUTTONinfofee()
{
InitCommonControls();
AfxEnableControlContainer();
Cfeesheet dlg1("财务信息管理");
m_pMainWnd = &dlg1;
int nResponse = dlg1.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
}
void CMyDlg::OnBUTTONnote()
{
InitCommonControls();
AfxEnableControlContainer();
Cnotesheet dlg1("记录信息");
m_pMainWnd = &dlg1;
int nResponse = dlg1.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
}
void CMyDlg::OnStuAdd()
{
// TODO: Add your command handler code here
CDlgstuinfo dlg;
dlg.DoModal();
}
void CMyDlg::OnStuDel()
{
// TODO: Add your command handler code here
CDlgdelstuinfo dlg;
dlg.DoModal();
}
void CMyDlg::OnStuQuery()
{
// TODO: Add your command handler code here
CDlgstuquery dlg;
dlg.DoModal();
}
void CMyDlg::OnClassFee()
{
// TODO: Add your command handler code here
Cfeesheet dlg("财务信息");
dlg.DoModal();
}
void CMyDlg::OnStuFee()
{
// TODO: Add your command handler code here
Cfeesheet dlg("财务信息");
dlg.DoModal();
}
void CMyDlg::OnMarkAdd()
{
// TODO: Add your command handler code here
CDlgmarkinfo dlg;
dlg.DoModal();
}
void CMyDlg::OnMarkDel()
{
// TODO: Add your command handler code here
CDlgdelgrade dlg;
dlg.DoModal();
}
void CMyDlg::OnMarkQuery()
{
// TODO: Add your command handler code here
CDlgmarkquerynew dlg;
dlg.DoModal();
}
void CMyDlg::OnTeacher()
{
// TODO: Add your command handler code here
CMysheet dlg("教职工信息");
dlg.DoModal();
}
void CMyDlg::OnClassDiary()
{
// TODO: Add your command handler code here
Cclasssheet dlg("班务日记");
dlg.DoModal();
}
void CMyDlg::OnClassNote()
{
// TODO: Add your command handler code here
Cnotesheet dlg("班级记录信息");
dlg.DoModal();
}
void CMyDlg::OnSet()
{
// TODO: Add your command handler code here
CDlgset dlg;
dlg.DoModal();
}
//数据库的备份
void CMyDlg::OnData()
{
// TODO: Add your command handler code here
if(CopyFile("\\班务教学管理信息系统\\教务课程信息管理数据库.mdb","C:\\WINDOWS\\b.mdb",FALSE))
AfxMessageBox("数据备份成功");
}
void CMyDlg::OnDataIn()
{
// TODO: Add your command handler code here
if(CopyFile("C:\\WINDOWS\\b.mdb","\\班务教学管理信息系统\\教务课程信息管理数据库.mdb",FALSE))
AfxMessageBox("数据导入成功");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -