VMSEDT0MF.cpp 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "AppGlobalF.h"
  6. #include "ITSLangTransF.h"
  7. #pragma hdrstop
  8. #include "VMSEDT0MF.h"
  9. #include "VMSSEL0MF.h"
  10. //---------------------------------------------------------------------------
  11. #pragma package(smart_init)
  12. #pragma link "cxButtons"
  13. #pragma link "cxCalendar"
  14. #pragma link "cxContainer"
  15. #pragma link "cxControls"
  16. #pragma link "cxDropDownEdit"
  17. #pragma link "cxEdit"
  18. #pragma link "cxGraphics"
  19. #pragma link "cxGroupBox"
  20. #pragma link "cxLabel"
  21. #pragma link "cxLookAndFeelPainters"
  22. #pragma link "cxLookAndFeels"
  23. #pragma link "cxMaskEdit"
  24. #pragma link "cxPC"
  25. #pragma link "cxPCdxBarPopupMenu"
  26. #pragma link "cxSpinEdit"
  27. #pragma link "cxSplitter"
  28. #pragma link "cxTextEdit"
  29. #pragma link "cxTimeEdit"
  30. #pragma link "dxSkinBlack"
  31. #pragma link "dxSkinBlue"
  32. #pragma link "dxSkinCaramel"
  33. #pragma link "dxSkinCoffee"
  34. #pragma link "dxSkinDarkRoom"
  35. #pragma link "dxSkinDarkSide"
  36. #pragma link "dxSkinFoggy"
  37. #pragma link "dxSkinGlassOceans"
  38. #pragma link "dxSkiniMaginary"
  39. #pragma link "dxSkinLilian"
  40. #pragma link "dxSkinLiquidSky"
  41. #pragma link "dxSkinLondonLiquidSky"
  42. #pragma link "dxSkinMcSkin"
  43. #pragma link "dxSkinMoneyTwins"
  44. #pragma link "dxSkinOffice2007Black"
  45. #pragma link "dxSkinOffice2007Blue"
  46. #pragma link "dxSkinOffice2007Green"
  47. #pragma link "dxSkinOffice2007Pink"
  48. #pragma link "dxSkinOffice2007Silver"
  49. #pragma link "dxSkinOffice2010Black"
  50. #pragma link "dxSkinOffice2010Blue"
  51. #pragma link "dxSkinOffice2010Silver"
  52. #pragma link "dxSkinsCore"
  53. #pragma link "dxSkinscxPCPainter"
  54. #pragma link "dxSkinSeven"
  55. #pragma link "dxSkinSharp"
  56. #pragma link "dxSkinSilver"
  57. #pragma link "dxSkinStardust"
  58. #pragma link "cxRadioGroup"
  59. #pragma link "cxClasses"
  60. #pragma link "cxCustomData"
  61. #pragma link "cxData"
  62. #pragma link "cxDataStorage"
  63. #pragma link "cxDBData"
  64. #pragma link "cxFilter"
  65. #pragma link "cxGrid"
  66. #pragma link "cxGridCustomTableView"
  67. #pragma link "cxGridCustomView"
  68. #pragma link "cxGridDBTableView"
  69. #pragma link "cxGridLevel"
  70. #pragma link "cxGridTableView"
  71. #pragma link "cxStyles"
  72. #pragma link "cxCheckBox"
  73. #pragma link "cxImage"
  74. #pragma link "cxButtonEdit"
  75. #pragma link "cxBlobEdit"
  76. #pragma link "cxColorComboBox"
  77. #pragma link "cxCalc"
  78. #pragma resource "*.dfm"
  79. TVMSEDT0M *VMSEDT0M = NULL;
  80. //---------------------------------------------------------------------------
  81. __fastcall TVMSEDT0M::TVMSEDT0M(TComponent* Owner)
  82. : TForm(Owner)
  83. {
  84. LangTrans->Translate(this, ITSDb_GetConnection());
  85. ITSSkin_Load(this);
  86. //CMM_LoadForm(g_sFormsDir, this);
  87. FUpdate= false;
  88. FTitle = Caption;//"VMS 폼 스케줄 일괄 관리";
  89. TvForm->OptionsView->DataRowHeight = 0;
  90. TvForm->OptionsView->CellAutoHeight = true;
  91. TvForm->OptionsView->Indicator = false;
  92. TvForm->OptionsCustomize->ColumnMoving = false;
  93. TvForm->OptionsCustomize->ColumnSorting = false;
  94. //TvForm->Columns[0]->Width = 40;
  95. //TvForm->Columns[0]->Options->HorzSizing = false;
  96. FStrTime = "";
  97. FEndTime = "";
  98. FSelected = false;
  99. }
  100. //---------------------------------------------------------------------------
  101. /*
  102. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  103. * Form과 DataModule class를 delete시킨다.
  104. * arguments
  105. *
  106. * return
  107. * void
  108. */
  109. void __fastcall TVMSEDT0M::CommClose()
  110. {
  111. try
  112. {
  113. //CMM_SaveForm(g_sFormsDir, this);
  114. }
  115. catch(...)
  116. {
  117. }
  118. }
  119. //---------------------------------------------------------------------------
  120. void __fastcall TVMSEDT0M::FormCreate(TObject *Sender)
  121. {
  122. //
  123. }
  124. //---------------------------------------------------------------------------
  125. /*
  126. * Form을 보여줄때 호출되는 event 메서드이다.
  127. * arguments
  128. * Sender : event handler 객체
  129. * return
  130. * void
  131. */
  132. void __fastcall TVMSEDT0M::FormShow(TObject *Sender)
  133. {
  134. #if 1
  135. if (FMode == "A")
  136. {
  137. FTitle = lblText1->Caption;//"VMS 폼 스케줄 일괄 등록";
  138. GrpObj->Caption = lblText2->Caption;//"▶ VMS 목록";
  139. BtnAllDel->Visible = false;
  140. }
  141. else
  142. {
  143. FTitle = lblText3->Caption;//"VMS 폼 스케줄 일괄 편집";
  144. GrpObj->Caption = lblText4->Caption;//"▶ 선택폼을 스케줄에 사용중인 VMS 목록";
  145. }
  146. #else
  147. if (FMode == "A")
  148. {
  149. FTitle = "Batch add of VMS form schedule";
  150. GrpObj->Caption = "▶ VMS List";
  151. BtnAllDel->Visible = false;
  152. }
  153. else
  154. {
  155. FTitle = "Batch edit VMS form schedule";
  156. GrpObj->Caption = "▶ List the VMS using to schedule the selection form";
  157. }
  158. #endif
  159. Caption = FTitle;
  160. Refresh();
  161. FormInit();
  162. ChangeEditMode(1);
  163. TmrShow->Enabled = true;
  164. }
  165. //---------------------------------------------------------------------------
  166. void __fastcall TVMSEDT0M::FormInit()
  167. {
  168. FormObjectInit();
  169. FNewDb = false;
  170. }
  171. //---------------------------------------------------------------------------
  172. void __fastcall TVMSEDT0M::FormObjectInit()
  173. {
  174. //TvList->OptionsView->NoDataToDisplayInfoText = "<관련 VMS 정보가 없습니다>";
  175. }
  176. //---------------------------------------------------------------------------
  177. void __fastcall TVMSEDT0M::TmrShowTimer(TObject *Sender)
  178. {
  179. TmrShow->Enabled = false;
  180. BtnSearchClick(NULL);
  181. }
  182. //---------------------------------------------------------------------------
  183. void __fastcall TVMSEDT0M::BtnCloseClick(TObject *Sender)
  184. {
  185. Close();
  186. }
  187. //---------------------------------------------------------------------------
  188. void __fastcall TVMSEDT0M::FormClose(TObject *Sender, TCloseAction &Action)
  189. {
  190. CommClose();
  191. VMSEDT0M = NULL;
  192. //Action = caFree;
  193. }
  194. //---------------------------------------------------------------------------
  195. void __fastcall TVMSEDT0M::ChangeEditMode(int AEdit)
  196. {
  197. }
  198. //---------------------------------------------------------------------------
  199. void __fastcall TVMSEDT0M::BtnSearchClick(TObject *Sender)
  200. {
  201. RefreshData();
  202. EdFocus->SetFocus();
  203. ChangeEditMode(1);
  204. if (FStrTime == "")
  205. {
  206. DtStrDate->Date = Now();
  207. }
  208. else
  209. {
  210. TDateTime dtStrDate = APP_StrToDateTime(FStrTime);
  211. DtStrDate->Date = dtStrDate;
  212. DtStrTime->Date = dtStrDate;
  213. DtStrTime->Time = dtStrDate;
  214. }
  215. if (FEndTime == "")
  216. {
  217. TDateTime dtEndDate = EncodeDate(2099, 12, 31);
  218. TDateTime dtEndTime = EncodeTime(23, 59, 59, 0);
  219. DtEndDate->Date = dtEndDate;
  220. DtEndTime->Date = dtEndDate;
  221. DtEndTime->Time = dtEndTime;
  222. }
  223. else
  224. {
  225. TDateTime dtEndDate = APP_StrToDateTime(FEndTime);
  226. DtEndDate->Date = dtEndDate;
  227. DtEndTime->Date = dtEndDate;
  228. DtEndTime->Time = dtEndDate;
  229. }
  230. }
  231. //---------------------------------------------------------------------------
  232. void __fastcall TVMSEDT0M::RefreshData()
  233. {
  234. // 검색조건에 의한 링크 데이터 조회
  235. FormClear();
  236. DisplayFormInfo(0);
  237. DisplayVmsInfo(0);
  238. }
  239. //---------------------------------------------------------------------------
  240. void __fastcall TVMSEDT0M::FormClear()
  241. {
  242. EdFormId->Clear();
  243. EdObjId->Clear();
  244. FNewDb = false;
  245. }
  246. //---------------------------------------------------------------------------
  247. void __fastcall TVMSEDT0M::DisplayInfo()
  248. {
  249. FormClear();
  250. ChangeEditMode(3);
  251. }
  252. //---------------------------------------------------------------------------
  253. void __fastcall TVMSEDT0M::DisplayFormInfo(int AIdx)
  254. {
  255. CMM_ClearGridTableView(TvForm);
  256. String sQry;
  257. TADOQuery *pADO = NULL;
  258. sQry = "SELECT A.* \r\n"
  259. " FROM TB_VMS_FORM A \r\n"
  260. " WHERE A.VMS_FORM_ID = :p01 \r\n"
  261. " ORDER BY A.VMS_FORM_ID \r\n";
  262. try
  263. {
  264. TvForm->BeginUpdate();
  265. TcxDataController *pGDC = TvForm->DataController;
  266. int nRow;
  267. try
  268. {
  269. pADO = new TADOQuery(NULL);
  270. pADO->Close();
  271. pADO->Connection = ITSDb_GetConnection();
  272. ITSDb_SQLText(pADO, sQry);
  273. ITSDb_SQLBind(pADO, "p01", FFormId);
  274. ITSDb_SQLOpen(pADO);
  275. for( ; !pADO->Eof; pADO->Next())
  276. {
  277. nRow = pGDC->AppendRecord();
  278. pGDC->Values[nRow][0] = pADO->FieldByName("VMS_FORM_ID")->AsString;
  279. pGDC->Values[nRow][1] = pADO->FieldByName("VMS_FORM_IMAG")->AsVariant;
  280. }
  281. }
  282. catch(EDatabaseError &E)
  283. {
  284. DBERRORMSG("TVMSEDT0M::DisplayFormInfo", String(E.ClassName()), E.Message, sQry);
  285. throw Exception(String(E.ClassName()) + E.Message);
  286. }
  287. catch(Exception &e)
  288. {
  289. DBERRORMSG("TVMSEDT0M::DisplayFormInfo", String(e.ClassName()), e.Message, sQry);
  290. throw Exception(String(e.ClassName()) + e.Message);
  291. }
  292. }
  293. __finally
  294. {
  295. if (pADO)
  296. {
  297. pADO->Close();
  298. delete pADO;
  299. }
  300. TvForm->ApplyBestFit(NULL, false, false);
  301. TvForm->EndUpdate();
  302. }
  303. }
  304. //---------------------------------------------------------------------------
  305. void __fastcall TVMSEDT0M::DisplayVmsInfo(int AIdx)
  306. {
  307. CMM_ClearGridTableView(TvList);
  308. String sQry;
  309. TADOQuery *pADO = NULL;
  310. String sWhere;
  311. if (FMode == "A")
  312. {
  313. sWhere = " AND A.VMS_CTLR_NMBR = B.VMS_CTLR_NMBR(+) \r\n";
  314. }
  315. else
  316. {
  317. sWhere = " AND A.VMS_CTLR_NMBR = B.VMS_CTLR_NMBR \r\n";
  318. }
  319. sQry = "SELECT A.VMS_CTLR_NMBR, A.VMS_CTLR_ID, A.VMS_NM, \r\n"
  320. " B.PHASE, B.DSPL_HH, B.DSPL_STRT_HH, B.DSPL_END_HH, \r\n"
  321. " B.USE_YN, B.VMS_FORM_ID, \r\n"
  322. " DECODE(B.VMS_CTLR_NMBR, NULL, 0, 1) AS FG \r\n"
  323. " FROM TB_VMS_CTLR A, \r\n"
  324. " (SELECT X.VMS_CTLR_NMBR, \r\n"
  325. " X.VMS_SCH_TYPE, \r\n"
  326. " X.VMS_SCH_FORM_TYPE, \r\n"
  327. " X.PHASE, \r\n"
  328. " X.VMS_FORM_ID, \r\n"
  329. " X.DSPL_STRT_HH, \r\n"
  330. " X.DSPL_END_HH, \r\n"
  331. " X.DSPL_HH, \r\n"
  332. " X.FRST_VMS_IFSC_ID, \r\n"
  333. " X.SECD_VMS_IFSC_ID, \r\n"
  334. " X.THIR_VMS_IFSC_ID, \r\n"
  335. " X.FOUR_VMS_IFSC_ID, \r\n"
  336. " X.FRST_IMG_IFSC_ID, \r\n"
  337. " X.SECD_IMG_IFSC_ID, \r\n"
  338. " X.THIR_IMG_IFSC_ID, \r\n"
  339. " X.FOUR_IMG_IFSC_ID, \r\n"
  340. " X.SYMBLIB_NMBR, \r\n"
  341. " X.STRM_ADDR, \r\n"
  342. " X.USE_YN, \r\n"
  343. " Y.VMS_TYPE_CD, \r\n"
  344. " Y.VMS_FORM_TYPE_CD, \r\n"
  345. " Y.VMS_FORM_NM \r\n"
  346. " FROM TB_VMS_DSPL_SCH X, \r\n"
  347. " TB_VMS_FORM Y \r\n"
  348. " WHERE X.VMS_FORM_ID = Y.VMS_FORM_ID \r\n"
  349. " AND X.VMS_SCH_TYPE = :p02 \r\n"
  350. " AND X.VMS_SCH_FORM_TYPE = :p03 \r\n"
  351. " AND X.VMS_FORM_ID = :p04) B \r\n"
  352. " WHERE A.VMS_TYPE_CD = :p01 \r\n"
  353. " AND A.DEL_YN = 'N' \r\n";
  354. sQry+= sWhere;
  355. try
  356. {
  357. TvList->BeginUpdate();
  358. TcxDataController *pGDC = TvList->DataController;
  359. int nRow;
  360. try
  361. {
  362. pADO = new TADOQuery(NULL);
  363. pADO->Close();
  364. pADO->Connection = ITSDb_GetConnection();
  365. ITSDb_SQLText(pADO, sQry);
  366. ITSDb_SQLBind(pADO, "p01", FVmsTypeCd);
  367. ITSDb_SQLBind(pADO, "p02", FScheType);
  368. ITSDb_SQLBind(pADO, "p03", FScheFormType);
  369. ITSDb_SQLBind(pADO, "p04", FFormId);
  370. ITSDb_SQLOpen(pADO);
  371. for( ; !pADO->Eof; pADO->Next())
  372. {
  373. String sFormId = pADO->FieldByName("VMS_FORM_ID")->AsString;
  374. if (FMode == "A")
  375. {
  376. if (sFormId == FFormId)
  377. {
  378. //전체추가인데 기존에 등록되어 있으면 추가하지 않는다.
  379. //continue;
  380. }
  381. }
  382. nRow = pGDC->AppendRecord();
  383. pGDC->Values[nRow][Col00->Index] = pADO->FieldByName("VMS_CTLR_NMBR")->AsString;
  384. pGDC->Values[nRow][Col01->Index] = pADO->FieldByName("VMS_CTLR_ID")->AsString;
  385. pGDC->Values[nRow][Col02->Index] = pADO->FieldByName("VMS_NM")->AsString;
  386. String sFlag = pADO->FieldByName("FG")->AsString;
  387. if (sFlag == "0")
  388. {
  389. pGDC->Values[nRow][ColumnSel->Index] = true;
  390. pGDC->Values[nRow][Col03->Index] = "4";
  391. pGDC->Values[nRow][Col04->Index] = Now().FormatString(STR_HHNN);
  392. pGDC->Values[nRow][Col05->Index] = "2099-12-31 23:59";
  393. pGDC->Values[nRow][Col06->Index] = "Y";
  394. pGDC->Values[nRow][Col07->Index] = "1";
  395. pGDC->Values[nRow][Col08->Index] = Now().FormatString("YYYYMMDDHHNN") + "00";
  396. pGDC->Values[nRow][Col09->Index] = "20991231235959";
  397. continue;
  398. }
  399. if (FMode == "A")
  400. {
  401. pGDC->Values[nRow][ColumnSel->Index] = false;
  402. }
  403. else
  404. {
  405. pGDC->Values[nRow][ColumnSel->Index] = true;
  406. }
  407. String sStrDate = pADO->FieldByName("DSPL_STRT_HH")->AsString;
  408. String sEndDate = pADO->FieldByName("DSPL_END_HH")->AsString;
  409. pGDC->Values[nRow][Col03->Index] = pADO->FieldByName("DSPL_HH")->AsString;
  410. pGDC->Values[nRow][Col04->Index] = ITSUtil_FormatStr(sStrDate, STR_HHNN);
  411. pGDC->Values[nRow][Col05->Index] = ITSUtil_FormatStr(sEndDate, STR_HHNN);
  412. pGDC->Values[nRow][Col06->Index] = pADO->FieldByName("USE_YN")->AsString;
  413. pGDC->Values[nRow][Col07->Index] = pADO->FieldByName("PHASE")->AsString;
  414. pGDC->Values[nRow][Col08->Index] = sStrDate;
  415. pGDC->Values[nRow][Col09->Index] = sEndDate;
  416. FStrTime = sStrDate;
  417. FEndTime = sEndDate;
  418. }
  419. }
  420. catch(EDatabaseError &E)
  421. {
  422. DBERRORMSG("TVMSEDT0M::DisplayVmsInfo", String(E.ClassName()), E.Message, sQry);
  423. throw Exception(String(E.ClassName()) + E.Message);
  424. }
  425. catch(Exception &e)
  426. {
  427. DBERRORMSG("TVMSEDT0M::DisplayVmsInfo", String(e.ClassName()), e.Message, sQry);
  428. throw Exception(String(e.ClassName()) + e.Message);
  429. }
  430. }
  431. __finally
  432. {
  433. if (pADO)
  434. {
  435. pADO->Close();
  436. delete pADO;
  437. }
  438. TvList->EndUpdate();
  439. }
  440. }
  441. //---------------------------------------------------------------------------
  442. void __fastcall TVMSEDT0M::BtnAllSelectClick(TObject *Sender)
  443. {
  444. TcxButton *pBtn = (TcxButton*)Sender;
  445. CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag);
  446. }
  447. //---------------------------------------------------------------------------
  448. void __fastcall TVMSEDT0M::TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  449. TMouseButton AButton, TShiftState AShift,
  450. bool &AHandled)
  451. {
  452. if (!ACellViewInfo) return;
  453. int nRow = Sender->DataController->FocusedRecordIndex;
  454. if( nRow <= -1 )
  455. return;
  456. TcxGridDataController *pDc = (TcxGridDataController*)Sender->DataController;
  457. int nColIdx = ACellViewInfo->Item->Index;
  458. String sStrDate = VarToStr(pDc->Values[nRow][Col08->Index]);
  459. String sEndDate = VarToStr(pDc->Values[nRow][Col09->Index]);
  460. {
  461. //표출기간설정
  462. TVMSSEL0M *pSelDate = new TVMSSEL0M(this);
  463. pSelDate->FStrTime = sStrDate;
  464. pSelDate->FEndTime = sEndDate;
  465. pSelDate->ShowModal();
  466. bool bSelected = pSelDate->FSelected;
  467. sStrDate = pSelDate->FStrTime;
  468. sEndDate = pSelDate->FEndTime;
  469. delete pSelDate;
  470. pSelDate = NULL;
  471. if (bSelected)
  472. {
  473. pDc->Values[nRow][Col04->Index] = ITSUtil_FormatStr(sStrDate, STR_HHNN);;
  474. pDc->Values[nRow][Col05->Index] = ITSUtil_FormatStr(sEndDate, STR_HHNN);;
  475. pDc->Values[nRow][Col08->Index] = sStrDate;
  476. pDc->Values[nRow][Col09->Index] = sEndDate;
  477. }
  478. return;
  479. }
  480. }
  481. //---------------------------------------------------------------------------
  482. bool __fastcall TVMSEDT0M::CheckData(bool ACheckData)
  483. {
  484. int nSelCnt = CMM_GetCheckCount(TvList, ColumnSel->Index);
  485. if (nSelCnt <= 0)
  486. {
  487. //Application->MessageBox(L"VMS Schedule Batch Management\r\nSelect the VMS you want to work on from the VMS list.", FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
  488. Application->MessageBox(lblText5->Caption.c_str(),//L"VMS 스케줄 일괄 관리\r\nVMS 목록에서 작업대상 VMS를 먼저 선택하세요.",
  489. FTitle.c_str(),
  490. MB_OK|MB_ICONERROR|MB_APPLMODAL);
  491. return false;
  492. }
  493. if (!ACheckData) return true;
  494. String sStrDate = DtStrDate->Date.FormatString("yyyymmdd");
  495. String sStrTime = DtStrTime->DateTime.FormatString("HHnn");
  496. String sEndDate = DtEndDate->Date.FormatString("yyyymmdd");
  497. String sEndTime = DtEndTime->DateTime.FormatString("HHnn");
  498. FStrTime = sStrDate + sStrTime;
  499. FEndTime = sEndDate + sEndTime;
  500. if (FStrTime > FEndTime)
  501. {
  502. //Application->MessageBox(L"The display start time is larger than the display end time.", L"Set VMS form expiration period", MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  503. Application->MessageBox(lblText6->Caption.c_str(),//L"표출 시작시각이 표출 종료시각 보다 큽니다.",
  504. lblText7->Caption.c_str(),//L"VMS 폼 표출기간 설정",
  505. MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  506. ActiveControl = DtStrDate;
  507. return false;
  508. }
  509. FStrTime = FStrTime + "00";
  510. FEndTime = FEndTime + "59";
  511. return true;
  512. }
  513. //---------------------------------------------------------------------------
  514. void __fastcall TVMSEDT0M::UpdateEditData()
  515. {
  516. try
  517. {
  518. TvList->BeginUpdate();
  519. int nRowCnt = TvList->ViewData->RecordCount;
  520. for (int ii = 0; ii < nRowCnt; ii++)
  521. {
  522. TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii];
  523. if (!ARow->IsData) continue;
  524. if (!((bool)ARow->Values[ColumnSel->Index]))
  525. {
  526. continue;
  527. }
  528. ARow->Values[Col03->Index] = CbCycle->Text.Trim();
  529. ARow->Values[Col04->Index] = ITSUtil_FormatStr(FStrTime, STR_HHNN);
  530. ARow->Values[Col05->Index] = ITSUtil_FormatStr(FEndTime, STR_HHNN);
  531. ARow->Values[Col06->Index] = CbUse->Text.Trim();
  532. //ARow->Values[Col07->Index] = ""; //phase
  533. ARow->Values[Col08->Index] = FStrTime;
  534. ARow->Values[Col09->Index] = FEndTime;
  535. }
  536. }
  537. __finally
  538. {
  539. TvList->EndUpdate();
  540. }
  541. }
  542. //---------------------------------------------------------------------------
  543. void __fastcall TVMSEDT0M::BtnAllAddClick(TObject *Sender)
  544. {
  545. //등록 - 등록 또는 수정 INSERT or UPDATE
  546. if (!CheckData(true)) return;
  547. #if 1
  548. if (Application->MessageBox(lblText8->Caption.c_str(),//L"VMS 스케줄 일괄 관리\r\n선택한 VMS에 대하여 스케줄 정보를 [[[동일내용으로]]] 저장 하시겠습니까?",
  549. FTitle.c_str(),
  550. MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
  551. #else
  552. if (Application->MessageBox(L"VMS schedule management\r\nDo you want to save schedule information for selected VMS [[[Same as above]]]?",
  553. FTitle.c_str(),
  554. MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
  555. #endif
  556. UpdateEditData(); //동일 편집내용을 VMS목록에 적용
  557. bool bResult;
  558. if (FMode == "A")
  559. {
  560. //INSERT
  561. bResult = InsertVmsSchedule();
  562. }
  563. else
  564. {
  565. //UPDATE
  566. bResult = UpdateVmsSchedule();
  567. }
  568. }
  569. //---------------------------------------------------------------------------
  570. void __fastcall TVMSEDT0M::BtnAllEdtClick(TObject *Sender)
  571. {
  572. //수정 - 등록 또는 수정 INSERT or UPDATE
  573. if (!CheckData(true)) return;
  574. #if 1
  575. if (Application->MessageBox(lblText9->Caption.c_str(),//L"VMS 스케줄 일괄 관리\r\n선택한 VMS에 대하여 스케줄 정보를 저장 하시겠습니까?",
  576. FTitle.c_str(),
  577. MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
  578. #else
  579. if (Application->MessageBox(L"VMS schedule management\r\nDo you want to save schedule information for selected VMS?",
  580. FTitle.c_str(),
  581. MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
  582. #endif
  583. bool bResult;
  584. if (FMode == "A")
  585. {
  586. //INSERT
  587. bResult = InsertVmsSchedule();
  588. }
  589. else
  590. {
  591. //UPDATE
  592. bResult = UpdateVmsSchedule();
  593. }
  594. }
  595. //---------------------------------------------------------------------------
  596. void __fastcall TVMSEDT0M::BtnAllDelClick(TObject *Sender)
  597. {
  598. //삭제 - 무조건 DELETE
  599. if (!CheckData(false)) return;
  600. #if 1
  601. if (Application->MessageBox(lblText10->Caption.c_str(),//L"VMS 스케줄 일괄 관리\r\n선택한 VMS에 대하여 스케줄 정보를 삭제하시겠습니까?",
  602. FTitle.c_str(),
  603. MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
  604. #else
  605. if (Application->MessageBox(L"VMS schedule management\r\nDo you want to delete the schedule information for the selected VMS?",
  606. FTitle.c_str(),
  607. MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
  608. #endif
  609. bool bResult = true;
  610. if (bResult)
  611. {
  612. bResult = DeleteVmsSchedule();
  613. }
  614. }
  615. //---------------------------------------------------------------------------
  616. bool __fastcall TVMSEDT0M::DeleteVmsSchedule()
  617. {
  618. bool bResult = false;
  619. String sQry;
  620. TADOQuery *pADO = NULL;
  621. sQry = "DELETE TB_VMS_DSPL_SCH \r\n"
  622. " WHERE VMS_CTLR_NMBR = :p01 \r\n"
  623. " AND VMS_SCH_TYPE = :p02 \r\n"
  624. " AND VMS_SCH_FORM_TYPE = :p03 \r\n"
  625. " AND PHASE = :p04 \r\n"
  626. " AND VMS_FORM_ID = :p05 \r\n";
  627. try
  628. {
  629. try
  630. {
  631. pADO = new TADOQuery(NULL);
  632. pADO->Close();
  633. pADO->Connection = ITSDb_GetConnection();
  634. ITSDb_SQLText(pADO, sQry);
  635. //ITSDb_GetConnection()->BeginTrans();
  636. int nRowCnt = TvList->ViewData->RecordCount;
  637. for (int ii = 0; ii < nRowCnt; ii++)
  638. {
  639. TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii];
  640. if (!ARow->IsData) continue;
  641. if (!((bool)ARow->Values[ColumnSel->Index]))
  642. {
  643. continue;
  644. }
  645. String sVmsNmbr = VarToStr(ARow->Values[Col00->Index]);
  646. String sScheType = FScheType;
  647. String sScheFormType = FScheFormType;
  648. String sPhase = VarToStr(ARow->Values[Col07->Index]);
  649. String sFormId = FFormId;
  650. ITSDb_SQLBind(pADO, "p01", sVmsNmbr);
  651. ITSDb_SQLBind(pADO, "p02", sScheType);
  652. ITSDb_SQLBind(pADO, "p03", sScheFormType);
  653. ITSDb_SQLBind(pADO, "p04", sPhase);
  654. ITSDb_SQLBind(pADO, "p05", sFormId);
  655. ITSDb_SQLExec(pADO);
  656. }
  657. //ITSDb_GetConnection()->CommitTrans();
  658. bResult = true;
  659. }
  660. catch(EDatabaseError &E)
  661. {
  662. ITSDb_GetConnection()->RollbackTrans();
  663. DBERRORMSG("TVMSEDT0M::DeleteVmsSchedule", String(E.ClassName()), E.Message, sQry);
  664. throw Exception(String(E.ClassName()) + E.Message);
  665. }
  666. catch(Exception &e)
  667. {
  668. ITSDb_GetConnection()->RollbackTrans();
  669. DBERRORMSG("TVMSEDT0M::DeleteVmsSchedule", String(e.ClassName()), e.Message, sQry);
  670. throw Exception(String(e.ClassName()) + e.Message);
  671. }
  672. }
  673. __finally
  674. {
  675. if (pADO)
  676. {
  677. pADO->Close();
  678. delete pADO;
  679. }
  680. }
  681. if (bResult)
  682. {
  683. #if 1
  684. Application->MessageBox(lblText11->Caption.c_str(),//L"VMS 스케줄 일괄 관리\r\nVMS 스케줄 정보를 삭제 하였습니다.",
  685. FTitle.c_str(),
  686. MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  687. #else
  688. Application->MessageBox(L"VMS schedule management\r\nDeleted the VMS schedule information.",
  689. FTitle.c_str(),
  690. MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  691. #endif
  692. FSelected = true;
  693. Close();
  694. }
  695. return bResult;
  696. }
  697. //---------------------------------------------------------------------------
  698. bool __fastcall TVMSEDT0M::UpdateVmsSchedule()
  699. {
  700. bool bResult = false;
  701. String sQry;
  702. TADOQuery *pADO = NULL;
  703. sQry = "UPDATE TB_VMS_DSPL_SCH \r\n"
  704. " SET DSPL_HH = :p05, \r\n"
  705. " DSPL_STRT_HH = :p06, \r\n"
  706. " DSPL_END_HH = :p07, \r\n"
  707. " USE_YN = :p08 \r\n"
  708. " WHERE VMS_CTLR_NMBR = :p01 \r\n"
  709. " AND VMS_SCH_TYPE = :p09 \r\n"
  710. " AND VMS_SCH_FORM_TYPE = :p02 \r\n"
  711. " AND PHASE = :p03 \r\n"
  712. " AND VMS_FORM_ID = :p04 \r\n";
  713. try
  714. {
  715. try
  716. {
  717. pADO = new TADOQuery(NULL);
  718. pADO->Close();
  719. pADO->Connection = ITSDb_GetConnection();
  720. ITSDb_SQLText(pADO, sQry);
  721. //ITSDb_GetConnection()->BeginTrans();
  722. int nRowCnt = TvList->ViewData->RecordCount;
  723. for (int ii = 0; ii < nRowCnt; ii++)
  724. {
  725. TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii];
  726. if (!ARow->IsData) continue;
  727. if (!((bool)ARow->Values[ColumnSel->Index]))
  728. {
  729. continue;
  730. }
  731. String sVmsNmbr = VarToStr(ARow->Values[Col00->Index]);
  732. String sScheType = FScheType;
  733. String sScheFormType = FScheFormType;
  734. String sPhase = VarToStr(ARow->Values[Col07->Index]);
  735. String sFormId = FFormId;
  736. String sDispHH = VarToStr(ARow->Values[Col03->Index]);
  737. String sStrTime = VarToStr(ARow->Values[Col08->Index]);
  738. String sEndTime = VarToStr(ARow->Values[Col09->Index]);
  739. String sUseYn = VarToStr(ARow->Values[Col06->Index]);
  740. ITSDb_SQLBind(pADO, "p01", sVmsNmbr);
  741. ITSDb_SQLBind(pADO, "p02", sScheFormType);
  742. ITSDb_SQLBind(pADO, "p03", sPhase);
  743. ITSDb_SQLBind(pADO, "p04", sFormId);
  744. ITSDb_SQLBind(pADO, "p05", sDispHH);
  745. ITSDb_SQLBind(pADO, "p06", sStrTime);
  746. ITSDb_SQLBind(pADO, "p07", sEndTime);
  747. ITSDb_SQLBind(pADO, "p08", sUseYn);
  748. ITSDb_SQLBind(pADO, "p09", sScheType);
  749. ITSDb_SQLExec(pADO);
  750. }
  751. //ITSDb_GetConnection()->CommitTrans();
  752. bResult = true;
  753. }
  754. catch(EDatabaseError &E)
  755. {
  756. ITSDb_GetConnection()->RollbackTrans();
  757. DBERRORMSG("TVMSEDT0M::UpdateVmsSchedule", String(E.ClassName()), E.Message, sQry);
  758. throw Exception(String(E.ClassName()) + E.Message);
  759. }
  760. catch(Exception &e)
  761. {
  762. ITSDb_GetConnection()->RollbackTrans();
  763. DBERRORMSG("TVMSEDT0M::UpdateVmsSchedule", String(e.ClassName()), e.Message, sQry);
  764. throw Exception(String(e.ClassName()) + e.Message);
  765. }
  766. }
  767. __finally
  768. {
  769. if (pADO)
  770. {
  771. pADO->Close();
  772. delete pADO;
  773. }
  774. }
  775. if (bResult)
  776. {
  777. #if 1
  778. Application->MessageBox(lblText12->Caption.c_str(),//L"VMS 스케줄 일괄 관리\r\nVMS 스케줄 정보를 수정 하였습니다.",
  779. FTitle.c_str(),
  780. MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  781. #else
  782. Application->MessageBox(L"VMS schedule management\r\Edited the VMS schedule information.",
  783. FTitle.c_str(),
  784. MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  785. #endif
  786. FSelected = true;
  787. Close();
  788. }
  789. return bResult;
  790. }
  791. //---------------------------------------------------------------------------
  792. bool __fastcall TVMSEDT0M::InsertVmsSchedule()
  793. {
  794. bool bResult = false;
  795. String sQry;
  796. TADOQuery *pADO = NULL;
  797. #if 0
  798. sQry = "INSERT INTO TB_VMS_DSPL_SCH ( \r\n"
  799. " VMS_CTLR_NMBR, \r\n"
  800. " VMS_SCH_TYPE, \r\n"
  801. " VMS_SCH_FORM_TYPE, \r\n"
  802. " PHASE, \r\n"
  803. " VMS_FORM_ID, \r\n"
  804. " DSPL_HH, \r\n"
  805. " DSPL_STRT_HH, \r\n"
  806. " DSPL_END_HH, \r\n"
  807. " SYMBLIB_NMBR, \r\n"
  808. " STRM_ADDR, \r\n"
  809. " USE_YN \r\n"
  810. " ) \r\n"
  811. " VALUES ( \r\n"
  812. " :p01, \r\n"
  813. " :p02, \r\n"
  814. " :p11, \r\n"
  815. " (SELECT NVL(MAX(PHASE), 0) + 1 \r\n"
  816. " FROM TB_VMS_DSPL_SCH \r\n"
  817. " WHERE VMS_CTLR_NMBR = :p08 \r\n"
  818. " AND VMS_SCH_TYPE = :p09 \r\n"
  819. " AND VMS_SCH_FORM_TYPE = :p10), \r\n"
  820. " :p03, \r\n"
  821. " :p04, \r\n"
  822. " :p05, \r\n"
  823. " :p06, \r\n"
  824. " :p12, \r\n"
  825. " :p13, \r\n"
  826. " :p07 \r\n"
  827. " ) \r\n";
  828. #else
  829. sQry = "INSERT INTO TB_VMS_DSPL_SCH ( \r\n"
  830. " VMS_CTLR_NMBR, \r\n"
  831. " VMS_SCH_TYPE, \r\n"
  832. " VMS_SCH_FORM_TYPE, \r\n"
  833. " PHASE, \r\n"
  834. " VMS_FORM_ID, \r\n"
  835. " DSPL_HH, \r\n"
  836. " DSPL_STRT_HH, \r\n"
  837. " DSPL_END_HH, \r\n"
  838. " SYMBLIB_NMBR, \r\n"
  839. " STRM_ADDR, \r\n"
  840. " USE_YN \r\n"
  841. " ) \r\n"
  842. " VALUES ( \r\n"
  843. " :p01, \r\n"
  844. " :p02, \r\n"
  845. " :p11, \r\n"
  846. " (SELECT NVL(MAX(PHASE), 0) + 1 \r\n"
  847. " FROM TB_VMS_DSPL_SCH \r\n"
  848. " WHERE VMS_CTLR_NMBR = :p08 \r\n"
  849. " AND VMS_SCH_TYPE = :p09), \r\n"
  850. " :p03, \r\n"
  851. " :p04, \r\n"
  852. " :p05, \r\n"
  853. " :p06, \r\n"
  854. " :p12, \r\n"
  855. " :p13, \r\n"
  856. " :p07 \r\n"
  857. " ) \r\n";
  858. #endif
  859. try
  860. {
  861. try
  862. {
  863. pADO = new TADOQuery(NULL);
  864. pADO->Close();
  865. pADO->Connection = ITSDb_GetConnection();
  866. ITSDb_SQLText(pADO, sQry);
  867. //ITSDb_GetConnection()->BeginTrans();
  868. int nRowCnt = TvList->ViewData->RecordCount;
  869. for (int ii = 0; ii < nRowCnt; ii++)
  870. {
  871. TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii];
  872. if (!ARow->IsData) continue;
  873. if (!((bool)ARow->Values[ColumnSel->Index]))
  874. {
  875. continue;
  876. }
  877. String sVmsNmbr = VarToStr(ARow->Values[Col00->Index]);
  878. String sScheType = FScheType;
  879. String sScheFormType = FScheFormType;
  880. String sFormId = FFormId;
  881. String sDispHH = VarToStr(ARow->Values[Col03->Index]);
  882. String sStrTime = VarToStr(ARow->Values[Col08->Index]);
  883. String sEndTime = VarToStr(ARow->Values[Col09->Index]);
  884. String sUseYn = VarToStr(ARow->Values[Col06->Index]);
  885. ITSDb_SQLBind(pADO, "p01", sVmsNmbr);
  886. ITSDb_SQLBind(pADO, "p02", sScheType);
  887. ITSDb_SQLBind(pADO, "p03", sFormId);
  888. ITSDb_SQLBind(pADO, "p04", sDispHH);
  889. ITSDb_SQLBind(pADO, "p05", sStrTime);
  890. ITSDb_SQLBind(pADO, "p06", sEndTime);
  891. ITSDb_SQLBind(pADO, "p07", sUseYn);
  892. ITSDb_SQLBind(pADO, "p08", sVmsNmbr);
  893. ITSDb_SQLBind(pADO, "p09", sScheType);
  894. //ITSDb_SQLBind(pADO, "p10", sScheFormType);
  895. ITSDb_SQLBind(pADO, "p11", sScheFormType);
  896. ITSDb_SQLBind(pADO, "p12", FSymbLibNmbr);
  897. ITSDb_SQLBind(pADO, "p13", FStreamAddr);
  898. ITSDb_SQLExec(pADO);
  899. }
  900. //ITSDb_GetConnection()->CommitTrans();
  901. bResult = true;
  902. }
  903. catch(EDatabaseError &E)
  904. {
  905. ITSDb_GetConnection()->RollbackTrans();
  906. DBERRORMSG("TVMSEDT0M::InsertVmsSchedule", String(E.ClassName()), E.Message, sQry);
  907. throw Exception(String(E.ClassName()) + E.Message);
  908. }
  909. catch(Exception &e)
  910. {
  911. ITSDb_GetConnection()->RollbackTrans();
  912. DBERRORMSG("TVMSEDT0M::InsertVmsSchedule", String(e.ClassName()), e.Message, sQry);
  913. throw Exception(String(e.ClassName()) + e.Message);
  914. }
  915. }
  916. __finally
  917. {
  918. if (pADO)
  919. {
  920. pADO->Close();
  921. delete pADO;
  922. }
  923. }
  924. if (bResult)
  925. {
  926. #if 1
  927. Application->MessageBox(lblText13->Caption.c_str(),//L"VMS 스케줄 일괄 관리\r\nVMS 스케줄 정보를 저장 하였습니다.",
  928. FTitle.c_str(),
  929. MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  930. #else
  931. Application->MessageBox(L"VMS schedule management\r\nVMS schedule information saved.",
  932. FTitle.c_str(),
  933. MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  934. #endif
  935. FSelected = true;
  936. Close();
  937. }
  938. return bResult;
  939. }
  940. //---------------------------------------------------------------------------
  941. bool __fastcall TVMSEDT0M::InsertVmsScheduleWeek()
  942. {
  943. bool bResult = false;
  944. #if 0
  945. String sQry;
  946. TADOQuery *pADO = NULL;
  947. sQry = "INSERT INTO TB_VMS_DSPL_SCH_WEEK ( \r\n"
  948. " VMS_CTLR_NMBR, \r\n"
  949. " VMS_SCH_TYPE, \r\n"
  950. " PHASE, \r\n"
  951. " WEEK_CD, \r\n"
  952. " SCH_HH \r\n"
  953. " ) \r\n"
  954. " VALUES( \r\n"
  955. " :p01, :p02, \r\n"
  956. " (SELECT NVL(MAX(PHASE), 0) \r\n"
  957. " FROM TB_VMS_DSPL_SCH \r\n"
  958. " WHERE VMS_CTLR_NMBR = :p05 \r\n"
  959. " AND VMS_SCH_TYPE = :p06 \r\n"
  960. " AND VMS_SCH_FORM_TYPE = :p07), \r\n"
  961. " :p03, :p04 \r\n"
  962. " ) \r\n";
  963. try
  964. {
  965. try
  966. {
  967. pADO = new TADOQuery(NULL);
  968. pADO->Close();
  969. pADO->Connection = ITSDb_GetConnection();
  970. ITSDb_SQLText(pADO, sQry);
  971. int nRowCnt = TvList->ViewData->RecordCount;
  972. for (int ii = 0; ii < nRowCnt; ii++)
  973. {
  974. TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii];
  975. if (!ARow->IsData) continue;
  976. if (!((bool)ARow->Values[ColumnSel->Index]))
  977. {
  978. continue;
  979. }
  980. String sVmsNmbr = VarToStr(ARow->Values[Col00->Index]);
  981. String sScheType = FScheType;
  982. String sScheFormType = FScheFormType;
  983. for (int jj = 1; jj <= 7; jj++)
  984. {
  985. ITSDb_SQLBind(pADO, "p01", sVmsNmbr);
  986. ITSDb_SQLBind(pADO, "p02", sScheType);
  987. ITSDb_SQLBind(pADO, "p03", String(jj));
  988. ITSDb_SQLBind(pADO, "p04", "111111111111111111111111");
  989. ITSDb_SQLBind(pADO, "p05", sVmsNmbr);
  990. ITSDb_SQLBind(pADO, "p06", sScheType);
  991. ITSDb_SQLBind(pADO, "p07", sScheFormType);
  992. pADO->ExecSQL();
  993. }
  994. }
  995. bResult = true;
  996. }
  997. catch(EDatabaseError &E)
  998. {
  999. ITSDb_GetConnection()->RollbackTrans();
  1000. DBERRORMSG("TVMSEDT0M::InsertVmsScheduleWeek", String(E.ClassName()), E.Message, sQry);
  1001. throw Exception(String(E.ClassName()) + E.Message);
  1002. }
  1003. catch(Exception &e)
  1004. {
  1005. ITSDb_GetConnection()->RollbackTrans();
  1006. DBERRORMSG("TVMSEDT0M::InsertVmsScheduleWeek", String(e.ClassName()), e.Message, sQry);
  1007. throw Exception(String(e.ClassName()) + e.Message);
  1008. }
  1009. }
  1010. __finally
  1011. {
  1012. if (pADO)
  1013. {
  1014. pADO->Close();
  1015. delete pADO;
  1016. }
  1017. }
  1018. #endif
  1019. return bResult;
  1020. }
  1021. //---------------------------------------------------------------------------