IDB00401F.cpp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "AppGlobalF.h"
  6. #include "ITSLangTransF.h"
  7. #include "ITSLangTransF.h"
  8. #pragma hdrstop
  9. #include "IDB00401F.h"
  10. //---------------------------------------------------------------------------
  11. #pragma package(smart_init)
  12. #pragma link "FRAME_NodeListF"
  13. #pragma link "cxButtons"
  14. #pragma link "cxContainer"
  15. #pragma link "cxControls"
  16. #pragma link "cxEdit"
  17. #pragma link "cxGraphics"
  18. #pragma link "cxGroupBox"
  19. #pragma link "cxLookAndFeelPainters"
  20. #pragma link "cxLookAndFeels"
  21. #pragma link "cxTextEdit"
  22. #pragma link "dxSkinBlack"
  23. #pragma link "dxSkinBlue"
  24. #pragma link "dxSkinsCore"
  25. #pragma resource "*.dfm"
  26. TIDB00401 *IDB00401 = NULL;
  27. //---------------------------------------------------------------------------
  28. __fastcall TIDB00401::TIDB00401(TComponent* Owner)
  29. : TForm(Owner)
  30. {
  31. LangTrans->Translate(this, ITSDb_GetConnection());
  32. ITSSkin_Load(this);
  33. //CMM_LoadForm(g_sFormsDir, this);
  34. FUpdated = false;
  35. }
  36. //---------------------------------------------------------------------------
  37. /*
  38. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  39. * Form과 DataModule class를 delete시킨다.
  40. * arguments
  41. *
  42. * return
  43. * void
  44. */
  45. void __fastcall TIDB00401::CommClose()
  46. {
  47. try
  48. {
  49. //CMM_SaveForm(g_sFormsDir, this);
  50. }
  51. catch(...)
  52. {
  53. }
  54. }
  55. //---------------------------------------------------------------------------
  56. /*
  57. * Form을 보여줄때 호출되는 event 메서드이다.
  58. * arguments
  59. * Sender : event handler 객체
  60. * return
  61. * void
  62. */
  63. void __fastcall TIDB00401::FormShow(TObject *Sender)
  64. {
  65. Refresh();
  66. }
  67. //---------------------------------------------------------------------------
  68. /*
  69. * Close 버튼 클릭 이벤트 핸들러
  70. * arguments
  71. * Sender : event handler 객체
  72. * return
  73. * void
  74. */
  75. void __fastcall TIDB00401::BtnCloseClick(TObject *Sender)
  76. {
  77. Close();
  78. }
  79. //---------------------------------------------------------------------------
  80. void __fastcall TIDB00401::FormClose(TObject *Sender, TCloseAction &Action)
  81. {
  82. CommClose();
  83. IDB00401 = NULL;
  84. //Action = caFree;
  85. }
  86. //---------------------------------------------------------------------------
  87. void __fastcall TIDB00401::BtnSaveClick(TObject *Sender)
  88. {
  89. if (Application->MessageBox(FrmLang->lblChangeInfo->Caption.c_str(), //L"정보를 수정 하시겠습니까?",
  90. Caption.c_str(), MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
  91. TADOQuery *pADO = NULL;
  92. String sQry;
  93. String sId = EdId->Text.Trim();
  94. String sNm = EdNm->Text.Trim();
  95. String sStNm = EdStNm->Text.Trim();
  96. String sEdNm = EdEdNm->Text.Trim();
  97. try
  98. {
  99. try
  100. {
  101. pADO = new TADOQuery(NULL);
  102. pADO->Close();
  103. pADO->Connection = ITSDb_GetConnection();
  104. ITSDb_GetConnection()->BeginTrans();
  105. // 세부코드 삭제
  106. sQry = "UPDATE TB_ROAD \r\n"
  107. " SET ROAD_NAME = :p02, \r\n"
  108. " STRT_NM = :p03, \r\n"
  109. " END_NM = :p04 \r\n"
  110. " WHERE ROAD_ID = :p01 \r\n";
  111. ITSDb_SQLText(pADO, sQry);
  112. ITSDb_SQLBind(pADO, "p01", sId);
  113. ITSDb_SQLBind(pADO, "p02", sNm);
  114. ITSDb_SQLBind(pADO, "p03", sStNm);
  115. ITSDb_SQLBind(pADO, "p04", sEdNm);
  116. ITSDb_SQLExec(pADO);
  117. ITSDb_GetConnection()->CommitTrans();
  118. FUpdated = true;
  119. Application->MessageBox(FrmLang->lblChangeOk->Caption.c_str(),//L"정보를 수정 하였습니다.",
  120. Caption.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  121. }
  122. catch(EDatabaseError &E)
  123. {
  124. ITSDb_GetConnection()->RollbackTrans();
  125. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  126. ShowMessage(String(E.ClassName()) + E.Message);
  127. }
  128. catch(Exception &exception)
  129. {
  130. ITSDb_GetConnection()->RollbackTrans();
  131. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  132. ShowMessage(String(exception.ClassName()) + exception.Message);
  133. }
  134. catch(...)
  135. {
  136. ITSDb_GetConnection()->RollbackTrans();
  137. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  138. ShowMessage(FrmLang->lblDbErr->Caption);//"데이터 수정 중에 알수없는 DB 오류가 발생하였습니다.");
  139. }
  140. }
  141. __finally
  142. {
  143. if (pADO)
  144. {
  145. pADO->Close();
  146. delete pADO;
  147. }
  148. }
  149. }
  150. //---------------------------------------------------------------------------