FRAME_DsrcListF.cpp 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "FrmResourceF.h"
  6. #include "ITSLangTransF.h"
  7. #pragma hdrstop
  8. #include "FRAME_DsrcListF.h"
  9. //---------------------------------------------------------------------------
  10. #pragma package(smart_init)
  11. #pragma link "cxButtons"
  12. #pragma link "cxCalc"
  13. #pragma link "cxCheckBox"
  14. #pragma link "cxClasses"
  15. #pragma link "cxControls"
  16. #pragma link "cxCustomData"
  17. #pragma link "cxData"
  18. #pragma link "cxDataStorage"
  19. #pragma link "cxEdit"
  20. #pragma link "cxFilter"
  21. #pragma link "cxGraphics"
  22. #pragma link "cxGrid"
  23. #pragma link "cxGridCustomTableView"
  24. #pragma link "cxGridCustomView"
  25. #pragma link "cxGridLevel"
  26. #pragma link "cxGridTableView"
  27. #pragma link "cxLookAndFeelPainters"
  28. #pragma link "cxLookAndFeels"
  29. #pragma link "cxStyles"
  30. #pragma link "cxTextEdit"
  31. #pragma link "dxSkinBlack"
  32. #pragma link "dxSkinBlue"
  33. #pragma link "dxSkinsCore"
  34. #pragma link "dxSkinscxPCPainter"
  35. #pragma resource "*.dfm"
  36. //TFRAMEDsrcRseList *FRAMEDsrcRseList;
  37. //---------------------------------------------------------------------------
  38. __fastcall TFRAMEDsrcList::TFRAMEDsrcList(TComponent* Owner)
  39. : TFrame(Owner)
  40. {
  41. ColumnSel->Options->Filtering = false;
  42. m_pGDC = TvList->DataController;
  43. TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<DSRC-RSE 정보가 없습니다>";
  44. MyItsDsrcManager = new TItsDsrcManager();
  45. MyItsDsrcManager->LoadFromDb();
  46. //FCodeIFD = ItsCodeManager->FLists.Find("IFD"); // 방향코드
  47. }
  48. //---------------------------------------------------------------------------
  49. void __fastcall TFRAMEDsrcList::UpdateList()
  50. {
  51. CMM_ClearGridTableView(TvList);
  52. int nRow = 0;
  53. try
  54. {
  55. TvList->BeginUpdate();
  56. try
  57. {
  58. MyItsDsrcManager->FLists.Lock();
  59. FOR_STL(TItsDsrc*, pObj, MyItsDsrcManager->FLists)
  60. {
  61. if (pObj->DEL_YN == "Y") continue;
  62. nRow = m_pGDC->AppendRecord();
  63. m_pGDC->Values[nRow][ColumnSel->Index] = false; //선택
  64. m_pGDC->Values[nRow][Column00->Index] = "-"; //편집
  65. m_pGDC->Values[nRow][Column01->Index] = pObj->ID; //ID
  66. m_pGDC->Values[nRow][Column02->Index] = pObj->RSE_ID; //RSE ID
  67. m_pGDC->Values[nRow][Column03->Index] = pObj->ISTL_LCTN_NM; //명칭
  68. m_pGDC->Values[nRow][Column99->Index] = (int)pObj;
  69. m_pGDC->Values[nRow][Column11->Index] = pObj->ID.ToIntDef(0); //ID
  70. m_pGDC->Values[nRow][Column12->Index] = pObj->RSE_ID; //RSE ID
  71. }
  72. }
  73. __finally
  74. {
  75. MyItsDsrcManager->FLists.UnLock();
  76. }
  77. }
  78. __finally
  79. {
  80. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  81. TvList->EndUpdate();
  82. TvList->DataController->GotoFirst();
  83. TvList->DataController->FocusedRecordIndex = 0;
  84. Column11->SortIndex = Column11->Index;
  85. Column11->SortOrder = soAscending;
  86. //CxList->SetFocus();
  87. }
  88. }
  89. //---------------------------------------------------------------------------
  90. void __fastcall TFRAMEDsrcList::BtnAllSelectClick(TObject *Sender)
  91. {
  92. TcxButton *pBtn = (TcxButton*)Sender;
  93. CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag);
  94. }
  95. //---------------------------------------------------------------------------
  96. int __fastcall TFRAMEDsrcList::GetSelIds(String &ALinkIds)
  97. {
  98. ALinkIds = "";
  99. if (TvList->ViewData->RecordCount <= 0) return 0;
  100. int nIndex = m_pGDC->FocusedRecordIndex;
  101. if( nIndex < 0 )
  102. return 0;
  103. String sLinkId = VarToStr(m_pGDC->Values[nIndex][Column01->Index]);
  104. ALinkIds = sLinkId;
  105. return 1;
  106. }
  107. //---------------------------------------------------------------------------
  108. int __fastcall TFRAMEDsrcList::GetSelIds(TStringList *AStringList)
  109. {
  110. int nSelCnt = 0;
  111. try
  112. {
  113. TvList->BeginUpdate();
  114. #if 0
  115. int nRowCnt = m_pGDC->RecordCount;
  116. for (int ii = 0; ii < nRowCnt; ii++)
  117. {
  118. if (((bool)m_pGDC->Values[ii][ColumnSel->Index]))
  119. {
  120. AStringList->Add(m_pGDC->Values[ii][Column00->Index]);
  121. nSelIdx++;
  122. }
  123. }
  124. #else
  125. int nRowCnt = TvList->ViewData->RecordCount;
  126. for (int ii = 0; ii < nRowCnt; ii++)
  127. {
  128. TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii];
  129. if (((bool)ARow->Values[ColumnSel->Index]))
  130. {
  131. AStringList->Add(ARow->Values[Column01->Index]);
  132. nSelCnt++;
  133. }
  134. }
  135. #endif
  136. }
  137. __finally
  138. {
  139. TvList->EndUpdate();
  140. }
  141. return nSelCnt;
  142. }
  143. //---------------------------------------------------------------------------
  144. void __fastcall TFRAMEDsrcList::TvListDataControllerFilterChanged(TObject *Sender)
  145. {
  146. CMM_SetFilterLike(TvList);
  147. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  148. }
  149. //---------------------------------------------------------------------------
  150. void __fastcall TFRAMEDsrcList::BtnExlSaveClick(TObject *Sender)
  151. {
  152. TcxGrid *pGrid = CxList;
  153. TcxGridTableView *pView = TvList;
  154. String sTitle= "DSRC-RSE정보";
  155. CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this);
  156. }
  157. //---------------------------------------------------------------------------
  158. void __fastcall TFRAMEDsrcList::OnCloseQuery(bool &CanClose)
  159. {
  160. try {
  161. if (MyItsDsrcManager)
  162. {
  163. delete MyItsDsrcManager;
  164. MyItsDsrcManager = NULL;
  165. }
  166. } catch(...) {}
  167. }
  168. //---------------------------------------------------------------------------