FRAME_VmsEvspListF.cpp 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "CDSCodeF.h"
  6. #include "CDSVmsEvspF.h"
  7. #pragma hdrstop
  8. #include "FRAME_VmsEvspListF.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 "cxContainer"
  16. #pragma link "cxControls"
  17. #pragma link "cxCustomData"
  18. #pragma link "cxData"
  19. #pragma link "cxDataStorage"
  20. #pragma link "cxEdit"
  21. #pragma link "cxFilter"
  22. #pragma link "cxGraphics"
  23. #pragma link "cxGrid"
  24. #pragma link "cxGridCustomTableView"
  25. #pragma link "cxGridCustomView"
  26. #pragma link "cxGridLevel"
  27. #pragma link "cxGridTableView"
  28. #pragma link "cxLookAndFeelPainters"
  29. #pragma link "cxLookAndFeels"
  30. #pragma link "cxStyles"
  31. #pragma link "cxTextEdit"
  32. #pragma link "dxSkinBlack"
  33. #pragma link "dxSkinBlue"
  34. #pragma link "dxSkinCaramel"
  35. #pragma link "dxSkinCoffee"
  36. #pragma link "dxSkinDarkRoom"
  37. #pragma link "dxSkinDarkSide"
  38. #pragma link "dxSkinFoggy"
  39. #pragma link "dxSkinGlassOceans"
  40. #pragma link "dxSkiniMaginary"
  41. #pragma link "dxSkinLilian"
  42. #pragma link "dxSkinLiquidSky"
  43. #pragma link "dxSkinLondonLiquidSky"
  44. #pragma link "dxSkinMcSkin"
  45. #pragma link "dxSkinMoneyTwins"
  46. #pragma link "dxSkinOffice2007Black"
  47. #pragma link "dxSkinOffice2007Blue"
  48. #pragma link "dxSkinOffice2007Green"
  49. #pragma link "dxSkinOffice2007Pink"
  50. #pragma link "dxSkinOffice2007Silver"
  51. #pragma link "dxSkinOffice2010Black"
  52. #pragma link "dxSkinOffice2010Blue"
  53. #pragma link "dxSkinOffice2010Silver"
  54. #pragma link "dxSkinsCore"
  55. #pragma link "dxSkinscxPCPainter"
  56. #pragma link "dxSkinSeven"
  57. #pragma link "dxSkinSharp"
  58. #pragma link "dxSkinSilver"
  59. #pragma link "dxSkinStardust"
  60. #pragma link "cxLabel"
  61. #pragma resource "*.dfm"
  62. //TFRAMEVmsEvspList *FRAMEVmsEvspList;
  63. //---------------------------------------------------------------------------
  64. __fastcall TFRAMEVmsEvspList::TFRAMEVmsEvspList(TComponent* Owner)
  65. : TFrame(Owner)
  66. {
  67. m_pGDC = TvList->DataController;
  68. //TvList->OptionsView->NoDataToDisplayInfoText = "<VMS 정보제공구간 정보가 없습니다>";
  69. FTitle = lblTitle->Caption;
  70. }
  71. //---------------------------------------------------------------------------
  72. void __fastcall TFRAMEVmsEvspList::UpdateList()
  73. {
  74. CMM_ClearGridTableView(TvList);
  75. int nRow = 0;
  76. TvList->BeginUpdate();
  77. try
  78. {
  79. VmsEvspManager->FLists.Lock();
  80. try
  81. {
  82. FOR_STL(TVmsEvsp*, pObj, VmsEvspManager->FLists)
  83. {
  84. //if (pObj->EDTN_CD == "EDI2") continue;
  85. if (pObj->USE_YN != "Y") continue;
  86. nRow = m_pGDC->AppendRecord();
  87. m_pGDC->Values[nRow][ColumnSel->Index] = false; //선택
  88. m_pGDC->Values[nRow][Column00->Index] = "-"; //편집
  89. m_pGDC->Values[nRow][Column01->Index] = pObj->VMS_EVSP_ID;
  90. m_pGDC->Values[nRow][Column02->Index] = pObj->VMS_EVSP_NM;
  91. m_pGDC->Values[nRow][Column03->Index] = pObj->DSPL_STRT_NODE_NM;
  92. m_pGDC->Values[nRow][Column04->Index] = pObj->DSPL_END_NODE_NM;
  93. m_pGDC->Values[nRow][Column05->Index] = pObj->AXIS_YN;
  94. m_pGDC->Values[nRow][Column99->Index] = (int)pObj;
  95. }
  96. }
  97. __finally
  98. {
  99. VmsEvspManager->FLists.UnLock();
  100. }
  101. }
  102. __finally
  103. {
  104. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  105. TvList->EndUpdate();
  106. TvList->DataController->GotoFirst();
  107. TvList->DataController->FocusedRecordIndex = 0;
  108. //CxList->SetFocus();
  109. }
  110. }
  111. //---------------------------------------------------------------------------
  112. void __fastcall TFRAMEVmsEvspList::BtnAllSelectClick(TObject *Sender)
  113. {
  114. TcxButton *pBtn = (TcxButton*)Sender;
  115. CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag);
  116. }
  117. //---------------------------------------------------------------------------
  118. int __fastcall TFRAMEVmsEvspList::GetSelIds(String &ALinkIds)
  119. {
  120. ALinkIds = "";
  121. if (TvList->ViewData->RecordCount <= 0) return 0;
  122. int nIndex = m_pGDC->FocusedRecordIndex;
  123. if( nIndex < 0 )
  124. return 0;
  125. String sLinkId = VarToStr(m_pGDC->Values[nIndex][Column01->Index]);
  126. ALinkIds = sLinkId;
  127. return 1;
  128. }
  129. //---------------------------------------------------------------------------
  130. int __fastcall TFRAMEVmsEvspList::GetSelIds(TStringList *AStringList)
  131. {
  132. int nSelCnt = 0;
  133. try
  134. {
  135. TvList->BeginUpdate();
  136. #if 0
  137. int nRowCnt = m_pGDC->RecordCount;
  138. for (int ii = 0; ii < nRowCnt; ii++)
  139. {
  140. if (((bool)m_pGDC->Values[ii][ColumnSel->Index]))
  141. {
  142. AStringList->Add(m_pGDC->Values[ii][Column00->Index]);
  143. nSelIdx++;
  144. }
  145. }
  146. #else
  147. int nRowCnt = TvList->ViewData->RecordCount;
  148. for (int ii = 0; ii < nRowCnt; ii++)
  149. {
  150. TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii];
  151. if (((bool)ARow->Values[ColumnSel->Index]))
  152. {
  153. AStringList->Add(ARow->Values[Column01->Index]);
  154. nSelCnt++;
  155. }
  156. }
  157. #endif
  158. }
  159. __finally
  160. {
  161. TvList->EndUpdate();
  162. }
  163. return nSelCnt;
  164. }
  165. //---------------------------------------------------------------------------
  166. void __fastcall TFRAMEVmsEvspList::TvListDataControllerFilterChanged(TObject *Sender)
  167. {
  168. //CMM_SetFilterLike(TvList);
  169. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  170. }
  171. //---------------------------------------------------------------------------
  172. void __fastcall TFRAMEVmsEvspList::BtnExlSaveClick(TObject *Sender)
  173. {
  174. TcxGrid *pGrid = CxList;
  175. TcxGridTableView *pView = TvList;
  176. String sTitle= FTitle;//"VMS정보제공구간";
  177. CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this);
  178. }
  179. //---------------------------------------------------------------------------
  180. void __fastcall TFRAMEVmsEvspList::OnCloseQuery(bool &CanClose)
  181. {
  182. }
  183. //---------------------------------------------------------------------------
  184. void __fastcall TFRAMEVmsEvspList::Column05CustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  185. bool &ADone)
  186. {
  187. int nRecordIdx = AViewInfo->GridRecord->RecordIndex;
  188. if (nRecordIdx < 0)
  189. {
  190. return;
  191. }
  192. try
  193. {
  194. int nItemIdx = AViewInfo->Item->Index;
  195. if (VarIsNull(AViewInfo->GridRecord->DisplayTexts[nItemIdx])) return;
  196. String sData = AViewInfo->GridRecord->DisplayTexts[nItemIdx];
  197. if (sData == "Y")
  198. {
  199. ACanvas->Canvas->Brush->Color = clLime;
  200. }
  201. }
  202. catch(Exception &e)
  203. {
  204. }
  205. }
  206. //---------------------------------------------------------------------------