FRAME_CrsListF.cpp 5.2 KB

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