123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include "ITSSkinF.h"
- #include "ITSUtilF.h"
- #include "AppGlobalF.h"
- #include "ITSLangTransF.h"
- #pragma hdrstop
- #include "ITSSEL4MF.h"
- #include "ITS_OPLibF.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma link "cxButtons"
- #pragma link "cxContainer"
- #pragma link "cxControls"
- #pragma link "cxEdit"
- #pragma link "cxGraphics"
- #pragma link "cxGroupBox"
- #pragma link "cxLookAndFeelPainters"
- #pragma link "cxLookAndFeels"
- #pragma link "dxSkinBlack"
- #pragma link "dxSkinBlue"
- #pragma link "dxSkinsCore"
- #pragma link "cxCalc"
- #pragma link "cxCheckBox"
- #pragma link "cxClasses"
- #pragma link "cxCustomData"
- #pragma link "cxData"
- #pragma link "cxDataStorage"
- #pragma link "cxFilter"
- #pragma link "cxGrid"
- #pragma link "cxGridCustomTableView"
- #pragma link "cxGridCustomView"
- #pragma link "cxGridLevel"
- #pragma link "cxGridTableView"
- #pragma link "cxLabel"
- #pragma link "cxStyles"
- #pragma link "cxTextEdit"
- #pragma link "dxSkinscxPCPainter"
- #pragma link "dxSkinMcSkin"
- #pragma resource "*.dfm"
- TITSSEL4M *ITSSEL4M = NULL;
- //---------------------------------------------------------------------------
- __fastcall TITSSEL4M::TITSSEL4M(TComponent* Owner, TItsAtrdManager* AAtrdManager)
- : TForm(Owner)
- {
- LangTrans->Translate(this, ITSDb_GetConnection());
- ITSSkin_Load(this);
- CMM_LoadForm(g_sFormsDir, this);
- m_bSelected = false;
- m_pGDC = TvList->DataController;
- MyItsAtrdManager = AAtrdManager;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITSSEL4M::CommClose()
- {
- try
- {
- CMM_SaveForm(g_sFormsDir, this);
- }
- catch(...)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITSSEL4M::FormShow(TObject *Sender)
- {
- Refresh();
- TmrShow->Enabled = true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITSSEL4M::TmrShowTimer(TObject *Sender)
- {
- TmrShow->Enabled = false;
- BtnSearchClick((TObject*)BtnSearch);
- }
- //---------------------------------------------------------------------------
- void __fastcall TITSSEL4M::BtnSearchClick(TObject *Sender)
- {
- Application->ProcessMessages();
- TSqlCursor sqlCrs((TControl*)BtnSearch);
- RefreshData();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITSSEL4M::RefreshData()
- {
- // 검색조건에 의한 링크 데이터 조회
- try
- {
- SelListData();
- }
- __finally
- {
- //TvList->ApplyBestFit(NULL, false, false);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITSSEL4M::SelListData()
- {
- String sQry;
- TADOQuery *pADO = NULL;
- sQry = "SELECT DISTINCT TRIM(ATRD_NM) AS ATRD_NM \r\n"
- " FROM TB_ATRD \r\n"
- " ORDER BY ATRD_NM \r\n";
- CMM_ClearGridTableView(TvList);
- int nRow = 0;
- TvList->BeginUpdate();
- try
- {
- try
- {
- #if 0
- 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())
- {
- String ATRD_ID = pADO->FieldByName("ATRD_NM")->AsString;
- nRow = m_pGDC->AppendRecord();
- m_pGDC->Values[nRow][ColumnSel->Index] = false;
- m_pGDC->Values[nRow][Column02->Index] = pADO->FieldByName("ATRD_NM")->AsString;
- }
- #else
- FOR_STL(TCDSAtrdName*, pObj, MyItsAtrdManager->FCDSNameLists)
- {
- nRow = m_pGDC->AppendRecord();
- m_pGDC->Values[nRow][ColumnSel->Index] = pObj->IsSelected;
- m_pGDC->Values[nRow][Column02->Index] = pObj->ATRD_NM;
- }
- #endif
- }
- catch(EDatabaseError &E)
- {
- ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
- DBERRORMSG("TITSSEL4M::SelListData", 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("TITSSEL4M::SelListData", String(exception.ClassName()), exception.Message, sQry);
- throw Exception(String(exception.ClassName()) + exception.Message);
- }
- }
- __finally
- {
- if (pADO)
- {
- pADO->Close();
- delete pADO;
- }
- TvList->EndUpdate();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TITSSEL4M::BtnCloseClick(TObject *Sender)
- {
- FIdList = "";
- Close();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITSSEL4M::BtnSelectClick(TObject *Sender)
- {
- FIdList = "";
- int nSelects = CMM_GetSelectCount(TvList, ColumnSel->Index, Column02->Index, FIdList);
- if (0 == nSelects)
- {
- Application->MessageBox(FrmLang->lblSelErr->Caption.c_str(),//L"목록에서 도로를 먼저 선택 하세요.",
- cxGroupBox1->Caption.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
- return;
- }
- MyItsAtrdManager->FCDSNameSelCnt = 0;
- FOR_STL(TCDSAtrdName*, pObj, MyItsAtrdManager->FCDSNameLists)
- {
- pObj->IsSelected = false;
- }
- TvList->BeginUpdate();
- try
- {
- int nRowCnt = TvList->ViewData->RecordCount;
- for (int ii = 0; ii < nRowCnt; ii++)
- {
- TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii];
- if (!ARow->IsData) continue;
- if (((bool)ARow->Values[ColumnSel->Index]))
- {
- String ATRD_NM = ARow->Values[Column02->Index];
- TCDSAtrdName *pObj = MyItsAtrdManager->FCDSNameLists.Find(ATRD_NM);
- if (pObj)
- {
- pObj->IsSelected = true;
- MyItsAtrdManager->FCDSNameSelCnt++;
- }
- }
- }
- }
- __finally
- {
- TvList->EndUpdate();
- }
- m_bSelected = true;
- Close();
- }
- //---------------------------------------------------------------------------
- void __fastcall TITSSEL4M::FormClose(TObject *Sender, TCloseAction &Action)
- {
- CommClose();
- ITSSEL4M = NULL;
- //Action = caFree;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITSSEL4M::SetMultiSelect(bool AMultiSelect)
- {
- TvList->OptionsSelection->MultiSelect = AMultiSelect;
- }
- //---------------------------------------------------------------------------
- bool __fastcall TITSSEL4M::GetMultiSelect()
- {
- return TvList->OptionsSelection->MultiSelect;
- }
- //---------------------------------------------------------------------------
- void __fastcall TITSSEL4M::BtnAllSelectClick(TObject *Sender)
- {
- TcxButton *pBtn = (TcxButton*)Sender;
- CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag);
- }
- //---------------------------------------------------------------------------
|