IDB00401F.cpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. #include "ITS_OPLibF.h"
  9. #pragma hdrstop
  10. #include "IDB00401F.h"
  11. //---------------------------------------------------------------------------
  12. #pragma package(smart_init)
  13. #pragma link "FRAME_NodeListF"
  14. #pragma link "cxButtons"
  15. #pragma link "cxContainer"
  16. #pragma link "cxControls"
  17. #pragma link "cxEdit"
  18. #pragma link "cxGraphics"
  19. #pragma link "cxGroupBox"
  20. #pragma link "cxLookAndFeelPainters"
  21. #pragma link "cxLookAndFeels"
  22. #pragma link "cxTextEdit"
  23. #pragma link "dxSkinBlack"
  24. #pragma link "dxSkinBlue"
  25. #pragma link "dxSkinsCore"
  26. #pragma link "dxSkinMcSkin"
  27. #pragma resource "*.dfm"
  28. TIDB00401 *IDB00401 = NULL;
  29. //---------------------------------------------------------------------------
  30. __fastcall TIDB00401::TIDB00401(TComponent* Owner)
  31. : TForm(Owner)
  32. {
  33. LangTrans->Translate(this, ITSDb_GetConnection());
  34. ITSSkin_Load(this);
  35. //CMM_LoadForm(g_sFormsDir, this);
  36. FUpdated = false;
  37. }
  38. //---------------------------------------------------------------------------
  39. void __fastcall TIDB00401::CommClose()
  40. {
  41. try
  42. {
  43. //CMM_SaveForm(g_sFormsDir, this);
  44. }
  45. catch(...)
  46. {
  47. }
  48. }
  49. //---------------------------------------------------------------------------
  50. void __fastcall TIDB00401::FormShow(TObject *Sender)
  51. {
  52. Refresh();
  53. }
  54. //---------------------------------------------------------------------------
  55. void __fastcall TIDB00401::BtnCloseClick(TObject *Sender)
  56. {
  57. Close();
  58. }
  59. //---------------------------------------------------------------------------
  60. void __fastcall TIDB00401::FormClose(TObject *Sender, TCloseAction &Action)
  61. {
  62. CommClose();
  63. IDB00401 = NULL;
  64. //Action = caFree;
  65. }
  66. //---------------------------------------------------------------------------
  67. void __fastcall TIDB00401::BtnSaveClick(TObject *Sender)
  68. {
  69. if (Application->MessageBox(FrmLang->lblChangeInfo->Caption.c_str(), //L"정보를 수정 하시겠습니까?",
  70. Caption.c_str(), MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
  71. TADOQuery *pADO = NULL;
  72. String sQry;
  73. String sId = EdId->Text.Trim();
  74. String sNm = EdNm->Text.Trim();
  75. String sStNm = EdStNm->Text.Trim();
  76. String sEdNm = EdEdNm->Text.Trim();
  77. try
  78. {
  79. try
  80. {
  81. pADO = new TADOQuery(NULL);
  82. pADO->Close();
  83. pADO->Connection = ITSDb_GetConnection();
  84. ITSDb_GetConnection()->BeginTrans();
  85. // 세부코드 삭제
  86. sQry = "UPDATE TB_ROAD \r\n"
  87. " SET ROAD_NAME = :p02, \r\n"
  88. " STRT_NM = :p03, \r\n"
  89. " END_NM = :p04 \r\n"
  90. " WHERE ROAD_ID = :p01 \r\n";
  91. ITSDb_SQLText(pADO, sQry);
  92. ITSDb_SQLBind(pADO, "p01", sId);
  93. ITSDb_SQLBind(pADO, "p02", sNm);
  94. ITSDb_SQLBind(pADO, "p03", sStNm);
  95. ITSDb_SQLBind(pADO, "p04", sEdNm);
  96. ITSDb_SQLExec(pADO);
  97. ITSDb_GetConnection()->CommitTrans();
  98. FUpdated = true;
  99. Application->MessageBox(FrmLang->lblChangeOk->Caption.c_str(),//L"정보를 수정 하였습니다.",
  100. Caption.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  101. }
  102. catch(EDatabaseError &E)
  103. {
  104. ITSDb_GetConnection()->RollbackTrans();
  105. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  106. DBERRORMSG(Caption, String(E.ClassName()), E.Message, sQry);
  107. throw Exception(String(E.ClassName()) + E.Message);
  108. }
  109. catch(Exception &e)
  110. {
  111. ITSDb_GetConnection()->RollbackTrans();
  112. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  113. DBERRORMSG(Caption, String(e.ClassName()), e.Message, sQry);
  114. throw Exception(String(e.ClassName()) + e.Message);
  115. }
  116. }
  117. __finally
  118. {
  119. if (pADO)
  120. {
  121. pADO->Close();
  122. delete pADO;
  123. }
  124. }
  125. }
  126. //---------------------------------------------------------------------------