FRAME_CctvListF.cpp 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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 "CDSCctvCtlrF.h"
  9. #pragma hdrstop
  10. #include "FRAME_CctvListF.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 link "cxSpinEdit"
  43. #pragma resource "*.dfm"
  44. //TFRAMECctvList *FRAMECctvList;
  45. //---------------------------------------------------------------------------
  46. __fastcall TFRAMECctvList::TFRAMECctvList(TComponent* Owner)
  47. : TFrame(Owner)
  48. {
  49. LangTrans->Translate(this, ITSDb_GetConnection());
  50. m_pGDC = TvList->DataController;
  51. //TvList->OptionsView->NoDataToDisplayInfoText = "<CCTV Á¤º¸°¡ ¾ø½À´Ï´Ù>";
  52. #ifdef D_CCTV_HANTE
  53. APP_FillCode(CbType, "CTVT");
  54. Column07->Visible = true;
  55. Column09->Visible = true;
  56. Column06->Visible = false;
  57. Column13->Visible = false;
  58. #else
  59. APP_FillCode(CbType, "CTVT");
  60. APP_FillCode(CbLc, "ISTLT");
  61. Column07->Visible = false;
  62. Column09->Visible = false;
  63. Column06->Visible = true;
  64. Column13->Visible = true;
  65. #endif
  66. FTitle = lblTitle->Caption;
  67. }
  68. //---------------------------------------------------------------------------
  69. void __fastcall TFRAMECctvList::UpdateList()
  70. {
  71. CMM_ClearGridTableView(TvList);
  72. int nRow = 0;
  73. TvList->BeginUpdate();
  74. try
  75. {
  76. CctvCtlrManager->FLists.Lock();
  77. try
  78. {
  79. FOR_STL(TCctvCtlr*, pObj, CctvCtlrManager->FLists)
  80. {
  81. if (pObj->DEL_YN == "Y") continue;
  82. nRow = m_pGDC->AppendRecord();
  83. m_pGDC->Values[nRow][ColumnSel->Index] = false;
  84. m_pGDC->Values[nRow][Column00->Index] = "-";
  85. m_pGDC->Values[nRow][Column01->Index] = pObj->CCTV_CTLR_NMBR.ToIntDef(0);
  86. m_pGDC->Values[nRow][Column02->Index] = pObj->CCTV_CTLR_ID;
  87. m_pGDC->Values[nRow][Column03->Index] = pObj->CCTV_NM;
  88. m_pGDC->Values[nRow][Column05->Index] = pObj->CCTV_CTLR_IP;
  89. m_pGDC->Values[nRow][Column08->Index] = pObj->STRM_SESN_NM;
  90. #ifdef D_CCTV_HANTE
  91. m_pGDC->Values[nRow][Column04->Index] = APP_GetCodeName(CbType, pObj->CCTV_TYPE_CD);
  92. m_pGDC->Values[nRow][Column07->Index] = pObj->CCTV_IP;
  93. m_pGDC->Values[nRow][Column09->Index] = pObj->STRM_SVR_IP;
  94. #else
  95. m_pGDC->Values[nRow][Column04->Index] = APP_GetCodeName(CbType, pObj->CCTV_TYPE);
  96. m_pGDC->Values[nRow][Column06->Index] = pObj->CCTV_CTLR_PORT;
  97. m_pGDC->Values[nRow][Column13->Index] = pObj->INTR_RTMP_ADDR;
  98. #endif
  99. m_pGDC->Values[nRow][Column10->Index] = pObj->STRM_RTSP_ADDR;
  100. m_pGDC->Values[nRow][Column11->Index] = pObj->STRM_RTMP_ADDR;
  101. m_pGDC->Values[nRow][Column12->Index] = pObj->STRM_HTTP_ADDR;
  102. m_pGDC->Values[nRow][Column14->Index] = pObj->CCTV_SBST_DSPL_YN;
  103. m_pGDC->Values[nRow][Column15->Index] = APP_GetCodeName(CbLc, pObj->CCTV_AREA_DVSN);
  104. m_pGDC->Values[nRow][Column99->Index] = (int)pObj;
  105. }
  106. }
  107. __finally
  108. {
  109. CctvCtlrManager->FLists.UnLock();
  110. }
  111. }
  112. __finally
  113. {
  114. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  115. TvList->EndUpdate();
  116. Column01->SortIndex = Column01->Index;
  117. Column01->SortOrder = soAscending;
  118. TvList->DataController->GotoFirst();
  119. TvList->DataController->FocusedRecordIndex = 0;
  120. }
  121. }
  122. //---------------------------------------------------------------------------
  123. void __fastcall TFRAMECctvList::BtnAllSelectClick(TObject *Sender)
  124. {
  125. TcxButton *pBtn = (TcxButton*)Sender;
  126. CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag);
  127. }
  128. //---------------------------------------------------------------------------
  129. int __fastcall TFRAMECctvList::GetSelIds(String &ALinkIds)
  130. {
  131. ALinkIds = "";
  132. if (TvList->ViewData->RecordCount <= 0) return 0;
  133. int nIndex = m_pGDC->FocusedRecordIndex;
  134. if( nIndex < 0 )
  135. return 0;
  136. String sLinkId = VarToStr(m_pGDC->Values[nIndex][Column01->Index]);
  137. ALinkIds = sLinkId;
  138. return 1;
  139. }
  140. //---------------------------------------------------------------------------
  141. int __fastcall TFRAMECctvList::GetSelIds(TStringList *AStringList)
  142. {
  143. int nSelCnt = 0;
  144. try
  145. {
  146. TvList->BeginUpdate();
  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. }
  158. __finally
  159. {
  160. TvList->EndUpdate();
  161. }
  162. return nSelCnt;
  163. }
  164. //---------------------------------------------------------------------------
  165. void __fastcall TFRAMECctvList::TvListDataControllerFilterChanged(TObject *Sender)
  166. {
  167. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  168. }
  169. //---------------------------------------------------------------------------
  170. void __fastcall TFRAMECctvList::BtnExlSaveClick(TObject *Sender)
  171. {
  172. TcxGrid *pGrid = CxList;
  173. TcxGridTableView *pView = TvList;
  174. String sTitle= FTitle;//"CctvÁ¤º¸";
  175. CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this);
  176. }
  177. //---------------------------------------------------------------------------
  178. void __fastcall TFRAMECctvList::OnCloseQuery(bool &CanClose)
  179. {
  180. }
  181. //---------------------------------------------------------------------------
  182. void __fastcall TFRAMECctvList::TvListCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  183. bool &ADone)
  184. {
  185. if (AViewInfo && Column14->Visible)
  186. {
  187. String sDispImg = AViewInfo->GridRecord->DisplayTexts[Column14->Index];
  188. if (sDispImg == "Y")
  189. {
  190. ACanvas->Brush->Color = clYellow;
  191. }
  192. }
  193. }
  194. //---------------------------------------------------------------------------