123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include "AppGlobalF.h"
- #include "ITSSkinF.h"
- #include "ITSUtilF.h"
- #include "ITSLangTransF.h"
- #include "ITS_OPLibF.h"
- #pragma hdrstop
- #include "EVSP200MF.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma link "cxButtons"
- #pragma link "cxClasses"
- #pragma link "cxContainer"
- #pragma link "cxControls"
- #pragma link "cxCustomData"
- #pragma link "cxData"
- #pragma link "cxDataStorage"
- #pragma link "cxEdit"
- #pragma link "cxFilter"
- #pragma link "cxGraphics"
- #pragma link "cxGrid"
- #pragma link "cxGridBandedTableView"
- #pragma link "cxGridCustomTableView"
- #pragma link "cxGridCustomView"
- #pragma link "cxGridLevel"
- #pragma link "cxGridTableView"
- #pragma link "cxGroupBox"
- #pragma link "cxLabel"
- #pragma link "cxLookAndFeelPainters"
- #pragma link "cxLookAndFeels"
- #pragma link "cxStyles"
- #pragma link "cxTextEdit"
- #pragma link "dxSkinBlue"
- #pragma link "dxSkinsCore"
- #pragma link "dxSkinscxPCPainter"
- #pragma link "dxSkinBlack"
- #pragma link "dxSkinMcSkin"
- #pragma link "cxSpinEdit"
- #pragma link "cxDropDownEdit"
- #pragma link "cxMaskEdit"
- #pragma resource "*.dfm"
- TEVSP200M *EVSP200M = NULL;
- //---------------------------------------------------------------------------
- __fastcall TEVSP200M::TEVSP200M(TComponent* Owner)
- : TForm(Owner)
- {
- LangTrans->Translate(this, ITSDb_GetConnection());
- ITSSkin_Load(this);
- LoadLocalSkin();
- FTitle = Caption;
- CMM_LoadForm(g_sFormsDir, this);
- }
- //---------------------------------------------------------------------------
- void __fastcall TEVSP200M::CommClose()
- {
- try
- {
- CMM_SaveForm(g_sFormsDir, this);
- }
- catch(...)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TEVSP200M::FormCreate(TObject *Sender)
- {
- //
- }
- //---------------------------------------------------------------------------
- void __fastcall TEVSP200M::FormShow(TObject *Sender)
- {
- APP_FillCode(CbType, "VHCL");
- Refresh();
- Application->ProcessMessages();
- TmrShow->Enabled = true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TEVSP200M::LoadLocalSkin()
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TEVSP200M::TmrShowTimer(TObject *Sender)
- {
- TmrShow->Enabled = false;
- BtnSearchClick(NULL);
- }
- //---------------------------------------------------------------------------
- void __fastcall TEVSP200M::FormClose(TObject *Sender, TCloseAction &Action)
- {
- try {
- CommClose();
- EVSP200M = NULL;
- Action = caFree;
- } catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TEVSP200M::OnMainFormMessage(TMessage &Msg)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TEVSP200M::RefreshDbData()
- {
- String sQry;
- TADOQuery *pADO = NULL;
- sQry = "SELECT A.EMRG_VHCL_ID, A.VHCL_NMBR, A.VHCL_KIND, A.USE_YN, \r\n"
- " NVL(B.SRVC_ID, '-') AS SRVC_ID, NVL(B.END_YN, '-') AS END_YN \r\n"
- " FROM EMRG_VHCL A \r\n"
- " LEFT OUTER JOIN PRIO_SGNL_REQ_INFR B \r\n"
- " ON A.EMRG_VHCL_ID = B.EMRG_VHCL_ID \r\n";
- CMM_ClearGridTableView(TvList);
- try
- {
- int nRow;
- TvList->BeginUpdate();
- try
- {
- pADO = new TADOQuery(NULL);
- pADO->Close();
- pADO->Connection = ITSDb_GetConnection();
- pADO->SQL->Clear();
- pADO->SQL->Text = sQry;
- pADO->Prepared = true;
- pADO->Open();
- for( ; !pADO->Eof; pADO->Next())
- {
- nRow = TvList->DataController->AppendRecord();
- TvList->DataController->Values[nRow][Col01->Index] = pADO->FieldByName("EMRG_VHCL_ID")->AsInteger;
- TvList->DataController->Values[nRow][Col02->Index] = pADO->FieldByName("VHCL_NMBR")->AsInteger;
- String VHCL_KIND = pADO->FieldByName("VHCL_KIND")->AsString;
- String USE_YN = pADO->FieldByName("USE_YN")->AsString;
- String END_YN = pADO->FieldByName("END_YN")->AsString;
- if (USE_YN == "Y") USE_YN = "[Y] »ç¿ë";
- else if (USE_YN == "N") USE_YN = "[N] ¹Ì»ç¿ë";
- if (END_YN == "Y") END_YN = "[Y] Á¾·á";
- else if (END_YN == "N") END_YN = "[N] ¿î¿µÁß";
- TvList->DataController->Values[nRow][Col03->Index] = "[" + VHCL_KIND + "] " + APP_GetCodeName(CbType, VHCL_KIND);
- TvList->DataController->Values[nRow][Col04->Index] = USE_YN;
- TvList->DataController->Values[nRow][Col05->Index] = pADO->FieldByName("SRVC_ID")->AsString;
- TvList->DataController->Values[nRow][Col06->Index] = END_YN;
- }
- }
- catch(EDatabaseError &E)
- {
- ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
- DBERRORMSG("TEVSP200M::RefreshDbData", String(E.ClassName()), E.Message, sQry);
- throw Exception(String(E.ClassName()) + E.Message);
- }
- catch(Exception &exception)
- {
- ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
- DBERRORMSG("TEVSP200M::RefreshDbData", String(exception.ClassName()), exception.Message, sQry);
- throw Exception(String(exception.ClassName()) + exception.Message);
- }
- }
- __finally
- {
- if (pADO)
- {
- pADO->Close();
- delete pADO;
- }
- TvList->EndUpdate();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TEVSP200M::RefreshData()
- {
- try
- {
- LockWindowUpdate(Handle);
- RefreshDbData();
- }
- __finally
- {
- LockWindowUpdate(0);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TEVSP200M::BtnSearchClick(TObject *Sender)
- {
- RefreshData();
- }
- //---------------------------------------------------------------------------
- void __fastcall TEVSP200M::BtnCloseClick(TObject *Sender)
- {
- Close();
- }
- //---------------------------------------------------------------------------
|