// DLG_Query_Add.cpp : implementation file // #include "stdafx.h" #include "corpsms.h" #include "DLG_Query_Add.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // DLG_Query_Add dialog #include "FQuery.h" DLG_Query_Add::DLG_Query_Add(CWnd* pParent /*=NULL*/) : CDialog(DLG_Query_Add::IDD, pParent) { //{{AFX_DATA_INIT(DLG_Query_Add) m_strCmd = _T(""); m_strBZ = _T(""); m_strRet = _T(""); m_bEnable = FALSE; //}}AFX_DATA_INIT m_pQuery = (CFQuery *)pParent; memset(&m_Data,0,sizeof(m_Data)); } void DLG_Query_Add::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(DLG_Query_Add) DDX_Text(pDX, IDC_QUERY_ADD_CMD, m_strCmd); DDV_MaxChars(pDX, m_strCmd, 60); DDX_Text(pDX, IDC_QUEYR_ADD_BZ, m_strBZ); DDV_MaxChars(pDX, m_strBZ, 250); DDX_Text(pDX, IDC_QUEYR_ADD_RET, m_strRet); DDV_MaxChars(pDX, m_strRet, 250); DDX_Check(pDX, IDC_QUEYR_ADD_STATUS, m_bEnable); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(DLG_Query_Add, CDialog) //{{AFX_MSG_MAP(DLG_Query_Add) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // DLG_Query_Add message handlers BOOL DLG_Query_Add::OnInitDialog() { CDialog::OnInitDialog(); m_strCmd = m_Data.szCmd; m_strRet = m_Data.szRet; m_strBZ = m_Data.szBZ; m_bEnable = m_Data.lStatus; UpdateData(false); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void DLG_Query_Add::SetParam(ANS_Query_Data data) { m_Data = data; } void DLG_Query_Add::OnOK() { if ( !UpdateData(true) ) return ; if ( m_strCmd.GetLength() <= 0 ) { MessageBox( _T("短信指令输入不能为空,请检查!"),_T("错误"),MB_ICONWARNING ); GetDlgItem(IDC_QUERY_ADD_CMD)->SetFocus(); return ; } if ( m_pQuery->QueryCmd(m_strCmd,m_Data.lQueryID) ) { MessageBox( _T("短信指令已存在,不能重复,请重新输入!"),_T("错误"),MB_ICONWARNING ); GetDlgItem(IDC_QUERY_ADD_CMD)->SetFocus(); return ; } if ( m_strRet.GetLength() <= 0 ) { MessageBox( _T("短信返回内容输入不能为空,请检查!"),_T("错误"),MB_ICONWARNING ); GetDlgItem(IDC_QUEYR_ADD_RET)->SetFocus(); return ; } _tcscpy(m_Data.szCmd , m_strCmd ); _tcscpy(m_Data.szRet , m_strRet ); _tcscpy(m_Data.szBZ , m_strBZ ); m_Data.lStatus = m_bEnable; CDialog::OnOK(); }