IAN0030MF.cpp 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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 "IAN0030MF.h"
  9. #include "IAN00301F.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. TIAN0030M *IAN0030M = NULL;
  36. //---------------------------------------------------------------------------
  37. __fastcall TIAN0030M::TIAN0030M(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. CbLinkLevel->Properties->Items->Clear();
  47. CbLinkLevel->Properties->Items->Add(FrmLang->lblNmLink->Caption);//"링크 ( 1레벨 )");
  48. CbLinkLevel->Properties->Items->Add(FrmLang->lblNmIfsc->Caption);//"서비스링크 ( 2레벨 )");
  49. CbLinkLevel->Properties->Items->Add(FrmLang->lblNmRoad->Caption);//"도로 ( 3레벨 )");
  50. //CbLinkLevel->Properties->Items->Add("VMS");
  51. CbLinkLevel->ItemIndex = 0;
  52. }
  53. //---------------------------------------------------------------------------
  54. /*
  55. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  56. * Form과 DataModule class를 delete시킨다.
  57. * arguments
  58. *
  59. * return
  60. * void
  61. */
  62. void __fastcall TIAN0030M::CommClose()
  63. {
  64. try
  65. {
  66. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  67. {
  68. m_pFormList->Delete(idx);
  69. }
  70. delete m_pFormList;
  71. CMM_SaveForm(g_sFormsDir, this);
  72. }
  73. catch(...)
  74. {
  75. }
  76. }
  77. //---------------------------------------------------------------------------
  78. /*
  79. * Form을 보여줄때 호출되는 event 메서드이다.
  80. * arguments
  81. * Sender : event handler 객체
  82. * return
  83. * void
  84. */
  85. void __fastcall TIAN0030M::FormShow(TObject *Sender)
  86. {
  87. Refresh();
  88. FormInit();
  89. TmrShow->Enabled = true;
  90. }
  91. //---------------------------------------------------------------------------
  92. /*
  93. * form 초기화
  94. *
  95. * arguments
  96. *
  97. * return
  98. * void
  99. */
  100. void __fastcall TIAN0030M::FormInit()
  101. {
  102. DtStDate->Date = Now() - 1;
  103. DtEdDate->Date = Now() - 1;
  104. //DtEdTime->EditValue = Now().FormatString("hh");
  105. DtStTime->Time = StrToDateTime("00:00");
  106. DtEdTime->Time = StrToDateTime("23:59");
  107. }
  108. //---------------------------------------------------------------------------
  109. /*
  110. * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
  111. * arguments
  112. * Sender : event handler 객체
  113. * return
  114. * void
  115. */
  116. void __fastcall TIAN0030M::TmrShowTimer(TObject *Sender)
  117. {
  118. TmrShow->Enabled = false;
  119. }
  120. //---------------------------------------------------------------------------
  121. /*
  122. * Refresh Data Event Function
  123. * arguments
  124. *
  125. * return
  126. * void
  127. */
  128. void __fastcall TIAN0030M::RefreshData()
  129. {
  130. // 검색조건에 의한 링크 데이터 조회
  131. try
  132. {
  133. //SelListData();
  134. }
  135. __finally
  136. {
  137. }
  138. }
  139. //---------------------------------------------------------------------------
  140. /*
  141. * Search 버튼 클릭 이벤트 핸들러
  142. * arguments
  143. * Sender : event handler 객체
  144. * return
  145. * void
  146. */
  147. void __fastcall TIAN0030M::BtnSearchClick(TObject *Sender)
  148. {
  149. Application->ProcessMessages();
  150. TSqlCursor sqlCrs((TControl*)BtnSearch);
  151. #if 0
  152. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  153. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  154. #else
  155. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  156. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  157. #endif
  158. if (FStDateTime > FEdDateTime)
  159. {
  160. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  161. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  162. ActiveControl = DtStDate;
  163. return;
  164. }
  165. #if 0
  166. FStDateTime = FStDateTime + "0000";
  167. FEdDateTime = FEdDateTime + "5959";
  168. #else
  169. FStDateTime = FStDateTime + "00";
  170. FEdDateTime = FEdDateTime + "59";
  171. #endif
  172. FIdList = String(CbLinkLevel->ItemIndex+1);
  173. String sTitle = "[" + FStDateTime.SubString(1, 12) + "-" + FEdDateTime.SubString(1, 12) + "]";
  174. try
  175. {
  176. Application->ProcessMessages();
  177. LockWindowUpdate(Handle);
  178. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  179. if (!pSheet) return;
  180. IAN00301 = new TIAN00301(this, Handle, FStDateTime, FEdDateTime, FIdList);
  181. IAN00301->Parent = pSheet;
  182. IAN00301->Show();
  183. PgTab->ActivePage = pSheet;
  184. pSheet = PgTab->ActivePage;
  185. m_pFormList->Add(IAN00301);
  186. }
  187. __finally
  188. {
  189. LockWindowUpdate(0);
  190. }
  191. }
  192. //---------------------------------------------------------------------------
  193. /*
  194. * Close 버튼 클릭 이벤트 핸들러
  195. * arguments
  196. * Sender : event handler 객체
  197. * return
  198. * void
  199. */
  200. void __fastcall TIAN0030M::BtnCloseClick(TObject *Sender)
  201. {
  202. Close();
  203. }
  204. //---------------------------------------------------------------------------
  205. /*
  206. * 조회결과 폼이 닫힐때 메시지를 받아 처리한다.
  207. * arguments
  208. * Sender : event handler 객체
  209. * return
  210. * void
  211. */
  212. void __fastcall TIAN0030M::OnSubFormClose(TMessage Msg)
  213. {
  214. int nActiveIdx = PgTab->ActivePageIndex;
  215. if (nActiveIdx <= 0) return;
  216. LockWindowUpdate(Handle);
  217. TcxTabSheet *pSheet = PgTab->ActivePage;
  218. if (pSheet)
  219. {
  220. delete pSheet;
  221. }
  222. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  223. m_pFormList->Delete(nActiveIdx);
  224. LockWindowUpdate(0);
  225. }
  226. //---------------------------------------------------------------------------
  227. /*
  228. * Tab Control의 Tab을 더블클릭하여 닫는다.
  229. * arguments
  230. * Sender : event handler 객체
  231. * return
  232. * void
  233. */
  234. void __fastcall TIAN0030M::PgTabDblClick(TObject *Sender)
  235. {
  236. TPoint APoint;
  237. APoint = PgTab->MouseDownPos;
  238. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  239. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  240. }
  241. //---------------------------------------------------------------------------
  242. void __fastcall TIAN0030M::FormClose(TObject *Sender, TCloseAction &Action)
  243. {
  244. CommClose();
  245. IAN0030M = NULL;
  246. Action = caFree;
  247. }
  248. //---------------------------------------------------------------------------
  249. void __fastcall TIAN0030M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  250. {
  251. int nActiveIdx = ATabIndex;
  252. if (nActiveIdx <= 0) return;
  253. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  254. m_pFormList->Delete(nActiveIdx);
  255. }
  256. //---------------------------------------------------------------------------