FRAME_UnRegFacilityListF.cpp 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. #pragma hdrstop
  10. #include "FRAME_UnRegFacilityListF.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 "cxControls"
  18. #pragma link "cxCustomData"
  19. #pragma link "cxData"
  20. #pragma link "cxDataStorage"
  21. #pragma link "cxEdit"
  22. #pragma link "cxFilter"
  23. #pragma link "cxGraphics"
  24. #pragma link "cxGrid"
  25. #pragma link "cxGridCustomTableView"
  26. #pragma link "cxGridCustomView"
  27. #pragma link "cxGridLevel"
  28. #pragma link "cxGridTableView"
  29. #pragma link "cxLabel"
  30. #pragma link "cxLookAndFeelPainters"
  31. #pragma link "cxLookAndFeels"
  32. #pragma link "cxStyles"
  33. #pragma link "cxTextEdit"
  34. #pragma link "dxSkinBlack"
  35. #pragma link "dxSkinBlue"
  36. #pragma link "dxSkinsCore"
  37. #pragma link "dxSkinscxPCPainter"
  38. #pragma link "cxContainer"
  39. #pragma resource "*.dfm"
  40. //---------------------------------------------------------------------------
  41. __fastcall TFRAMEUnRegFacilityList::TFRAMEUnRegFacilityList(TComponent* Owner)
  42. : TFrame(Owner)
  43. {
  44. LangTrans->Translate(this, ITSDb_GetConnection());
  45. ColumnSel->Options->Filtering = false;
  46. m_pGDC = TvList->DataController;
  47. LangTrans->Translate(this, ITSDb_GetConnection());
  48. }
  49. //---------------------------------------------------------------------------
  50. void __fastcall TFRAMEUnRegFacilityList::UpdateList()
  51. {
  52. CMM_ClearGridTableView(TvList);
  53. int nRow = 0;
  54. try
  55. {
  56. TvList->BeginUpdate();
  57. try
  58. {
  59. ItsFacilityManager->FRegLists.Lock();
  60. FOR_STL(TItsRegFacility*, pObj, ItsFacilityManager->FRegLists)
  61. {
  62. if (pObj->UnRegisterd == "N") continue;
  63. nRow = m_pGDC->AppendRecord();
  64. pObj->GridIndex = nRow;
  65. m_pGDC->Values[nRow][ColumnSel->Index] = true; //¼±ÅÃ
  66. m_pGDC->Values[nRow][Column01->Index] = pObj->Type;
  67. m_pGDC->Values[nRow][Column02->Index] = pObj->Id;
  68. m_pGDC->Values[nRow][Column03->Index] = pObj->Name;
  69. m_pGDC->Values[nRow][Column99->Index] = (int)pObj;
  70. }
  71. }
  72. __finally
  73. {
  74. ItsFacilityManager->FRegLists.UnLock();
  75. }
  76. }
  77. __finally
  78. {
  79. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  80. TvList->EndUpdate();
  81. TvList->DataController->GotoFirst();
  82. TvList->DataController->FocusedRecordIndex = 0;
  83. //CxList->SetFocus();
  84. }
  85. }
  86. //---------------------------------------------------------------------------
  87. void __fastcall TFRAMEUnRegFacilityList::BtnAllSelectClick(TObject *Sender)
  88. {
  89. TcxButton *pBtn = (TcxButton*)Sender;
  90. CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag);
  91. }
  92. //---------------------------------------------------------------------------
  93. int __fastcall TFRAMEUnRegFacilityList::GetSelectIds(String &ALinkIds)
  94. {
  95. ALinkIds = "";
  96. if (TvList->ViewData->RecordCount <= 0) return 0;
  97. int nIndex = m_pGDC->FocusedRecordIndex;
  98. if( nIndex < 0 )
  99. return 0;
  100. String sLinkId = VarToStr(m_pGDC->Values[nIndex][Column01->Index]);
  101. ALinkIds = sLinkId;
  102. return 1;
  103. }
  104. //---------------------------------------------------------------------------
  105. void __fastcall TFRAMEUnRegFacilityList::TvListDataControllerFilterChanged(TObject *Sender)
  106. {
  107. CMM_SetFilterLike(TvList);
  108. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  109. }
  110. //---------------------------------------------------------------------------
  111. void __fastcall TFRAMEUnRegFacilityList::BtnExlSaveClick(TObject *Sender)
  112. {
  113. TcxGrid *pGrid = CxList;
  114. TcxGridTableView *pView = TvList;
  115. String sTitle= lblTitle->Caption;//"¹Ìµî·Ï½Ã¼³¹°Á¤º¸";
  116. CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this);
  117. }
  118. //---------------------------------------------------------------------------
  119. void __fastcall TFRAMEUnRegFacilityList::TvListMouseMove(TObject *Sender, TShiftState Shift, int X, int Y)
  120. {
  121. try
  122. {
  123. TcxGridSite *ASite = (TcxGridSite *)Sender;
  124. //Screen->Cursor = crDefault;
  125. //TcxCustomGridHitTest *AHitTest = tvSel->GetHitTest(X, Y);
  126. TcxCustomGridHitTest *AHitTest = dynamic_cast<TcxGridRecordHitTest*>(ASite->ViewInfo->GetHitTest(X, Y));
  127. if (dynamic_cast<TcxGridRecordHitTest*>(ASite->ViewInfo->GetHitTest(X, Y)))
  128. {
  129. int ARow = ((TcxGridRecordCellHitTest*)AHitTest)->GridRecord->Index;
  130. if (((TcxGridRecordCellHitTest*)AHitTest)->Item == NULL) return;
  131. int ACol = ((TcxGridRecordCellHitTest*)AHitTest)->Item->Index;
  132. if (ACol == ColumnSel->Index &&
  133. ARow < ASite->GridView->DataController->RecordCount-1)
  134. {
  135. Screen->Cursor = crHandPoint;
  136. }
  137. }
  138. else
  139. {
  140. Screen->Cursor = crDefault;
  141. }
  142. }
  143. catch(...)
  144. {
  145. }
  146. }
  147. //---------------------------------------------------------------------------