IAN0010MF.cpp 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "AppGlobalF.h"
  6. #include "ITSLangTransF.h"
  7. #pragma hdrstop
  8. #include "IAN0010MF.h"
  9. #include "IAN00101F.h"
  10. //---------------------------------------------------------------------------
  11. #pragma package(smart_init)
  12. #pragma link "cxButtons"
  13. #pragma link "cxCalendar"
  14. #pragma link "cxContainer"
  15. #pragma link "cxControls"
  16. #pragma link "cxDropDownEdit"
  17. #pragma link "cxEdit"
  18. #pragma link "cxGraphics"
  19. #pragma link "cxGroupBox"
  20. #pragma link "cxLabel"
  21. #pragma link "cxLookAndFeelPainters"
  22. #pragma link "cxLookAndFeels"
  23. #pragma link "cxMaskEdit"
  24. #pragma link "cxPC"
  25. #pragma link "cxPCdxBarPopupMenu"
  26. #pragma link "cxSpinEdit"
  27. #pragma link "cxSplitter"
  28. #pragma link "cxTextEdit"
  29. #pragma link "cxTimeEdit"
  30. #pragma link "dxSkinBlack"
  31. #pragma link "dxSkinBlue"
  32. #pragma link "dxSkinsCore"
  33. #pragma link "dxSkinscxPCPainter"
  34. #pragma resource "*.dfm"
  35. TIAN0010M *IAN0010M = NULL;
  36. //---------------------------------------------------------------------------
  37. __fastcall TIAN0010M::TIAN0010M(TComponent* Owner)
  38. : TForm(Owner)
  39. {
  40. LangTrans->Translate(this, ITSDb_GetConnection());
  41. ITSSkin_Load(this);
  42. CMM_LoadForm(g_sFormsDir, this);
  43. FTitle = Caption;//"교통정보 수집결과 분석";
  44. m_pFormList = new TList();
  45. TsList01->TabVisible = false;
  46. }
  47. //---------------------------------------------------------------------------
  48. void __fastcall TIAN0010M::CommClose()
  49. {
  50. try
  51. {
  52. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  53. {
  54. m_pFormList->Delete(idx);
  55. }
  56. delete m_pFormList;
  57. CMM_SaveForm(g_sFormsDir, this);
  58. }
  59. catch(...)
  60. {
  61. }
  62. }
  63. //---------------------------------------------------------------------------
  64. void __fastcall TIAN0010M::FormShow(TObject *Sender)
  65. {
  66. Refresh();
  67. FormInit();
  68. TmrShow->Enabled = true;
  69. }
  70. //---------------------------------------------------------------------------
  71. void __fastcall TIAN0010M::FormInit()
  72. {
  73. DtStDate->Date = Now() - 1;
  74. DtEdDate->Date = Now() - 1;
  75. //DtEdTime->EditValue = Now().FormatString("hh");
  76. DtStTime->Time = StrToDateTime("00:00");
  77. DtEdTime->Time = StrToDateTime("23:59");
  78. }
  79. //---------------------------------------------------------------------------
  80. void __fastcall TIAN0010M::TmrShowTimer(TObject *Sender)
  81. {
  82. TmrShow->Enabled = false;
  83. }
  84. //---------------------------------------------------------------------------
  85. void __fastcall TIAN0010M::RefreshData()
  86. {
  87. // 검색조건에 의한 링크 데이터 조회
  88. try
  89. {
  90. //SelListData();
  91. }
  92. __finally
  93. {
  94. }
  95. }
  96. //---------------------------------------------------------------------------
  97. void __fastcall TIAN0010M::BtnSearchClick(TObject *Sender)
  98. {
  99. Application->ProcessMessages();
  100. TSqlCursor sqlCrs((TControl*)BtnSearch);
  101. #if 0
  102. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  103. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  104. #else
  105. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  106. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  107. #endif
  108. if (FStDateTime > FEdDateTime)
  109. {
  110. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  111. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  112. ActiveControl = DtStDate;
  113. return;
  114. }
  115. #if 0
  116. FStDateTime = FStDateTime + "0000";
  117. FEdDateTime = FEdDateTime + "5959";
  118. #else
  119. FStDateTime = FStDateTime + "00";
  120. FEdDateTime = FEdDateTime + "59";
  121. #endif
  122. FIdList = "";
  123. String sTitle = "[" + FStDateTime.SubString(1, 12) + "-" + FEdDateTime.SubString(1, 12) + "]";
  124. try
  125. {
  126. Application->ProcessMessages();
  127. LockWindowUpdate(Handle);
  128. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  129. if (!pSheet) return;
  130. IAN00101 = new TIAN00101(this, Handle, FStDateTime, FEdDateTime, FIdList);
  131. IAN00101->Parent = pSheet;
  132. IAN00101->Show();
  133. PgTab->ActivePage = pSheet;
  134. pSheet = PgTab->ActivePage;
  135. m_pFormList->Add(IAN00101);
  136. }
  137. __finally
  138. {
  139. LockWindowUpdate(0);
  140. }
  141. }
  142. //---------------------------------------------------------------------------
  143. void __fastcall TIAN0010M::BtnCloseClick(TObject *Sender)
  144. {
  145. Close();
  146. }
  147. //---------------------------------------------------------------------------
  148. void __fastcall TIAN0010M::OnSubFormClose(TMessage Msg)
  149. {
  150. int nActiveIdx = PgTab->ActivePageIndex;
  151. if (nActiveIdx <= 0) return;
  152. LockWindowUpdate(Handle);
  153. TcxTabSheet *pSheet = PgTab->ActivePage;
  154. if (pSheet)
  155. {
  156. delete pSheet;
  157. }
  158. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  159. m_pFormList->Delete(nActiveIdx);
  160. LockWindowUpdate(0);
  161. }
  162. //---------------------------------------------------------------------------
  163. void __fastcall TIAN0010M::PgTabDblClick(TObject *Sender)
  164. {
  165. TPoint APoint;
  166. APoint = PgTab->MouseDownPos;
  167. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  168. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  169. }
  170. //---------------------------------------------------------------------------
  171. void __fastcall TIAN0010M::FormClose(TObject *Sender, TCloseAction &Action)
  172. {
  173. CommClose();
  174. IAN0010M = NULL;
  175. Action = caFree;
  176. }
  177. //---------------------------------------------------------------------------
  178. void __fastcall TIAN0010M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  179. {
  180. int nActiveIdx = ATabIndex;
  181. if (nActiveIdx <= 0) return;
  182. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  183. m_pFormList->Delete(nActiveIdx);
  184. }
  185. //---------------------------------------------------------------------------