IDB00301F.cpp 4.2 KB

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