192 lines
5.8 KiB
C++
192 lines
5.8 KiB
C++
// opcreateprojectdlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "geomative.h"
|
|
#include "opcreateprojectdlg.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// COpCreateProjectDlg dialog
|
|
extern HHOOK hHook;
|
|
extern LRESULT __stdcall CBTHookProc(long nCode, WPARAM wParam, LPARAM lParam);
|
|
extern bool IsExistSpecialChar(const CString &strFileName);
|
|
extern int g_iUILanguage;
|
|
extern int g_UIOffset;
|
|
COpCreateProjectDlg::COpCreateProjectDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(COpCreateProjectDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(COpCreateProjectDlg)
|
|
m_edCN = _T("");
|
|
m_edCS = _T("");
|
|
m_edLocation = _T("");
|
|
m_edName = _T("");
|
|
m_edPM = _T("");
|
|
m_edPrDate = CTime::GetCurrentTime();
|
|
m_edPS = _T("");
|
|
m_edQAS = _T("");
|
|
m_edStandard = _T("");
|
|
m_edDuration = 0;
|
|
m_bCNS = true;
|
|
m_edPrDesc = _T("");
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
|
|
void COpCreateProjectDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(COpCreateProjectDlg)
|
|
DDX_Text(pDX, IDC_PRO_CN, m_edCN);
|
|
DDV_MaxChars(pDX, m_edCN, 40);
|
|
DDX_Text(pDX, IDC_PRO_CS, m_edCS);
|
|
DDV_MaxChars(pDX, m_edCS, 10);
|
|
DDX_Text(pDX, IDC_PRO_LOCATION, m_edLocation);
|
|
DDV_MaxChars(pDX, m_edLocation, 50);
|
|
DDX_Text(pDX, IDC_PRO_NAME, m_edName);
|
|
DDV_MaxChars(pDX, m_edName, 20);
|
|
DDX_Text(pDX, IDC_PRO_PM, m_edPM);
|
|
DDV_MaxChars(pDX, m_edPM, 10);
|
|
DDX_DateTimeCtrl(pDX, IDC_PRO_PRDATE, m_edPrDate);
|
|
DDX_Text(pDX, IDC_PRO_PS, m_edPS);
|
|
DDV_MaxChars(pDX, m_edPS, 10);
|
|
DDX_Text(pDX, IDC_PRO_QAS, m_edQAS);
|
|
DDV_MaxChars(pDX, m_edQAS, 10);
|
|
DDX_Text(pDX, IDC_PRO_STANDARD, m_edStandard);
|
|
DDV_MaxChars(pDX, m_edStandard, 30);
|
|
DDX_Text(pDX, IDC_PRO_DURATION, m_edDuration);
|
|
DDV_MinMaxInt(pDX, m_edDuration, 0, 65535);
|
|
DDX_Text(pDX, IDC_PRO_PRDESC, m_edPrDesc);
|
|
DDV_MaxChars(pDX, m_edPrDesc, 30);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(COpCreateProjectDlg, CDialog)
|
|
//{{AFX_MSG_MAP(COpCreateProjectDlg)
|
|
// ON_BN_CLICKED(IDC_PRO_GEN_CN, OnProGenCn)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// COpCreateProjectDlg message handlers
|
|
|
|
void COpCreateProjectDlg::OnOK()
|
|
{
|
|
// TODO: Add extra validation here
|
|
CString szCaption;
|
|
UpdateData(TRUE);
|
|
m_edName.TrimLeft();
|
|
m_edName.TrimRight();
|
|
if (IsExistSpecialChar(m_edName))
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("工程名中含有特殊字符,请重新输入"));
|
|
else
|
|
MessageBoxEx(NULL, _T("There are some special charcter in project name,please rename it!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
|
|
if (_T("") == m_edCN)
|
|
{
|
|
szCaption.Empty();
|
|
szCaption.LoadString(IDS_OP_LC_PRO_CN_NULL+g_UIOffset);
|
|
hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL);
|
|
MessageBox(szCaption, NULL, MB_ICONEXCLAMATION);
|
|
this->GetDlgItem(IDC_PRO_CN)->SetFocus();
|
|
}
|
|
else if (_T("") == m_edName)
|
|
{
|
|
szCaption.Empty();
|
|
szCaption.LoadString(IDS_OP_LC_PRO_NAME_NULL+g_UIOffset);
|
|
hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL);
|
|
MessageBox(szCaption, NULL, MB_ICONEXCLAMATION);
|
|
this->GetDlgItem(IDC_PRO_NAME)->SetFocus();
|
|
}
|
|
else
|
|
{
|
|
CDialog::OnOK();
|
|
}
|
|
}
|
|
|
|
void COpCreateProjectDlg::OnProGenCn()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
m_bCNS = false;
|
|
m_edCN = m_guCodeCreator.GenerateGUIDCode();
|
|
UpdateData(false);
|
|
|
|
((CEdit*)GetDlgItem(IDC_PRO_CN))->SetReadOnly();
|
|
|
|
((CEdit*)GetDlgItem(IDC_PRO_NAME))->SetReadOnly(false);
|
|
((CEdit*)GetDlgItem(IDC_PRO_NAME))->SetFocus();
|
|
|
|
((CEdit*)GetDlgItem(IDC_PRO_LOCATION))->SetReadOnly(false);
|
|
GetDlgItem(IDC_PRO_PRDATE)->EnableWindow();
|
|
|
|
((CEdit*)GetDlgItem(IDC_PRO_DURATION))->SetReadOnly(false);
|
|
((CEdit*)GetDlgItem(IDC_PRO_PS))->SetReadOnly(false);
|
|
((CEdit*)GetDlgItem(IDC_PRO_CS))->SetReadOnly(false);
|
|
|
|
((CEdit*)GetDlgItem(IDC_PRO_PM))->SetReadOnly(false);
|
|
((CEdit*)GetDlgItem(IDC_PRO_QAS))->SetReadOnly(false);
|
|
((CEdit*)GetDlgItem(IDC_PRO_STANDARD))->SetReadOnly(false);
|
|
((CEdit*)GetDlgItem(IDC_PRO_PRDESC))->SetReadOnly(false);
|
|
}
|
|
|
|
BOOL COpCreateProjectDlg::PreTranslateMessage(MSG* pMsg)
|
|
{
|
|
// TODO: Add your specialized code here and/or call the base class
|
|
if(pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_RETURN)
|
|
{
|
|
return TRUE;
|
|
}
|
|
|
|
if(pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_ESCAPE)
|
|
{
|
|
return TRUE;
|
|
}
|
|
return CDialog::PreTranslateMessage(pMsg);
|
|
}
|
|
|
|
BOOL COpCreateProjectDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
// TODO: Add extra initialization here
|
|
InitUIByLanguage(g_iUILanguage);
|
|
OnProGenCn();
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void COpCreateProjectDlg::InitUIByLanguage(int iLanguage)
|
|
{
|
|
if (LANG_ZHCN == iLanguage)
|
|
{
|
|
SetWindowText(_T("工程"));
|
|
GetDlgItem(IDC_STATIC_GRP_NEW_PRO)->SetWindowText(_T("新工程"));
|
|
GetDlgItem(IDC_STATIC_PRO_ID)->SetWindowText(_T("工程ID"));
|
|
GetDlgItem(IDC_STATIC_PRO_NAME)->SetWindowText(_T("*工程名称"));
|
|
GetDlgItem(IDC_STATIC_PRO_LOCATION)->SetWindowText(_T("地点"));
|
|
|
|
GetDlgItem(IDC_STATIC_PRO_DATE)->SetWindowText(_T("日期"));
|
|
GetDlgItem(IDC_STATIC_PRO_DURING_DAY)->SetWindowText(_T("持续时间(天)"));
|
|
GetDlgItem(IDC_STATIC_PRO_SUPERVISOR)->SetWindowText(_T("工程监督员"));
|
|
GetDlgItem(IDC_STATIC_ON_SITE_MANGER)->SetWindowText(_T("现场管理员"));
|
|
GetDlgItem(IDC_STATIC_PRO_MANAGER)->SetWindowText(_T("工程负责人"));
|
|
GetDlgItem(IDC_STATIC_PRO_QA)->SetWindowText(_T("品质保证员"));
|
|
GetDlgItem(IDC_STATIC_PRO_STANDARD)->SetWindowText(_T("标准"));
|
|
GetDlgItem(IDC_STATIC_PRO_REMARK)->SetWindowText(_T("备注"));
|
|
|
|
GetDlgItem(IDOK)->SetWindowText(_T("确定"));
|
|
GetDlgItem(IDCANCEL)->SetWindowText(_T("取消"));
|
|
|
|
|
|
}
|
|
} |