IDB00301F.cpp 4.1 KB

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