Dlg_AddActionWithAlarm.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // Dlg_AddActionWithAlarm.cpp : 实现文件
  2. //
  3. #include "stdafx.h"
  4. #include "Dlg_AddActionWithAlarm.h"
  5. #include ".\dlg_addactionwithalarm.h"
  6. #include "SelectVariantDlg.h"
  7. #include "DlgDatePlan.h"
  8. // CDlg_AddActionWithAlarm 对话框
  9. IMPLEMENT_DYNAMIC(CDlg_AddActionWithAlarm, CDialog)
  10. CDlg_AddActionWithAlarm::CDlg_AddActionWithAlarm(CWnd* pParent /*=NULL*/)
  11. : CDialog(CDlg_AddActionWithAlarm::IDD, pParent)
  12. , m_sEdit_DoSet(_T(""))
  13. , m_sEdit_DoStatus(_T(""))
  14. ,m_nEdit_AlarmData( 1 )
  15. ,m_nEdit_ResumeData( 0 )
  16. {
  17. m_nMode = 0;
  18. }
  19. CDlg_AddActionWithAlarm::~CDlg_AddActionWithAlarm()
  20. {
  21. }
  22. void CDlg_AddActionWithAlarm::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. DDX_Text(pDX, IDC_EDIT_DOSET, m_sEdit_DoSet);
  26. DDX_Text(pDX, IDC_EDIT_DOSTATUS, m_sEdit_DoStatus);
  27. DDX_Text(pDX, IDC_EDIT_ALARMDATA, m_nEdit_AlarmData);
  28. DDX_Text(pDX, IDC_EDIT_RESUMEDATA, m_nEdit_ResumeData);
  29. }
  30. BEGIN_MESSAGE_MAP(CDlg_AddActionWithAlarm, CDialog)
  31. ON_BN_CLICKED(IDC_BTN_CHOOSE1, OnBnClickedBtnChoose1)
  32. ON_BN_CLICKED(IDC_BTN_CHOOSE2, OnBnClickedBtnChoose2)
  33. ON_BN_CLICKED(IDC_BTN_PLANTIME, OnBnClickedBtnPlanTime)
  34. ON_BN_CLICKED(IDOK, OnBnClickedOk)
  35. END_MESSAGE_MAP()
  36. // CDlg_AddActionWithAlarm 消息处理程序
  37. BOOL CDlg_AddActionWithAlarm::OnInitDialog()
  38. {
  39. CDialog::OnInitDialog();
  40. // TODO: 在此添加额外的初始化
  41. m_sOldDoSet = m_sEdit_DoSet;
  42. UpdateData( true );
  43. return TRUE; // return TRUE unless you set the focus to a control
  44. // 异常: OCX 属性页应返回 FALSE
  45. }
  46. void CDlg_AddActionWithAlarm::OnBnClickedBtnChoose1()
  47. {
  48. CSelectVariantDlg dlg;
  49. dlg.m_nShowVarType = 2;
  50. if ( dlg.DoModal() == IDOK )
  51. {
  52. m_sEdit_DoSet = dlg.m_strVar;
  53. UpdateData(false);
  54. }
  55. }
  56. void CDlg_AddActionWithAlarm::OnBnClickedBtnChoose2()
  57. {
  58. CSelectVariantDlg dlg;
  59. dlg.m_nShowVarType = 2;
  60. if ( dlg.DoModal() == IDOK )
  61. {
  62. m_sEdit_DoStatus = dlg.m_strVar;
  63. UpdateData(false);
  64. }
  65. }
  66. void CDlg_AddActionWithAlarm::OnBnClickedBtnPlanTime()
  67. {
  68. CDlgDatePlan dlg;
  69. dlg.m_nPlanType = PLAN_TYPE_KG;
  70. dlg.m_sDoSetPlanTime = m_sDoSetPlanTime;
  71. if(dlg.DoModal() == IDOK)
  72. {
  73. m_sDoSetPlanTime = dlg.m_sDoSetPlanTime;
  74. }
  75. }
  76. void CDlg_AddActionWithAlarm::OnBnClickedOk()
  77. {
  78. if( m_sEdit_DoSet=="" || m_sEdit_DoStatus=="" )
  79. return;
  80. if( m_sDoSetPlanTime=="" )
  81. m_sDoSetPlanTime = "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
  82. UpdateData( true );
  83. OnOK();
  84. }