FRAME_UnRegFacilityListF.cpp 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "CDSFacilityF.h"
  6. #include "CDSCompanyF.h"
  7. #include "FrmResourceF.h"
  8. #include "ITSLangTransF.h"
  9. #include "CDSLayerF.h"
  10. #pragma hdrstop
  11. #include "FRAME_UnRegFacilityListF.h"
  12. //---------------------------------------------------------------------------
  13. #pragma package(smart_init)
  14. #pragma link "cxButtons"
  15. #pragma link "cxCalc"
  16. #pragma link "cxCheckBox"
  17. #pragma link "cxClasses"
  18. #pragma link "cxControls"
  19. #pragma link "cxCustomData"
  20. #pragma link "cxData"
  21. #pragma link "cxDataStorage"
  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 "cxStyles"
  34. #pragma link "cxTextEdit"
  35. #pragma link "dxSkinBlack"
  36. #pragma link "dxSkinBlue"
  37. #pragma link "dxSkinsCore"
  38. #pragma link "dxSkinscxPCPainter"
  39. #pragma link "cxContainer"
  40. #pragma link "dxSkinMcSkin"
  41. #pragma resource "*.dfm"
  42. //---------------------------------------------------------------------------
  43. __fastcall TFRAMEUnRegFacilityList::TFRAMEUnRegFacilityList(TComponent* Owner)
  44. : TFrame(Owner)
  45. {
  46. LangTrans->Translate(this, ITSDb_GetConnection());
  47. ColumnSel->Options->Filtering = false;
  48. m_pGDC = TvList->DataController;
  49. LangTrans->Translate(this, ITSDb_GetConnection());
  50. }
  51. //---------------------------------------------------------------------------
  52. void __fastcall TFRAMEUnRegFacilityList::UpdateList()
  53. {
  54. CMM_ClearGridTableView(TvList);
  55. TItsLayer *pLayer;
  56. int nRow = 0;
  57. try
  58. {
  59. TvList->BeginUpdate();
  60. try
  61. {
  62. ItsFacilityManager->FRegLists.Lock();
  63. FOR_STL(TItsRegFacility*, pObj, ItsFacilityManager->FRegLists)
  64. {
  65. if (pObj->UnRegisterd == "N") continue;
  66. nRow = m_pGDC->AppendRecord();
  67. pObj->GridIndex = nRow;
  68. m_pGDC->Values[nRow][ColumnSel->Index] = true; //선택
  69. pLayer = ItsLayerManager->FLists.Find(pObj->Type);
  70. if (pLayer)
  71. {
  72. m_pGDC->Values[nRow][Column01->Index] = pLayer->Name; // FCLT_TYPE VARCHAR(7 BYTE) NOT NULL, '시설물유형';
  73. }
  74. else
  75. {
  76. m_pGDC->Values[nRow][Column01->Index] = pObj->Type;
  77. }
  78. m_pGDC->Values[nRow][Column02->Index] = pObj->Id;
  79. m_pGDC->Values[nRow][Column03->Index] = pObj->Name;
  80. m_pGDC->Values[nRow][Column99->Index] = (int)pObj;
  81. }
  82. }
  83. __finally
  84. {
  85. ItsFacilityManager->FRegLists.UnLock();
  86. }
  87. }
  88. __finally
  89. {
  90. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  91. TvList->EndUpdate();
  92. TvList->DataController->GotoFirst();
  93. TvList->DataController->FocusedRecordIndex = 0;
  94. //CxList->SetFocus();
  95. }
  96. }
  97. //---------------------------------------------------------------------------
  98. void __fastcall TFRAMEUnRegFacilityList::BtnAllSelectClick(TObject *Sender)
  99. {
  100. TcxButton *pBtn = (TcxButton*)Sender;
  101. CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag);
  102. }
  103. //---------------------------------------------------------------------------
  104. int __fastcall TFRAMEUnRegFacilityList::GetSelectIds(String &ALinkIds)
  105. {
  106. ALinkIds = "";
  107. if (TvList->ViewData->RecordCount <= 0) return 0;
  108. int nIndex = m_pGDC->FocusedRecordIndex;
  109. if( nIndex < 0 )
  110. return 0;
  111. String sLinkId = VarToStr(m_pGDC->Values[nIndex][Column01->Index]);
  112. ALinkIds = sLinkId;
  113. return 1;
  114. }
  115. //---------------------------------------------------------------------------
  116. void __fastcall TFRAMEUnRegFacilityList::TvListDataControllerFilterChanged(TObject *Sender)
  117. {
  118. CMM_SetFilterLike(TvList);
  119. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  120. }
  121. //---------------------------------------------------------------------------
  122. void __fastcall TFRAMEUnRegFacilityList::BtnExlSaveClick(TObject *Sender)
  123. {
  124. TcxGrid *pGrid = CxList;
  125. TcxGridTableView *pView = TvList;
  126. String sTitle= lblTitle->Caption;//"미등록시설물정보";
  127. CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this);
  128. }
  129. //---------------------------------------------------------------------------
  130. void __fastcall TFRAMEUnRegFacilityList::TvListMouseMove(TObject *Sender, TShiftState Shift, int X, int Y)
  131. {
  132. try
  133. {
  134. TcxGridSite *ASite = (TcxGridSite *)Sender;
  135. //Screen->Cursor = crDefault;
  136. //TcxCustomGridHitTest *AHitTest = tvSel->GetHitTest(X, Y);
  137. TcxCustomGridHitTest *AHitTest = dynamic_cast<TcxGridRecordHitTest*>(ASite->ViewInfo->GetHitTest(X, Y));
  138. if (dynamic_cast<TcxGridRecordHitTest*>(ASite->ViewInfo->GetHitTest(X, Y)))
  139. {
  140. int ARow = ((TcxGridRecordCellHitTest*)AHitTest)->GridRecord->Index;
  141. if (((TcxGridRecordCellHitTest*)AHitTest)->Item == NULL) return;
  142. int ACol = ((TcxGridRecordCellHitTest*)AHitTest)->Item->Index;
  143. if (ACol == ColumnSel->Index &&
  144. ARow < ASite->GridView->DataController->RecordCount-1)
  145. {
  146. Screen->Cursor = crHandPoint;
  147. }
  148. }
  149. else
  150. {
  151. Screen->Cursor = crDefault;
  152. }
  153. }
  154. catch(...)
  155. {
  156. }
  157. }
  158. //---------------------------------------------------------------------------