📄 conference.cpp
字号:
// Conference.cpp : implementation file
//
#include "stdafx.h"
#include "capture.h"
#include "Conference.h"
#include "DataManage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CConference dialog
extern CDataManage dataManage;
CConference::CConference(CWnd* pParent /*=NULL*/)
: CDialog(CConference::IDD, pParent)
{
//{{AFX_DATA_INIT(CConference)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CConference::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CConference)
DDX_Control(pDX, IDC_RICHEDIT1, m_member);
DDX_Control(pDX, IDC_EDIT2, m_compere);
DDX_Control(pDX, IDC_DATETIMEPICKER1, m_datetime);
DDX_Control(pDX, IDC_BUTTONSAVE, m_save);
DDX_Control(pDX, IDC_BUTTONCANCEL, m_cancel);
DDX_Control(pDX, IDC_EDIT1, m_subject);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CConference, CDialog)
//{{AFX_MSG_MAP(CConference)
ON_BN_CLICKED(IDC_BUTTONCANCEL, OnButtoncancel)
ON_BN_CLICKED(IDC_BUTTONSAVE, OnButtonsave)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CConference message handlers
void CConference::OnOK()
{
//
}
//清空界面数据
void CConference::OnButtoncancel()
{
m_compere.SetWindowText("");
m_subject.SetWindowText("");
CTime m_time = CTime::GetCurrentTime();
m_datetime.SetTime(&m_time);
m_member.SetWindowText("");
}
BOOL CConference::OnInitDialog()
{
CDialog::OnInitDialog();
OnButtoncancel() ;//清空数据
return TRUE;
}
BOOL CConference::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN)
if (pMsg->wParam ==13)
if (pMsg->hwnd != m_member.m_hWnd && pMsg->hwnd!= m_save.m_hWnd && pMsg->hwnd != m_cancel.m_hWnd)
pMsg->wParam = 9;
return CDialog::PreTranslateMessage(pMsg);
}
BOOL CConference::InfoIsNull()
{
CString c_sub,c_compere,c_member;
m_subject.GetWindowText(c_sub);
m_compere.GetWindowText(c_compere);
m_member.GetWindowText(c_member);
if(c_sub.IsEmpty()||c_compere.IsEmpty()||c_member.IsEmpty())
return TRUE;
return FALSE;
}
void CConference::OnButtonsave()
{
if (!InfoIsNull())
{
CString c_sub,c_member,c_compere,c_time;
m_subject.GetWindowText(c_sub);
m_member.GetWindowText(c_member);
m_compere.GetWindowText(c_compere);
m_datetime.GetWindowText(c_time);
CString sql;
sql.Format("insert into tb_conference values ('%s','%s','%s','%s')",c_sub,c_compere,c_member,c_time);
try
{
dataManage.p_Con->Execute((_bstr_t)sql,NULL,adCmdText);
AfxMessageBox("操作成功",MB_OK|MB_ICONINFORMATION);
OnButtoncancel();//清空数据
}
catch(_com_error e)
{
AfxMessageBox("操作失败: "+ e.Description(),MB_OK|MB_ICONINFORMATION);
}
}
else
AfxMessageBox("会议信息不能为空",MB_OK|MB_ICONINFORMATION,0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -