254 lines
8.3 KiB
C++
254 lines
8.3 KiB
C++
// D:\zm\GeomativeV2.5\cpp\logging\CDialogLoggingCreateTaskWnd.cpp : 实现文件
|
||
//
|
||
|
||
#include "stdafx.h"
|
||
#include "GeoMative.h"
|
||
#include "logging\CDialogLoggingCreateTaskWnd.h"
|
||
#include "logging\CLoggingDataOper.h"
|
||
#include "afxdialogex.h"
|
||
|
||
#define LOGGING_MESSAGEBOX_TITLE _T("CDialogLoggingCreateTaskWnd")
|
||
extern int g_iUILanguage;
|
||
// CDialogLoggingCreateTaskWnd 对话框
|
||
|
||
IMPLEMENT_DYNAMIC(CDialogLoggingCreateTaskWnd, CDialog)
|
||
|
||
CDialogLoggingCreateTaskWnd::CDialogLoggingCreateTaskWnd(CWnd* pParent /*=NULL*/)
|
||
: CDialog(CDialogLoggingCreateTaskWnd::IDD, pParent)
|
||
{
|
||
|
||
}
|
||
|
||
CDialogLoggingCreateTaskWnd::~CDialogLoggingCreateTaskWnd()
|
||
{
|
||
}
|
||
|
||
void CDialogLoggingCreateTaskWnd::DoDataExchange(CDataExchange* pDX)
|
||
{
|
||
CDialog::DoDataExchange(pDX);
|
||
DDX_Control(pDX, IDC_COMBO_WAVEFORM, m_comWaveform);
|
||
DDX_Control(pDX, IDC_COMBO_LOGGING_DIRECTION, m_comLoggingDirection);
|
||
}
|
||
|
||
|
||
BEGIN_MESSAGE_MAP(CDialogLoggingCreateTaskWnd, CDialog)
|
||
ON_BN_CLICKED(IDOK, &CDialogLoggingCreateTaskWnd::OnBnClickedOk)
|
||
ON_BN_CLICKED(IDCANCEL, &CDialogLoggingCreateTaskWnd::OnBnClickedCancel)
|
||
END_MESSAGE_MAP()
|
||
|
||
|
||
// CDialogLoggingCreateTaskWnd 消息处理程序
|
||
|
||
BOOL CDialogLoggingCreateTaskWnd::OnInitDialog()
|
||
{
|
||
CDialog::OnInitDialog();
|
||
GetDlgItem(IDC_EDIT_TRACE)->SetWindowTextA(_T("0"));
|
||
m_comWaveform.AddString(_T("0+0-"));
|
||
m_comWaveform.SetCurSel(0);
|
||
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
{
|
||
SetWindowTextA(_T("新建任务"));
|
||
GetDlgItem(IDC_STATIC_TASK_NAME)->SetWindowTextA(_T("任务名*:"));
|
||
GetDlgItem(IDC_STATIC_TEST_LOCATION)->SetWindowTextA(_T("测试地点:"));
|
||
GetDlgItem(IDC_STATIC)->SetWindowTextA(_T("测井类型*"));
|
||
GetDlgItem(IDC_CHECK_LONG_POTENTIAL_LOG)->SetWindowTextA(_T("长电位测井"));
|
||
GetDlgItem(IDC_CHECK_SHORT_POTENTIAL_LOG)->SetWindowTextA(_T("短电位测井"));
|
||
GetDlgItem(IDC_CHECK_GRADIENT_LOG)->SetWindowTextA(_T("梯度测井"));
|
||
GetDlgItem(IDC_CHECK_SP_LOG)->SetWindowTextA(_T("SP测井"));
|
||
GetDlgItem(IDC_STATIC_TRACE)->SetWindowTextA(_T("迭代次数:"));
|
||
GetDlgItem(IDC_STATIC_WAVEFORM)->SetWindowTextA(_T("发射波形:"));
|
||
GetDlgItem(IDC_STATIC_SAMPLING_INTERVAL)->SetWindowTextA(_T("采样间隔:"));
|
||
GetDlgItem(IDC_STATIC_INITIAL_DEPTH)->SetWindowTextA(_T("初始深度*:"));
|
||
GetDlgItem(IDC_STATIC_END_DEPTH)->SetWindowTextA(_T("结束深度*:"));
|
||
GetDlgItem(IDC_STATIC_LOGGING_DIRECTION)->SetWindowTextA(_T("测井方向*:"));
|
||
GetDlgItem(IDC_STATIC_LOGGING_INTERVAL)->SetWindowTextA(_T("测井间隔*:"));
|
||
GetDlgItem(IDC_STATIC_INSTRUMENT_ZERO_LENGTH)->SetWindowTextA(_T("仪器零长*:"));
|
||
GetDlgItem(IDC_STATIC_PERIOD)->SetWindowTextA(_T("周期*:"));
|
||
GetDlgItem(IDOK)->SetWindowTextA(_T("确定"));
|
||
GetDlgItem(IDCANCEL)->SetWindowTextA(_T("取消"));
|
||
|
||
m_comLoggingDirection.AddString(_T("向上"));
|
||
m_comLoggingDirection.AddString(_T("向下"));
|
||
}
|
||
else
|
||
{
|
||
m_comLoggingDirection.AddString(_T("up"));
|
||
m_comLoggingDirection.AddString(_T("down"));
|
||
}
|
||
m_comLoggingDirection.SetCurSel(0);
|
||
// TODO: 在此添加额外的初始化
|
||
|
||
return TRUE; // return TRUE unless you set the focus to a control
|
||
// 异常: OCX 属性页应返回 FALSE
|
||
}
|
||
|
||
void CDialogLoggingCreateTaskWnd::OnBnClickedOk()
|
||
{
|
||
// TODO: 在此添加控件通知处理程序代码
|
||
CString strTaskName;
|
||
GetDlgItem(IDC_EDIT_TASK_NAME)->GetWindowTextA(strTaskName);
|
||
if (strTaskName.IsEmpty())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("任务名不能为空"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Task name cannot be empty"), LOGGING_MESSAGEBOX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
|
||
CString strTestLocation;
|
||
GetDlgItem(IDC_EDIT_TEST_LOCATION)->GetWindowTextA(strTestLocation);
|
||
|
||
BYTE byLogTypes = 0;
|
||
int iTemp = -1;
|
||
iTemp = ((CButton*)GetDlgItem(IDC_CHECK_SP_LOG))->GetCheck();
|
||
if (iTemp > 0)
|
||
{
|
||
byLogTypes |= 1;
|
||
}
|
||
iTemp = ((CButton*)GetDlgItem(IDC_CHECK_LONG_POTENTIAL_LOG))->GetCheck();
|
||
if (iTemp > 0)
|
||
{
|
||
byLogTypes |= 2;
|
||
}
|
||
iTemp = ((CButton*)GetDlgItem(IDC_CHECK_SHORT_POTENTIAL_LOG))->GetCheck();
|
||
if (iTemp > 0)
|
||
{
|
||
byLogTypes |= 4;
|
||
}
|
||
iTemp = ((CButton*)GetDlgItem(IDC_CHECK_GRADIENT_LOG))->GetCheck();
|
||
if (iTemp > 0)
|
||
{
|
||
byLogTypes |= 8;
|
||
}
|
||
|
||
if (byLogTypes <= 0)
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("请选择测井类型"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Please select the logging type"), LOGGING_MESSAGEBOX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
|
||
CString strTrace;
|
||
GetDlgItem(IDC_EDIT_TRACE)->GetWindowTextA(strTrace);
|
||
if (strTrace.IsEmpty())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("迭代次数不能为空"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Number of iterations cannot be empty"), LOGGING_MESSAGEBOX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
|
||
int iWaveform = m_comWaveform.GetCurSel();
|
||
if (iWaveform < 0)
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("请选择发射波形"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Please select the launch waveform"), LOGGING_MESSAGEBOX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
|
||
CString strSamplingInterval;
|
||
GetDlgItem(IDC_EDIT_SAMPLING_INTERVAL)->GetWindowTextA(strSamplingInterval);
|
||
if (strSamplingInterval.IsEmpty())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("采样间隔不能为空"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Sampling interval must not be empty"), LOGGING_MESSAGEBOX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
|
||
CString strInitialDepth;
|
||
GetDlgItem(IDC_EDIT_INITIAL_DEPTH)->GetWindowTextA(strInitialDepth);
|
||
if (strInitialDepth.IsEmpty())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("初始深度不能为空"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Initial depth cannot be empty"), LOGGING_MESSAGEBOX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
|
||
CString strEndDepth;
|
||
GetDlgItem(IDC_EDIT_END_DEPTH)->GetWindowTextA(strEndDepth);
|
||
if (strEndDepth.IsEmpty())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("结束深度不能为空"));
|
||
else
|
||
MessageBoxEx(NULL, _T("End depth cannot be empty"), LOGGING_MESSAGEBOX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
|
||
int iLogDir = m_comLoggingDirection.GetCurSel();
|
||
if (iLogDir < 0)
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("请选择测井方向"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Please select the logging direction"), LOGGING_MESSAGEBOX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
|
||
CString strLoggingInterval;
|
||
GetDlgItem(IDC_EDIT_LOGGING_INTERVAL)->GetWindowTextA(strLoggingInterval);
|
||
if (strLoggingInterval.IsEmpty())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("测井间隔不能为空"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Log interval must not be empty"), LOGGING_MESSAGEBOX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
|
||
CString strInstrumentZeroLength;
|
||
GetDlgItem(IDC_EDIT_INSTRUMENT_ZERO_LENGTH)->GetWindowTextA(strInstrumentZeroLength);
|
||
if (strInstrumentZeroLength.IsEmpty())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("仪器零长不能为空"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Instrument zero length cannot be empty"), LOGGING_MESSAGEBOX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
|
||
CString strPeriod;
|
||
GetDlgItem(IDC_EDIT_PERIOD)->GetWindowTextA(strPeriod);
|
||
if (strPeriod.IsEmpty())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("周期不能为空"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Period cannot be empty"), LOGGING_MESSAGEBOX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
|
||
//将数据希尔
|
||
BOOL bRes = CLoggingDataOper::GetInstance()->SaveTaskInfoIntoDB(strTaskName, strTestLocation, byLogTypes, strTrace, iWaveform, strSamplingInterval, strInitialDepth, strEndDepth, iLogDir, strLoggingInterval,strInstrumentZeroLength,strPeriod);
|
||
if (bRes)
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("创建任务成功"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Create task successful"), LOGGING_MESSAGEBOX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
}
|
||
else
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("创建任务失败"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Failed to create task"), LOGGING_MESSAGEBOX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
}
|
||
CDialog::OnOK();
|
||
}
|
||
|
||
void CDialogLoggingCreateTaskWnd::OnBnClickedCancel()
|
||
{
|
||
CDialog::OnCancel();
|
||
} |