CTV0300MF.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "AppGlobalF.h"
  4. #include "ITSSkinF.h"
  5. #include "ITSUtilF.h"
  6. #include "FrmCctvOprMainF.h"
  7. #include "ITSLangTransF.h"
  8. #pragma hdrstop
  9. #include "CTV0300MF.h"
  10. #include "CTV0101MF.h"
  11. //---------------------------------------------------------------------------
  12. #pragma package(smart_init)
  13. #pragma link "cxControls"
  14. #pragma link "cxGraphics"
  15. #pragma link "cxLookAndFeelPainters"
  16. #pragma link "cxLookAndFeels"
  17. #pragma link "cxPC"
  18. #pragma link "cxPCdxBarPopupMenu"
  19. #pragma link "dxSkinBlack"
  20. #pragma link "dxSkinBlue"
  21. #pragma link "dxSkinCaramel"
  22. #pragma link "dxSkinCoffee"
  23. #pragma link "dxSkinDarkRoom"
  24. #pragma link "dxSkinDarkSide"
  25. #pragma link "dxSkinFoggy"
  26. #pragma link "dxSkinGlassOceans"
  27. #pragma link "dxSkiniMaginary"
  28. #pragma link "dxSkinLilian"
  29. #pragma link "dxSkinLiquidSky"
  30. #pragma link "dxSkinLondonLiquidSky"
  31. #pragma link "dxSkinMcSkin"
  32. #pragma link "dxSkinMoneyTwins"
  33. #pragma link "dxSkinOffice2007Black"
  34. #pragma link "dxSkinOffice2007Blue"
  35. #pragma link "dxSkinOffice2007Green"
  36. #pragma link "dxSkinOffice2007Pink"
  37. #pragma link "dxSkinOffice2007Silver"
  38. #pragma link "dxSkinOffice2010Black"
  39. #pragma link "dxSkinOffice2010Blue"
  40. #pragma link "dxSkinOffice2010Silver"
  41. #pragma link "dxSkinsCore"
  42. #pragma link "dxSkinscxPCPainter"
  43. #pragma link "dxSkinSeven"
  44. #pragma link "dxSkinSharp"
  45. #pragma link "dxSkinSilver"
  46. #pragma link "dxSkinStardust"
  47. #pragma link "cxRadioGroup"
  48. #pragma link "cxButtons"
  49. #pragma link "cxClasses"
  50. #pragma link "cxCustomData"
  51. #pragma link "cxData"
  52. #pragma link "cxDataStorage"
  53. #pragma link "cxEdit"
  54. #pragma link "cxFilter"
  55. #pragma link "cxGrid"
  56. #pragma link "cxGridBandedTableView"
  57. #pragma link "cxGridCustomTableView"
  58. #pragma link "cxGridCustomView"
  59. #pragma link "cxGridLevel"
  60. #pragma link "cxGridTableView"
  61. #pragma link "cxStyles"
  62. #pragma link "cxTextEdit"
  63. #pragma resource "*.dfm"
  64. TCTV0300M *CTV0300M = NULL;
  65. //---------------------------------------------------------------------------
  66. __fastcall TCTV0300M::TCTV0300M(TComponent* Owner)
  67. : TForm(Owner)
  68. {
  69. LangTrans->Translate(this, ITSDb_GetConnection());
  70. ITSSkin_Load(this);
  71. LoadLocalSkin();
  72. //FMonitoringType = enMonitoringStopImage;
  73. if (FormStyle != fsMDIChild) CMM_LoadForm(g_sFormsDir, this);
  74. FListForm = new TList();
  75. FReady = false;
  76. FFormWidth = 209;
  77. FFormHeight = 276;
  78. IsFormResizing = false;
  79. }
  80. //---------------------------------------------------------------------------
  81. void __fastcall TCTV0300M::CommClose()
  82. {
  83. try
  84. {
  85. SAFE_DELETE(FListForm);
  86. if (FormStyle != fsMDIChild) CMM_SaveForm(g_sFormsDir, this);
  87. }
  88. catch(...)
  89. {
  90. }
  91. }
  92. //---------------------------------------------------------------------------
  93. void __fastcall TCTV0300M::FormCreate(TObject *Sender)
  94. {
  95. InitMonitoringForm();
  96. }
  97. //---------------------------------------------------------------------------
  98. void __fastcall TCTV0300M::FormShow(TObject *Sender)
  99. {
  100. Refresh();
  101. Application->ProcessMessages();
  102. TmrShow->Enabled = true;
  103. }
  104. //---------------------------------------------------------------------------
  105. void __fastcall TCTV0300M::FormActivate(TObject *Sender)
  106. {
  107. ActivateForm(true);
  108. }
  109. //---------------------------------------------------------------------------
  110. void __fastcall TCTV0300M::FormDeactivate(TObject *Sender)
  111. {
  112. ActivateForm(false);
  113. }
  114. //---------------------------------------------------------------------------
  115. void __fastcall TCTV0300M::LoadLocalSkin()
  116. {
  117. }
  118. //---------------------------------------------------------------------------
  119. void __fastcall TCTV0300M::TmrShowTimer(TObject *Sender)
  120. {
  121. TmrShow->Enabled = false;
  122. BtnSearchClick(NULL);
  123. }
  124. //---------------------------------------------------------------------------
  125. void __fastcall TCTV0300M::FormClose(TObject *Sender, TCloseAction &Action)
  126. {
  127. try {
  128. CommClose();
  129. CTV0300M = NULL;
  130. Action = caFree;
  131. } catch(...) {}
  132. }
  133. //---------------------------------------------------------------------------
  134. void __fastcall TCTV0300M::OnMainFormMessage(TMessage &Msg)
  135. {
  136. }
  137. //---------------------------------------------------------------------------
  138. void __fastcall TCTV0300M::OnVmsStateRefreshMessage(TMessage &Msg)
  139. {
  140. #if 0
  141. for(int ii = 0; ii < FListForm->Count; ii++)
  142. {
  143. TVMSBACKM *pForm = (TVMSBACKM*)FListForm->Items[ii];
  144. pForm->RefreshVmsStatus();
  145. }
  146. FRAMEVmsState1->SelVmsObj = FSelVmsObj;
  147. #endif
  148. }
  149. //---------------------------------------------------------------------------
  150. void __fastcall TCTV0300M::OnVmsFormRefreshMessage(TMessage &Msg)
  151. {
  152. #if 0
  153. for(int ii = 0; ii < FListForm->Count; ii++)
  154. {
  155. TVMSBACKM *pForm = (TVMSBACKM*)FListForm->Items[ii];
  156. pForm->RefreshVmsMessage();
  157. }
  158. FRAMEVmsState1->SelVmsObj = FSelVmsObj;
  159. if (FSelVmsObj)
  160. {
  161. FRAMEVmsMsgList1->LoadVmsMsgScenario(String(FSelVmsObj->VMS_CTLR_NMBR));
  162. }
  163. #endif
  164. }
  165. //---------------------------------------------------------------------------
  166. void __fastcall TCTV0300M::OnVmsSelectMessage(TMessage &Msg)
  167. {
  168. #if 0
  169. try {
  170. FSelVmsObj = (TVmsCtlr*)Msg.WParam;
  171. FRAMEVmsState1->SelVmsObj = FSelVmsObj;
  172. if (!FSelVmsObj) return;
  173. TVMSFORM0 *pSelForm = (TVMSFORM0*)Msg.LParam;
  174. if (pSelForm == FSelForm) return;
  175. if (FSelForm) FSelForm->SelectForm(false);
  176. FSelForm = pSelForm;
  177. if (FSelForm) FSelForm->SelectForm(true);
  178. FRAMEVmsMsgList1->LoadVmsMsgScenario(String(FSelVmsObj->VMS_CTLR_NMBR));
  179. } catch(...) {};
  180. #endif
  181. }
  182. //---------------------------------------------------------------------------
  183. void __fastcall TCTV0300M::InitMonitoringForm()
  184. {
  185. #if 0
  186. String sQry;
  187. TADOQuery *pADO = NULL;
  188. sQry = "SELECT COUNT(1) AS CNT \r\n"
  189. " FROM TB_VMS_MONITORING \r\n"
  190. " WHERE MONITORING_TYPE = :p01 \r\n";
  191. try
  192. {
  193. int nString(0), nFigure(0), nFormSeq(0);
  194. VmsManager->FLists.Lock();
  195. try
  196. {
  197. pADO = new TADOQuery(NULL);
  198. pADO->Close();
  199. pADO->Connection = ITSDb_GetConnection();
  200. ITSDb_SQLText(pADO, sQry);
  201. ITSDb_SQLBind(pADO, "p01", String(FMonitoringType));
  202. ITSDb_SQLOpen(pADO);
  203. int nFormCnt = pADO->FieldByName("CNT")->AsInteger;
  204. if (nFormCnt > 0) return;
  205. sQry = "INSERT INTO TB_VMS_MONITORING ( \r\n"
  206. " MONITORING_TYPE, \r\n"
  207. " MONITORING_NM, \r\n"
  208. " MONITORING_SEQ, \r\n"
  209. " VMS_CTLR_NMBR \r\n"
  210. " ) \r\n"
  211. " VALUES ( \r\n"
  212. " :p01, \r\n"
  213. " :p02, \r\n"
  214. " :p03, \r\n"
  215. " :p04 \r\n"
  216. " ) \r\n";
  217. ITSDb_SQLText(pADO, sQry);
  218. FOR_STL(TVmsCtlr*, pObj, VmsManager->FLists)
  219. {
  220. if (pObj->DEL_YN == "Y") continue;
  221. //String sFormName = "VMS 문자식";
  222. String sFormName = "VMS Text";
  223. if (pObj->VMS_USAG_TYPE_CD == "VUTN") //문자식
  224. {
  225. nFormSeq = ++nString;
  226. }
  227. else
  228. if (pObj->VMS_USAG_TYPE_CD == "VUTP") //도형식
  229. {
  230. //sFormName = "VMS 도형식";
  231. sFormName = "VMS Figure";
  232. nFormSeq = ++nFigure;
  233. }
  234. else continue;
  235. ITSDb_SQLBind(pADO, "p01", String(FMonitoringType));
  236. ITSDb_SQLBind(pADO, "p02", sFormName);
  237. ITSDb_SQLBind(pADO, "p03", String(nFormSeq));
  238. ITSDb_SQLBind(pADO, "p04", String(pObj->VMS_CTLR_NMBR));
  239. ITSDb_SQLExec(pADO);
  240. }
  241. }
  242. catch(EDatabaseError &E)
  243. {
  244. DBERRORMSG("VMS Monitoring screen query", String(E.ClassName()), E.Message, sQry);
  245. throw Exception(String(E.ClassName()) + E.Message);
  246. }
  247. catch(Exception &e)
  248. {
  249. DBERRORMSG("VMS Monitoring screen query", String(e.ClassName()), e.Message, sQry);
  250. throw Exception(String(e.ClassName()) + e.Message);
  251. }
  252. }
  253. __finally
  254. {
  255. if (pADO)
  256. {
  257. pADO->Close();
  258. delete pADO;
  259. }
  260. VmsManager->FLists.UnLock();
  261. }
  262. #endif
  263. }
  264. //---------------------------------------------------------------------------
  265. void __fastcall TCTV0300M::ActivateForm(bool AActivate)
  266. {
  267. }
  268. //---------------------------------------------------------------------------
  269. void __fastcall TCTV0300M::RefreshCctvStatus(bool ARealtime/*=false*/)
  270. {
  271. #if 0
  272. m_nListCommErr = 0;
  273. m_nListHamcErr = 0;
  274. m_nListCtrlErr = 0;
  275. ClearGridTableView(TvList);
  276. int nCctvCnt = ITSObjCctv_GetCount();
  277. TList *pCctvList = ITSObjCctv_GetList();
  278. if (!pCctvList) return;
  279. TcxGridDataController *pGDC = (TcxGridDataController *)TvList->DataController;
  280. try
  281. {
  282. TvList->BeginUpdate();
  283. pGDC->BeginUpdate();
  284. for (int ii = 0; ii < nCctvCnt; ii++)
  285. {
  286. TObjCctv *pInfo = (TObjCctv*)pCctvList->Items[ii];
  287. if (pInfo->CenterId != CenterId) continue;
  288. if (!pInfo->Installed) continue;
  289. int nRow = pGDC->AppendRecord();
  290. pGDC->Values[nRow][ColId->Index] = pInfo->Id;
  291. pGDC->Values[nRow][ColName->Index] = pInfo->Name;
  292. if (pInfo->Comm == INT_STATE_NORMAL)
  293. {
  294. pGDC->Values[nRow][ColCommS->Index] = "정상";
  295. // 함체 이상여부 체크
  296. if (pInfo->Door == INT_STATE_OPEN)
  297. {
  298. pGDC->Values[nRow][ColHamS->Index] = "이상";
  299. m_nListHamcErr++;
  300. }
  301. else
  302. if (pInfo->Door == INT_STATE_CLOSE)
  303. {
  304. pGDC->Values[nRow][ColHamS->Index] = "정상";
  305. }
  306. else
  307. {
  308. pGDC->Values[nRow][ColHamS->Index] = "-?-";
  309. }
  310. if (pInfo->Door == INT_STATE_UNKNOWN)
  311. {
  312. // 알수 없음 처리
  313. pGDC->Values[nRow][ColTemp->Index] = "-?-";
  314. pGDC->Values[nRow][ColVolt->Index] = "-?-";
  315. pGDC->Values[nRow][ColVoltOut->Index] = "-?-";
  316. pGDC->Values[nRow][ColCtrlS->Index] = "-?-";
  317. }
  318. else
  319. {
  320. pGDC->Values[nRow][ColTemp->Index] = String(pInfo->Temp);
  321. pGDC->Values[nRow][ColVolt->Index] = String(pInfo->Voltage);
  322. pGDC->Values[nRow][ColVoltOut->Index] = String(pInfo->VoltageOut);
  323. // 제어기 이상여부 체크
  324. if (pInfo->Camera == INT_STATE_ERROR ||
  325. pInfo->SetString == INT_STATE_ERROR ||
  326. pInfo->Battery == INT_STATE_ERROR)
  327. {
  328. pGDC->Values[nRow][ColCtrlS->Index] = "이상";
  329. m_nListCtrlErr++;
  330. }
  331. else
  332. {
  333. pGDC->Values[nRow][ColCtrlS->Index] = "정상";
  334. }
  335. }
  336. if (pInfo->Door == INT_STATE_OPEN || pInfo->Door == INT_STATE_CLOSE)
  337. {
  338. pGDC->Values[nRow][ColDoorS->Index] = pInfo->Door == INT_STATE_OPEN ? "열림" : "닫힘";
  339. }
  340. else
  341. {
  342. pGDC->Values[nRow][ColDoorS->Index] = "-?-";
  343. }
  344. if (pInfo->Fan == INT_STATE_STOP || pInfo->Fan == INT_STATE_RUN)
  345. {
  346. pGDC->Values[nRow][ColFanS->Index] = pInfo->Fan == INT_STATE_STOP ? "정지" : "동작";
  347. }
  348. else
  349. {
  350. pGDC->Values[nRow][ColFanS->Index] = "-?-";
  351. }
  352. if (pInfo->Heater == INT_STATE_STOP || pInfo->Heater == INT_STATE_RUN)
  353. {
  354. pGDC->Values[nRow][ColHeaterS->Index] = pInfo->Heater == INT_STATE_STOP ? "정지" : "동작";
  355. }
  356. else
  357. {
  358. pGDC->Values[nRow][ColHeaterS->Index] = "-?-";
  359. }
  360. if (pInfo->Camera == INT_STATE_NORMAL || pInfo->Camera == INT_STATE_ERROR)
  361. {
  362. pGDC->Values[nRow][ColCamS->Index] = pInfo->Camera == INT_STATE_ERROR ? "장애" : "정상";
  363. }
  364. else
  365. {
  366. pGDC->Values[nRow][ColCamS->Index] = "-?-";
  367. }
  368. if (pInfo->SetString == INT_STATE_NORMAL || pInfo->SetString == INT_STATE_ERROR)
  369. {
  370. pGDC->Values[nRow][ColTextS->Index] = pInfo->SetString == INT_STATE_ERROR ? "장애" : "정상";
  371. }
  372. else
  373. {
  374. pGDC->Values[nRow][ColTextS->Index] = "-?-";
  375. }
  376. if (pInfo->Battery == INT_STATE_NORMAL || pInfo->Battery == INT_STATE_ERROR)
  377. {
  378. pGDC->Values[nRow][ColBattS->Index] = pInfo->Battery == INT_STATE_ERROR ? "장애" : "정상";
  379. }
  380. else
  381. {
  382. pGDC->Values[nRow][ColBattS->Index] = "-?-";
  383. }
  384. #if 0
  385. pGDC->Values[nRow][ColDoorS->Index] = pInfo->Door == INT_STATE_OPEN ? "열림" : "닫힘";
  386. pGDC->Values[nRow][ColFanS->Index] = pInfo->Fan == INT_STATE_STOP ? "정지" : "동작";
  387. pGDC->Values[nRow][ColHeaterS->Index] = pInfo->Heater == INT_STATE_STOP ? "정지" : "동작";
  388. pGDC->Values[nRow][ColCamS->Index] = pInfo->Camera == INT_STATE_ERROR ? "장애" : "정상";
  389. pGDC->Values[nRow][ColTextS->Index] = pInfo->SetString == INT_STATE_ERROR ? "장애" : "정상";
  390. pGDC->Values[nRow][ColBattS->Index] = pInfo->Battery == INT_STATE_ERROR ? "장애" : "정상";
  391. pGDC->Values[nRow][ColTemp->Index] = String(pInfo->Temp);
  392. pGDC->Values[nRow][ColVolt->Index] = String(pInfo->Voltage);
  393. pGDC->Values[nRow][ColVoltOut->Index] = String(pInfo->VoltageOut);
  394. #endif
  395. }
  396. else
  397. {
  398. m_nListCommErr++;
  399. pGDC->Values[nRow][ColCommS->Index] = "장애";
  400. pGDC->Values[nRow][ColHamS->Index] = "-";
  401. pGDC->Values[nRow][ColCtrlS->Index] = "-";
  402. pGDC->Values[nRow][ColDoorS->Index] = "-";
  403. pGDC->Values[nRow][ColFanS->Index] = "-";
  404. pGDC->Values[nRow][ColHeaterS->Index] = "-";
  405. pGDC->Values[nRow][ColCamS->Index] = "-";
  406. pGDC->Values[nRow][ColTextS->Index] = "-";
  407. pGDC->Values[nRow][ColBattS->Index] = "-";
  408. pGDC->Values[nRow][ColTemp->Index] = "-";
  409. pGDC->Values[nRow][ColVolt->Index] = "-";
  410. pGDC->Values[nRow][ColVoltOut->Index] = "-";
  411. }
  412. pGDC->Values[nRow][ColFanOn->Index] = String(pInfo->SetFanOnTemp);
  413. pGDC->Values[nRow][ColFanOff->Index] = String(pInfo->SetFanOffTemp);
  414. pGDC->Values[nRow][ColHeaterOn->Index] = String(pInfo->SetHeaterOnTemp);
  415. pGDC->Values[nRow][ColHeaterOff->Index] = String(pInfo->SetHeaterOffTemp);
  416. }
  417. }
  418. __finally
  419. {
  420. pGDC->EndUpdate();
  421. TvList->DataController->Summary->Recalculate();
  422. TvList->EndUpdate();
  423. if (pGDC->RecordCount > 0) pGDC->FocusedRecordIndex = 0;
  424. }
  425. CctvCtlrManager->FLists.Lock();
  426. try
  427. {
  428. FOR_STL(TCctvCtlr*, pObj, CctvCtlrManager->FLists)
  429. {
  430. if (pObj->DEL_YN == "Y") continue;
  431. // Image Form update start
  432. TCTV0101M *pForm = (TCTV0101M *)FindCctvForm(pObj->CCTV_CTLR_NMBR);
  433. if (pForm == NULL)
  434. {
  435. pForm = new TCTV0101M(this);
  436. pForm->Parent = ScrollBox;
  437. pForm->FPHandle = (HWND)Handle;
  438. pForm->Align = alCustom;
  439. pForm->Hide();
  440. pForm->FObjInfo = pObj; // 상태메모리 할당
  441. pForm->FCTLR_NMBR = pObj->CCTV_CTLR_NMBR;
  442. pForm->LblName->Caption = pObj->ISTL_LCTN_NM;
  443. FListForm->Add((void*)pForm);
  444. FFormWidth = pForm->Width;
  445. FFormHeight= pForm->Height;
  446. }
  447. pForm->FDeleted = false;
  448. pForm->RefreshStatus(); // 상태정보 업데이트
  449. }
  450. }
  451. __finally
  452. {
  453. CctvCtlrManager->FLists.UnLock();
  454. }
  455. #endif
  456. }
  457. //---------------------------------------------------------------------------
  458. void __fastcall TCTV0300M::RefreshData()
  459. {
  460. try
  461. {
  462. LockWindowUpdate(Handle);
  463. RefreshCctvStatus(); // CCTV 상태정보 업데이트(delete, insert)
  464. }
  465. __finally
  466. {
  467. LockWindowUpdate(0);
  468. }
  469. }
  470. //---------------------------------------------------------------------------
  471. void __fastcall TCTV0300M::BtnSearchClick(TObject *Sender)
  472. {
  473. RefreshData();
  474. }
  475. //---------------------------------------------------------------------------
  476. void __fastcall TCTV0300M::SelCctvStopImage()
  477. {
  478. #if 0
  479. String sQry;
  480. try
  481. {
  482. LockWindowUpdate(Handle);
  483. int nForms = m_pFormList->Count;
  484. for (int ii = 0; ii < nForms; ii++)
  485. {
  486. TCTV00002 *pForm = (TCTV00002 *)m_pFormList->Items[ii];
  487. try {
  488. pForm->ImgCctv->Picture->Bitmap->FreeImage();
  489. //pForm->ImgCctv->Picture->Bitmap = NULL;
  490. pForm->ImgCctv->Picture->Assign(ImgNoData->Picture);
  491. } catch(...) {}
  492. }
  493. } __finally {
  494. LockWindowUpdate(0);
  495. }
  496. sQry = "SELECT A.CCTVID, A.COLLDT, A.IMG "
  497. " FROM RUTIS.CCTVIMG_BLOB A "
  498. " WHERE (A.CCTVID, A.COLLDT) IN (SELECT CCTVID, MAX(COLLDT) AS COLLDT "
  499. " FROM RUTIS.CCTVIMG_BLOB "
  500. " WHERE A.COLLDT >= SYSDATE - 15/1440 "
  501. " GROUP BY CCTVID) "
  502. " ORDER BY A.CCTVID ";
  503. try
  504. {
  505. ADO->Connection = ITSDb_GetConnection();
  506. ClearQry(ADO);
  507. SetQry(ADO, sQry);
  508. // ParamBind(ADO, "p01", m_sIdList);
  509. OpenQry(ADO);
  510. ADO->First();
  511. try
  512. {
  513. while(!ADO->Eof)
  514. {
  515. String sId = ADO->FieldByName("CCTVID")->AsString;
  516. TCTV00002 *pForm = (TCTV00002 *)FindCctvForm(sId);
  517. if (pForm)
  518. {
  519. String sCaption = pForm->Caption;
  520. TStream *pStream = NULL;
  521. pStream = ADO->CreateBlobStream(ADO->FieldByName("IMG"), bmRead);
  522. pStream->Position = 0;
  523. TJPEGImage *jp = new TJPEGImage();
  524. try
  525. {
  526. jp->LoadFromStream(pStream);
  527. pForm->ImgCctv->Picture->Assign(jp);
  528. }
  529. catch(...)
  530. {
  531. sCaption = sCaption + "[X]";
  532. }
  533. delete pStream;
  534. delete jp;
  535. }
  536. ADO->Next();
  537. }
  538. }
  539. __finally
  540. {
  541. ADO->Close();
  542. }
  543. }
  544. catch(EDatabaseError &E)
  545. {
  546. throw Exception(String(E.ClassName()) + E.Message);
  547. }
  548. catch (Exception &exception)
  549. {
  550. throw Exception(String(exception.ClassName()) + exception.Message);
  551. }
  552. #endif
  553. }
  554. //---------------------------------------------------------------------------
  555. void __fastcall TCTV0300M::WMEnterSizeMove(TMessage &Msg)
  556. {
  557. IsFormResizing = true;
  558. }
  559. //---------------------------------------------------------------------------
  560. void __fastcall TCTV0300M::WMExitSizeMove(TMessage &Msg)
  561. {
  562. IsFormResizing = false;
  563. }
  564. //---------------------------------------------------------------------------