FRAME_SgnlCtlrListF.cpp 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITS_OPLibF.h"
  4. #include "ITSSkinF.h"
  5. #include "ITSUtilF.h"
  6. #include "ITSLangTransF.h"
  7. #include "CDSCodeF.h"
  8. #pragma hdrstop
  9. #include "FRAME_SgnlCtlrListF.h"
  10. //---------------------------------------------------------------------------
  11. #pragma package(smart_init)
  12. #pragma link "cxButtons"
  13. #pragma link "cxCalc"
  14. #pragma link "cxCheckBox"
  15. #pragma link "cxClasses"
  16. #pragma link "cxContainer"
  17. #pragma link "cxControls"
  18. #pragma link "cxCustomData"
  19. #pragma link "cxData"
  20. #pragma link "cxDataStorage"
  21. #pragma link "cxDropDownEdit"
  22. #pragma link "cxEdit"
  23. #pragma link "cxFilter"
  24. #pragma link "cxGraphics"
  25. #pragma link "cxGrid"
  26. #pragma link "cxGridCustomTableView"
  27. #pragma link "cxGridCustomView"
  28. #pragma link "cxGridLevel"
  29. #pragma link "cxGridTableView"
  30. #pragma link "cxLabel"
  31. #pragma link "cxLookAndFeelPainters"
  32. #pragma link "cxLookAndFeels"
  33. #pragma link "cxMaskEdit"
  34. #pragma link "cxStyles"
  35. #pragma link "cxTextEdit"
  36. #pragma link "dxSkinBlue"
  37. #pragma link "dxSkinsCore"
  38. #pragma link "dxSkinscxPCPainter"
  39. #pragma link "dxSkinBlack"
  40. #pragma link "dxSkinMcSkin"
  41. #pragma resource "*.dfm"
  42. //TFRAMESgnlCtlrList *FRAMESgnlCtlrList;
  43. //---------------------------------------------------------------------------
  44. __fastcall TFRAMESgnlCtlrList::TFRAMESgnlCtlrList(TComponent* Owner)
  45. : TFrame(Owner)
  46. {
  47. LangTrans->Translate(this, ITSDb_GetConnection());
  48. m_pGDC = TvList->DataController;
  49. //TvList->OptionsView->NoDataToDisplayInfoText = "<교차로교통량 정보가 없습니다>";
  50. //APP_FillCode(CbType, "VDST");
  51. FTitle = lblTitle->Caption;
  52. }
  53. //---------------------------------------------------------------------------
  54. void __fastcall TFRAMESgnlCtlrList::UpdateList(int AType/*=0*/)
  55. {
  56. CMM_ClearGridTableView(TvList);
  57. int nRow = 0;
  58. TvList->BeginUpdate();
  59. try
  60. {
  61. SgnlCtlrManager->FLists.Lock();
  62. try
  63. {
  64. FOR_STL(TSgnlCtlr*, pObj, SgnlCtlrManager->FLists)
  65. {
  66. nRow = m_pGDC->AppendRecord();
  67. m_pGDC->Values[nRow][ColumnSel->Index] = false;
  68. m_pGDC->Values[nRow][Column00->Index] = "-";
  69. m_pGDC->Values[nRow][Column01->Index] = pObj->SGNL_IXR_NMBR;
  70. m_pGDC->Values[nRow][Column02->Index] = pObj->SGNL_IXR_NMBR;
  71. m_pGDC->Values[nRow][Column03->Index] = pObj->IXR_NM;
  72. //m_pGDC->Values[nRow][Column07->Index] = pObj->LOCAL_GROUP_ID;
  73. //m_pGDC->Values[nRow][Column04->Index] = pObj->CROSS_TYPE;
  74. m_pGDC->Values[nRow][Column99->Index] = (int)pObj;
  75. }
  76. }
  77. __finally
  78. {
  79. SgnlCtlrManager->FLists.UnLock();
  80. }
  81. }
  82. __finally
  83. {
  84. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  85. TvList->EndUpdate();
  86. Column01->SortIndex = Column01->Index;
  87. Column01->SortOrder = soAscending;
  88. TvList->DataController->GotoFirst();
  89. TvList->DataController->FocusedRecordIndex = 0;
  90. }
  91. }
  92. //---------------------------------------------------------------------------
  93. void __fastcall TFRAMESgnlCtlrList::BtnAllSelectClick(TObject *Sender)
  94. {
  95. TcxButton *pBtn = (TcxButton*)Sender;
  96. CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag);
  97. }
  98. //---------------------------------------------------------------------------
  99. int __fastcall TFRAMESgnlCtlrList::GetSelIds(String &ALinkIds)
  100. {
  101. ALinkIds = "";
  102. if (TvList->ViewData->RecordCount <= 0) return 0;
  103. int nIndex = m_pGDC->FocusedRecordIndex;
  104. if( nIndex < 0 )
  105. return 0;
  106. String sLinkId = VarToStr(m_pGDC->Values[nIndex][Column01->Index]);
  107. ALinkIds = sLinkId;
  108. return 1;
  109. }
  110. //---------------------------------------------------------------------------
  111. int __fastcall TFRAMESgnlCtlrList::GetSelIds(TStringList *AStringList)
  112. {
  113. int nSelCnt = 0;
  114. try
  115. {
  116. TvList->BeginUpdate();
  117. int nRowCnt = TvList->ViewData->RecordCount;
  118. for (int ii = 0; ii < nRowCnt; ii++)
  119. {
  120. TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii];
  121. if (((bool)ARow->Values[ColumnSel->Index]))
  122. {
  123. AStringList->Add(ARow->Values[Column01->Index]);
  124. nSelCnt++;
  125. }
  126. }
  127. }
  128. __finally
  129. {
  130. TvList->EndUpdate();
  131. }
  132. return nSelCnt;
  133. }
  134. //---------------------------------------------------------------------------
  135. void __fastcall TFRAMESgnlCtlrList::TvListDataControllerFilterChanged(TObject *Sender)
  136. {
  137. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  138. }
  139. //---------------------------------------------------------------------------
  140. void __fastcall TFRAMESgnlCtlrList::BtnExlSaveClick(TObject *Sender)
  141. {
  142. TcxGrid *pGrid = CxList;
  143. TcxGridTableView *pView = TvList;
  144. String sTitle= FTitle;//"Vds정보";
  145. CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this);
  146. }
  147. //---------------------------------------------------------------------------
  148. void __fastcall TFRAMESgnlCtlrList::OnCloseQuery(bool &CanClose)
  149. {
  150. }
  151. //---------------------------------------------------------------------------