IDB00201F.cpp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "AppGlobalF.h"
  6. #include "ITSLangTransF.h"
  7. #include "ITS_OPLibF.h"
  8. #pragma hdrstop
  9. #include "IDB00201F.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 link "dxSkinMcSkin"
  26. #pragma resource "*.dfm"
  27. TIDB00201 *IDB00201 = NULL;
  28. //---------------------------------------------------------------------------
  29. __fastcall TIDB00201::TIDB00201(TComponent* Owner)
  30. : TForm(Owner)
  31. {
  32. LangTrans->Translate(this, ITSDb_GetConnection());
  33. ITSSkin_Load(this);
  34. //CMM_LoadForm(g_sFormsDir, this);
  35. FUpdated = false;
  36. }
  37. //---------------------------------------------------------------------------
  38. void __fastcall TIDB00201::CommClose()
  39. {
  40. try
  41. {
  42. //CMM_SaveForm(g_sFormsDir, this);
  43. }
  44. catch(...)
  45. {
  46. }
  47. }
  48. //---------------------------------------------------------------------------
  49. void __fastcall TIDB00201::FormShow(TObject *Sender)
  50. {
  51. Refresh();
  52. }
  53. //---------------------------------------------------------------------------
  54. void __fastcall TIDB00201::BtnCloseClick(TObject *Sender)
  55. {
  56. Close();
  57. }
  58. //---------------------------------------------------------------------------
  59. void __fastcall TIDB00201::FormClose(TObject *Sender, TCloseAction &Action)
  60. {
  61. CommClose();
  62. IDB00201 = NULL;
  63. //Action = caFree;
  64. }
  65. //---------------------------------------------------------------------------
  66. void __fastcall TIDB00201::BtnSaveClick(TObject *Sender)
  67. {
  68. if (Application->MessageBox(FrmLang->lblChangeInfo->Caption.c_str(), //L"정보를 수정 하시겠습니까?",
  69. Caption.c_str(), MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
  70. TADOQuery *pADO = NULL;
  71. String sQry;
  72. String sId = EdId->Text.Trim();
  73. String sNm = EdNm->Text.Trim();
  74. try
  75. {
  76. try
  77. {
  78. pADO = new TADOQuery(NULL);
  79. pADO->Close();
  80. pADO->Connection = ITSDb_GetConnection();
  81. ITSDb_GetConnection()->BeginTrans();
  82. // 세부코드 삭제
  83. sQry = "UPDATE TB_LINK \r\n"
  84. " SET ROAD_NAME = :p02 \r\n"
  85. " WHERE LINK_ID = :p01 \r\n";
  86. ITSDb_SQLText(pADO, sQry);
  87. ITSDb_SQLBind(pADO, "p01", sId);
  88. ITSDb_SQLBind(pADO, "p02", sNm);
  89. ITSDb_SQLExec(pADO);
  90. ITSDb_GetConnection()->CommitTrans();
  91. FUpdated = true;
  92. Application->MessageBox(FrmLang->lblChangeOk->Caption.c_str(),//L"정보를 수정 하였습니다.",
  93. Caption.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  94. }
  95. catch(EDatabaseError &E)
  96. {
  97. ITSDb_GetConnection()->RollbackTrans();
  98. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  99. DBERRORMSG(Caption, String(E.ClassName()), E.Message, sQry);
  100. throw Exception(String(E.ClassName()) + E.Message);
  101. }
  102. catch(Exception &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. }
  110. __finally
  111. {
  112. if (pADO)
  113. {
  114. pADO->Close();
  115. delete pADO;
  116. }
  117. }
  118. }
  119. //---------------------------------------------------------------------------