FrmParkMsgF.cpp 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSDbF.h"
  4. #include "ITSUtilF.h"
  5. #include "AppGlobalF.h"
  6. #include "ITSSkinF.h"
  7. #include "ITSLangTransF.h"
  8. #pragma hdrstop
  9. #include "FrmParkMsgF.h"
  10. //---------------------------------------------------------------------------
  11. #pragma package(smart_init)
  12. #pragma link "cxClasses"
  13. #pragma link "cxControls"
  14. #pragma link "cxCustomData"
  15. #pragma link "cxData"
  16. #pragma link "cxDataStorage"
  17. #pragma link "cxEdit"
  18. #pragma link "cxFilter"
  19. #pragma link "cxGraphics"
  20. #pragma link "cxGrid"
  21. #pragma link "cxGridCustomTableView"
  22. #pragma link "cxGridCustomView"
  23. #pragma link "cxGridLevel"
  24. #pragma link "cxGridTableView"
  25. #pragma link "cxLabel"
  26. #pragma link "cxLookAndFeelPainters"
  27. #pragma link "cxLookAndFeels"
  28. #pragma link "cxStyles"
  29. #pragma link "dxSkinBlack"
  30. #pragma link "dxSkinBlue"
  31. #pragma link "dxSkinsCore"
  32. #pragma link "dxSkinscxPCPainter"
  33. #pragma link "cxContainer"
  34. #pragma link "cxPC"
  35. #pragma link "cxPCdxBarPopupMenu"
  36. #pragma resource "*.dfm"
  37. TFrmParkMsg *FrmParkMsg = NULL;
  38. //---------------------------------------------------------------------------
  39. __fastcall TFrmParkMsg::TFrmParkMsg(TComponent* Owner, TPrltCtlr *AObj)
  40. : TForm(Owner)
  41. {
  42. LangTrans->Translate(this, ITSDb_GetConnection());
  43. FObj = AObj;
  44. pADO->Connection = ITSDb_GetConnection();
  45. TvList->OptionsView->NoDataToDisplayInfoText = "<주차정보>";
  46. }
  47. //---------------------------------------------------------------------------
  48. void __fastcall TFrmParkMsg::FormClose(TObject *Sender, TCloseAction &Action)
  49. {
  50. Action = caFree;
  51. }
  52. //---------------------------------------------------------------------------
  53. void __fastcall TFrmParkMsg::FormShow(TObject *Sender)
  54. {
  55. if (FObj)
  56. {
  57. Caption = FObj->PRLT_CTLR_ID + ": " + FObj->PRLT_NM;
  58. PnlMenu->Visible = FObj->REAL_DATA_YN == "Y" ? true : false;
  59. }
  60. TmrShow->Enabled = true;
  61. //EdNm->SetFocus();
  62. }
  63. //---------------------------------------------------------------------------
  64. void __fastcall TFrmParkMsg::TmrShowTimer(TObject *Sender)
  65. {
  66. TmrShow->Enabled = false;
  67. if (FObj)
  68. {
  69. //EdNmbr->Text = FObj->PRLT_CTLR_NMBR;
  70. //EdId->Text = FObj->PRLT_CTLR_ID;
  71. EdNm->Text = FObj->PRLT_NM;
  72. EdTel->Text = FObj->PRLT_TEL;
  73. EdAddr->Text = FObj->ISTL_LCTN_ADDR;
  74. MoPRLT_CHARGE_DESC->Lines->Text = FObj->PRLT_CHARGE_DESC;
  75. MoPRLT_OPER_DESC->Lines->Text = FObj->PRLT_OPER_DESC;
  76. MoPRLT_ETC_DESC->Lines->Text = FObj->PRLT_ETC_DESC;
  77. PnlMenu->Visible = FObj->REAL_DATA_YN == "Y" ? true : false;
  78. }
  79. TmrQry->Interval = 100;
  80. TmrQry->Enabled = true;
  81. }
  82. //---------------------------------------------------------------------------
  83. void __fastcall TFrmParkMsg::TmrQryTimer(TObject *Sender)
  84. {
  85. TmrQry->Enabled = false;
  86. if (!FObj) return;
  87. if (FObj->REAL_DATA_YN == "Y")
  88. {
  89. SelectParkMsg();
  90. }
  91. TmrQry->Interval = 60 * 1000;
  92. TmrQry->Enabled = true;
  93. }
  94. //---------------------------------------------------------------------------
  95. void __fastcall TFrmParkMsg::SelectParkMsg()
  96. {
  97. String sQry;
  98. if (!FObj)
  99. {
  100. return;
  101. }
  102. CMM_ClearGridTableView(TvList);
  103. sQry = "SELECT A.* \r\n"
  104. " FROM TB_PRLT_RT_INFR A \r\n"
  105. " WHERE A.PRLT_CTLR_NMBR = :p01 \r\n"
  106. " ORDER BY A.FLOR_NMBR \r\n";
  107. try
  108. {
  109. int nRow;
  110. TvList->BeginUpdate();
  111. try
  112. {
  113. pADO->Connection = ITSDb_GetConnection();
  114. ITSDb_SQLText(pADO, sQry);
  115. ITSDb_SQLBind(pADO, "p01", FObj->PRLT_CTLR_NMBR);
  116. ITSDb_SQLOpen(pADO);
  117. for( ; !pADO->Eof; pADO->Next())
  118. {
  119. nRow = TvList->DataController->AppendRecord();
  120. TvList->DataController->Values[nRow][Col00->Index] = pADO->FieldByName("FLOR_NMBR")->AsString;
  121. //TvList->DataController->Values[nRow][Col01->Index] = pADO->FieldByName("FLOR_NMBR")->AsString;
  122. //TvList->DataController->Values[nRow][Col02->Index] = pADO->FieldByName("UPDT_DT")->AsString;
  123. TvList->DataController->Values[nRow][Col02->Index] = ITSUtil_StrToDateTime(pADO->FieldByName("UPDT_DT")->AsString).FormatString(STR_DATETIME);
  124. TvList->DataController->Values[nRow][Col03->Index] = pADO->FieldByName("GNRL_RMND_PRZN_NUM")->AsString;
  125. TvList->DataController->Values[nRow][Col04->Index] = pADO->FieldByName("LGVH_RMND_PRZN_NUM")->AsString;
  126. TvList->DataController->Values[nRow][Col05->Index] = pADO->FieldByName("HVVH_RMND_PRZN_NUM")->AsString;
  127. TvList->DataController->Values[nRow][Col06->Index] = pADO->FieldByName("EMVH_RMND_PRZN_NUM")->AsString;
  128. TvList->DataController->Values[nRow][Col07->Index] = pADO->FieldByName("HNDC_RMND_PRZN_NUM")->AsString;
  129. TvList->DataController->Values[nRow][Col08->Index] = pADO->FieldByName("WMON_RMND_PRZN_NUM")->AsString;
  130. TvList->DataController->Values[nRow][Col09->Index] = pADO->FieldByName("ELVH_RMND_PRZN_NUM")->AsString;
  131. TvList->DataController->Values[nRow][Col10->Index] = pADO->FieldByName("ETC_RMND_PRZN_NUM")->AsString;
  132. }
  133. ITSDb_SQLClose(pADO);
  134. }
  135. catch(EDatabaseError &E)
  136. {
  137. throw Exception(String(E.ClassName()) + E.Message);
  138. }
  139. catch(...)
  140. {
  141. throw Exception("알수없는 오류가 발생하였습니다.");
  142. }
  143. }
  144. __finally
  145. {
  146. TvList->EndUpdate();
  147. }
  148. }
  149. //---------------------------------------------------------------------------
  150. void __fastcall TFrmParkMsg::FormDestroy(TObject *Sender)
  151. {
  152. TmrQry->Enabled = false;
  153. try {
  154. if (FObj) FObj->FData1 = NULL;
  155. } catch(...) {}
  156. }
  157. //---------------------------------------------------------------------------