IDB00301F.cpp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. /*
  37. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  38. * Form과 DataModule class를 delete시킨다.
  39. * arguments
  40. *
  41. * return
  42. * void
  43. */
  44. void __fastcall TIDB00301::CommClose()
  45. {
  46. try
  47. {
  48. //CMM_SaveForm(g_sFormsDir, this);
  49. }
  50. catch(...)
  51. {
  52. }
  53. }
  54. //---------------------------------------------------------------------------
  55. /*
  56. * Form을 보여줄때 호출되는 event 메서드이다.
  57. * arguments
  58. * Sender : event handler 객체
  59. * return
  60. * void
  61. */
  62. void __fastcall TIDB00301::FormShow(TObject *Sender)
  63. {
  64. Refresh();
  65. }
  66. //---------------------------------------------------------------------------
  67. /*
  68. * Close 버튼 클릭 이벤트 핸들러
  69. * arguments
  70. * Sender : event handler 객체
  71. * return
  72. * void
  73. */
  74. void __fastcall TIDB00301::BtnCloseClick(TObject *Sender)
  75. {
  76. Close();
  77. }
  78. //---------------------------------------------------------------------------
  79. void __fastcall TIDB00301::FormClose(TObject *Sender, TCloseAction &Action)
  80. {
  81. CommClose();
  82. IDB00301 = NULL;
  83. //Action = caFree;
  84. }
  85. //---------------------------------------------------------------------------
  86. void __fastcall TIDB00301::BtnSaveClick(TObject *Sender)
  87. {
  88. if (Application->MessageBox(FrmLang->lblChangeInfo->Caption.c_str(), //L"정보를 수정 하시겠습니까?",
  89. Caption.c_str(), MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;
  90. TADOQuery *pADO = NULL;
  91. String sQry;
  92. String sId = EdId->Text.Trim();
  93. String sNm = EdNm->Text.Trim();
  94. String sStNm = EdStNm->Text.Trim();
  95. String sEdNm = EdEdNm->Text.Trim();
  96. try
  97. {
  98. try
  99. {
  100. pADO = new TADOQuery(NULL);
  101. pADO->Close();
  102. pADO->Connection = ITSDb_GetConnection();
  103. ITSDb_GetConnection()->BeginTrans();
  104. // 세부코드 삭제
  105. sQry = "UPDATE TB_IFSC \r\n"
  106. " SET IFSC_NM = :p02, \r\n"
  107. " STRT_NM = :p03, \r\n"
  108. " END_NM = :p04 \r\n"
  109. " WHERE IFSC_ID = :p01 \r\n";
  110. ITSDb_SQLText(pADO, sQry);
  111. ITSDb_SQLBind(pADO, "p01", sId);
  112. ITSDb_SQLBind(pADO, "p02", sNm);
  113. ITSDb_SQLBind(pADO, "p03", sStNm);
  114. ITSDb_SQLBind(pADO, "p04", sEdNm);
  115. ITSDb_SQLExec(pADO);
  116. ITSDb_GetConnection()->CommitTrans();
  117. FUpdated = true;
  118. Application->MessageBox(FrmLang->lblChangeOk->Caption.c_str(),//L"정보를 수정 하였습니다.",
  119. Caption.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  120. }
  121. catch(EDatabaseError &E)
  122. {
  123. ITSDb_GetConnection()->RollbackTrans();
  124. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  125. ShowMessage(String(E.ClassName()) + E.Message);
  126. }
  127. catch(Exception &exception)
  128. {
  129. ITSDb_GetConnection()->RollbackTrans();
  130. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  131. ShowMessage(String(exception.ClassName()) + exception.Message);
  132. }
  133. catch(...)
  134. {
  135. ITSDb_GetConnection()->RollbackTrans();
  136. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  137. ShowMessage(FrmLang->lblDbErr->Caption);//"데이터 수정 중에 알수없는 DB 오류가 발생하였습니다.");
  138. }
  139. }
  140. __finally
  141. {
  142. if (pADO)
  143. {
  144. pADO->Close();
  145. delete pADO;
  146. }
  147. }
  148. }
  149. //---------------------------------------------------------------------------