📄 pressmanagerdoc.cpp
字号:
// PressManagerDoc.cpp : implementation of the CPressManagerDoc class
//
#include "stdafx.h"
#include "PressManager.h"
#include "PressManagerDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPressManagerDoc
IMPLEMENT_DYNCREATE(CPressManagerDoc, CDocument)
BEGIN_MESSAGE_MAP(CPressManagerDoc, CDocument)
//{{AFX_MSG_MAP(CPressManagerDoc)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPressManagerDoc construction/destruction
CPressManagerDoc::CPressManagerDoc()
{
// TODO: add one-time construction code here
}
CPressManagerDoc::~CPressManagerDoc()
{
}
#include "DialogSplash.h"
BOOL CPressManagerDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
int i = 0;
TRY
{
i = m_DB.Open(_T( "PressManager" ),FALSE,FALSE,_T( "ODBC;UID=admin;PWD=dog610" ));
}
CATCH_ALL(e)
{
AfxMessageBox("网路连接、数据库错误");
exit(0);
}
END_CATCH_ALL;
if(i == 0)
{
AfxMessageBox("网路连接、数据库错误");
exit(0);
}
m_DepartmentSet.m_pDatabase = &m_DB;
m_FeeSet.m_pDatabase = &m_DB;
m_ItemCountOrderSet.m_pDatabase = &m_DB;
m_MightSet.m_pDatabase = &m_DB;
m_MoneySumSet.m_pDatabase = &m_DB;
m_OutWareSet.m_pDatabase = &m_DB;
m_OperatorSet.m_pDatabase = &m_DB;
m_ProduceClientSet.m_pDatabase = &m_DB;
m_ProductWareSet.m_pDatabase = &m_DB;
m_StoreWareSet.m_pDatabase = &m_DB;
m_SysTimeSet.m_pDatabase = &m_DB;
m_UpdatetimeSet.m_pDatabase = &m_DB;
m_InWareSet.m_pDatabase = &m_DB;
m_ReturnWareSet.m_pDatabase = &m_DB;
m_WarePurposeSet.m_pDatabase = &m_DB;
m_WareTypeSet.m_pDatabase = &m_DB;
m_WareModeSet.m_pDatabase = &m_DB;
CDialogSplash dlg;
dlg.m_pSysTimeSet = &m_SysTimeSet;
dlg.m_pOperatorSet = &m_OperatorSet;
dlg.m_pUpdatetimeSet = &m_UpdatetimeSet;
dlg.DoModal();
m_strOperatorId = m_OperatorSet.m_Id;
m_nDepartmentId = m_OperatorSet.m_DepartmentId;
m_strOperatorName = m_OperatorSet.m_Operator;
for(i = 0; i < MAXRIGHT; i++)
bMight[i] = 0;
CString str;
str.Format("select * from [Might] where [OperatorId] = '%s'", m_strOperatorId);
m_MightSet.Open(CRecordset::snapshot, str);
while(!m_MightSet.IsEOF())
{
bMight[m_MightSet.m_Might] = 1;
m_MightSet.MoveNext();
}
str.Format("select * from [Department] where [Id] = %d", m_nDepartmentId);
m_DepartmentSet.Open(CRecordset::snapshot, str);
m_strDepartment = m_DepartmentSet.m_Department;
str.Format("select * from [WareType] order by [WareType]");
m_WareTypeSet.Open(CRecordset::snapshot, str);
str.Format("select * from [WareMode] order by [WareMode]");
m_WareModeSet.Open(CRecordset::snapshot, str);
str.Format("select * from [WarePurpose] order by [WarePurpose]");
m_WarePurposeSet.Open(CRecordset::snapshot, str);
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CPressManagerDoc serialization
void CPressManagerDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CPressManagerDoc diagnostics
#ifdef _DEBUG
void CPressManagerDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CPressManagerDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CPressManagerDoc commands
BOOL CPressManagerDoc::CanCloseFrame(CFrameWnd* pFrame)
{
// TODO: Add your specialized code here and/or call the base class
int i = MessageBox(NULL, "窗口将退出,是否退出?", "确认退出", MB_OKCANCEL);
if(i != IDOK)
return 0;
return CDocument::CanCloseFrame(pFrame);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -