IDB00401F.cpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. void __fastcall TIDB00401::CommClose()
  38. {
  39. try
  40. {
  41. //CMM_SaveForm(g_sFormsDir, this);
  42. }
  43. catch(...)
  44. {
  45. }
  46. }
  47. //---------------------------------------------------------------------------
  48. void __fastcall TIDB00401::FormShow(TObject *Sender)
  49. {
  50. Refresh();
  51. }
  52. //---------------------------------------------------------------------------
  53. void __fastcall TIDB00401::BtnCloseClick(TObject *Sender)
  54. {
  55. Close();
  56. }
  57. //---------------------------------------------------------------------------
  58. void __fastcall TIDB00401::FormClose(TObject *Sender, TCloseAction &Action)
  59. {
  60. CommClose();
  61. IDB00401 = NULL;
  62. //Action = caFree;
  63. }
  64. //---------------------------------------------------------------------------
  65. void __fastcall TIDB00401::BtnSaveClick(TObject *Sender)
  66. {
  67. if (Application->MessageBox(FrmLang->lblChangeInfo->Caption.c_str(), //L"정보를 수정 하시겠습니까?",
  68. Caption.c_str(), MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
  69. TADOQuery *pADO = NULL;
  70. String sQry;
  71. String sId = EdId->Text.Trim();
  72. String sNm = EdNm->Text.Trim();
  73. String sStNm = EdStNm->Text.Trim();
  74. String sEdNm = EdEdNm->Text.Trim();
  75. try
  76. {
  77. try
  78. {
  79. pADO = new TADOQuery(NULL);
  80. pADO->Close();
  81. pADO->Connection = ITSDb_GetConnection();
  82. ITSDb_GetConnection()->BeginTrans();
  83. // 세부코드 삭제
  84. sQry = "UPDATE TB_ROAD \r\n"
  85. " SET ROAD_NAME = :p02, \r\n"
  86. " STRT_NM = :p03, \r\n"
  87. " END_NM = :p04 \r\n"
  88. " WHERE ROAD_ID = :p01 \r\n";
  89. ITSDb_SQLText(pADO, sQry);
  90. ITSDb_SQLBind(pADO, "p01", sId);
  91. ITSDb_SQLBind(pADO, "p02", sNm);
  92. ITSDb_SQLBind(pADO, "p03", sStNm);
  93. ITSDb_SQLBind(pADO, "p04", sEdNm);
  94. ITSDb_SQLExec(pADO);
  95. ITSDb_GetConnection()->CommitTrans();
  96. FUpdated = true;
  97. Application->MessageBox(FrmLang->lblChangeOk->Caption.c_str(),//L"정보를 수정 하였습니다.",
  98. Caption.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  99. }
  100. catch(EDatabaseError &E)
  101. {
  102. ITSDb_GetConnection()->RollbackTrans();
  103. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  104. DBERRORMSG(Caption, String(E.ClassName()), E.Message, sQry);
  105. throw Exception(String(E.ClassName()) + E.Message);
  106. }
  107. catch(Exception &e)
  108. {
  109. ITSDb_GetConnection()->RollbackTrans();
  110. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  111. DBERRORMSG(Caption, String(e.ClassName()), e.Message, sQry);
  112. throw Exception(String(e.ClassName()) + e.Message);
  113. }
  114. }
  115. __finally
  116. {
  117. if (pADO)
  118. {
  119. pADO->Close();
  120. delete pADO;
  121. }
  122. }
  123. }
  124. //---------------------------------------------------------------------------