ChangeDegradeInfoDlg.cpp
资源名称:school.rar [点击查看]
上传用户:rs600066
上传日期:2017-10-16
资源大小:4788k
文件大小:2k
源码类别:
数据库系统
开发平台:
Visual C++
- // ChangeDegradeInfoDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "school.h"
- #include "ChangeDegradeInfoDlg.h"
- #include "classset.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CChangeDegradeInfoDlg dialog
- CChangeDegradeInfoDlg::CChangeDegradeInfoDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CChangeDegradeInfoDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CChangeDegradeInfoDlg)
- m_strOldClass = _T("");
- m_strNewClass = _T("");
- m_strCode = _T("");
- m_strBrief = _T("");
- m_strName = _T("");
- m_strDate = _T("");
- //}}AFX_DATA_INIT
- }
- void CChangeDegradeInfoDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CChangeDegradeInfoDlg)
- DDX_Control(pDX, IDC_COMBO3_CLASS2, m_ctrNewClass);
- DDX_Control(pDX, IDC_COMBO3_CLASS, m_ctrOldClass);
- DDX_CBString(pDX, IDC_COMBO3_CLASS, m_strOldClass);
- DDX_CBString(pDX, IDC_COMBO3_CLASS2, m_strNewClass);
- DDX_Text(pDX, IDC_EDIT1_CODE, m_strCode);
- DDX_Text(pDX, IDC_EDIT2_BRIEF, m_strBrief);
- DDX_Text(pDX, IDC_EDIT4_NAME, m_strName);
- DDX_Text(pDX, IDC_EDIT5_DATE, m_strDate);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CChangeDegradeInfoDlg, CDialog)
- //{{AFX_MSG_MAP(CChangeDegradeInfoDlg)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CChangeDegradeInfoDlg message handlers
- BOOL CChangeDegradeInfoDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- CClassSet recordset ;
- if(!recordset.Open(AFX_DB_USE_DEFAULT_TYPE,"select * from class"))
- {
- MessageBox("打开数据库失败!","数据库错误",MB_OK);
- return FALSE;
- }
- while(!recordset.IsEOF())
- {
- m_ctrOldClass.AddString(recordset.m_code);
- m_ctrNewClass.AddString(recordset.m_code);
- recordset.MoveNext();
- }
- recordset.Close();
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CChangeDegradeInfoDlg::OnOK()
- {
- // TODO: Add extra validation here
- UpdateData();
- if(m_strCode.IsEmpty())
- {
- AfxMessageBox("请输入编号!");
- return;
- }
- if(m_strOldClass.IsEmpty())
- {
- AfxMessageBox("请输入原属班级!");
- return;
- }
- if(m_strName.IsEmpty())
- {
- AfxMessageBox("请输入留级人姓名!");
- return;
- }
- CDialog::OnOK();
- }